Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
df861db5
Commit
df861db5
authored
Sep 17, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify functions for Trend/Growth
parent
476f84be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
20 deletions
+22
-20
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+22
-20
No files found.
cell/model/FormulaObjects/statisticalFunctions.js
View file @
df861db5
...
...
@@ -1425,15 +1425,16 @@
var
N
=
0
;
var
nCase
;
var
n
C
Y
=
pMatY
.
length
;
var
n
R
Y
=
pMatY
[
0
].
length
;
var
n
R
Y
=
pMatY
.
length
;
var
n
C
Y
=
pMatY
[
0
].
length
;
var
nCountY
=
nCY
*
nRY
;
for
(
var
i
=
0
;
i
<
pMatY
.
length
;
i
++
)
{
for
(
var
j
=
0
;
j
<
pMatY
[
i
].
length
;
j
++
)
{
if
(
!
pMatY
[
i
][
j
])
//!pMatY->IsValue(i)
{
if
(
!
pMatY
[
i
][
j
])
{
//PushIllegalArgument();
return
false
;
}
else
{
pMatY
[
i
][
j
]
=
pMatY
[
i
][
j
].
getValue
();
}
}
}
...
...
@@ -1448,7 +1449,7 @@
//PushIllegalArgument();
return
false
;
}
else
{
pNewY
[
i
][
j
]
=
new
cNumber
(
Math
.
log
(
fVal
)
);
pNewY
[
i
][
j
]
=
Math
.
log
(
fVal
);
}
}
}
...
...
@@ -1456,15 +1457,16 @@
}
if
(
pMatX
)
{
n
C
X
=
pMatX
.
length
;
n
R
X
=
pMatX
[
0
].
length
;
n
R
X
=
pMatX
.
length
;
n
C
X
=
pMatX
[
0
].
length
;
var
nCountX
=
nCX
*
nRX
;
for
(
var
i
=
0
;
i
<
pMatX
.
length
;
i
++
)
{
for
(
var
j
=
0
;
j
<
pMatX
[
i
].
length
;
j
++
)
{
if
(
!
pMatX
[
i
][
j
])
//!pMatX->IsValue(i)
{
if
(
!
pMatX
[
i
][
j
])
{
//PushIllegalArgument();
return
false
;
}
else
{
pMatX
[
i
][
j
]
=
pMatX
[
i
][
j
].
getValue
();
}
}
}
...
...
@@ -1494,7 +1496,7 @@
M
=
nRX
;
}
}
else
{
pMatX
=
GetNewMat
(
n
CY
,
nR
Y
);
pMatX
=
GetNewMat
(
n
RY
,
nC
Y
);
nCX
=
nCY
;
nRX
=
nRY
;
if
(
!
pMatX
)
{
...
...
@@ -1515,7 +1517,7 @@
var
fSum
=
0.0
;
for
(
var
i
=
0
;
i
<
pMat
.
length
;
i
++
)
{
for
(
var
j
=
0
;
j
<
pMat
[
i
].
length
;
j
++
)
{
fSum
+=
pMat
[
i
][
j
]
.
getValue
()
;
fSum
+=
pMat
[
i
][
j
];
}
}
...
...
@@ -1544,16 +1546,16 @@
for
(
var
i
=
0
;
i
<
nC
;
i
++
)
{
var
fSum
=
0.0
;
for
(
var
k
=
0
;
k
<
nR
;
k
++
)
{
fSum
+=
pX
[
i
][
k
].
getValue
();
// GetDouble(Column,Row)
pResMat
[
i
][
k
]
=
fSum
/
nR
;
fSum
+=
pX
[
k
][
i
];
// GetDouble(Column,Row)
}
pResMat
[
i
][
0
]
=
fSum
/
nR
;
}
}
function
lcl_CalculateColumnsDelta
(
pMat
,
pColumnMeans
,
nC
,
nR
)
{
for
(
var
i
=
0
;
i
<
nC
;
i
++
)
{
for
(
var
k
=
0
;
k
<
nR
;
k
++
)
{
pMat
[
i
][
k
]
=
approxSub
(
pMat
[
i
][
k
],
pColumnMeans
[
i
]);
pMat
[
k
][
i
]
=
approxSub
(
pMat
[
k
][
i
],
pColumnMeans
[
i
][
0
]);
}
}
}
...
...
@@ -1824,7 +1826,7 @@
fMeanY
=
lcl_GetMeanOverAll
(
pMatY
,
N
);
for
(
var
i
=
0
;
i
<
pMatY
.
length
;
i
++
)
{
for
(
var
j
=
0
;
j
<
pMatY
[
i
].
length
;
j
++
)
{
pMatY
[
i
][
j
]
=
approxSub
(
pMatY
[
i
][
j
]
.
getValue
()
,
fMeanY
);
pMatY
[
i
][
j
]
=
approxSub
(
pMatY
[
i
][
j
],
fMeanY
);
}
}
}
...
...
@@ -1836,7 +1838,7 @@
fMeanX
=
lcl_GetMeanOverAll
(
pMatX
,
N
);
for
(
var
i
=
0
;
i
<
pMatX
.
length
;
i
++
)
{
for
(
var
j
=
0
;
j
<
pMatX
[
i
].
length
;
j
++
)
{
pMatX
[
i
][
j
]
=
approxSub
(
pMatX
[
i
][
j
]
.
getValue
()
,
fMeanX
);
pMatX
[
i
][
j
]
=
approxSub
(
pMatX
[
i
][
j
],
fMeanX
);
}
}
}
...
...
@@ -1868,7 +1870,7 @@
{
if
(
nCase
===
2
)
// Y is column
{
var
aVecR
;
// for QR decomposition
var
aVecR
=
[]
;
// for QR decomposition
// Enough memory for needed matrices?
var
pMeans
=
GetNewMat
(
K
,
1
);
// mean of each column
var
pSlopes
=
GetNewMat
(
1
,
K
);
// from b1 to bK
...
...
@@ -6254,16 +6256,16 @@
cGROWTH
.
prototype
.
constructor
=
cGROWTH
;
cGROWTH
.
prototype
.
argumentsMin
=
1
;
cGROWTH
.
prototype
.
argumentsMax
=
4
;
/*
cGROWTH.prototype.Calculate = function (arg) {
cGROWTH
.
prototype
.
Calculate
=
function
(
arg
)
{
var
pMatY
=
arg
[
0
].
getMatrix
();
var pMatX = arg[1]
.getMatrix()
;
var
pMatX
=
arg
[
1
]
?
arg
[
1
].
getMatrix
()
:
null
;
var
pMatNewX
=
arg
[
2
]
?
arg
[
2
]
:
null
;
var
bConstant
=
undefined
!==
arg
[
3
]
?
arg
[
3
]
:
true
;
var
res
=
CalculateTrendGrowth
(
pMatY
,
pMatX
,
pMatNewX
,
bConstant
,
true
);
return
new
cNumber
(
res
[
0
][
0
]);
};
*/
};
/**
* @constructor
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment