20#include <rtl/math.hxx>
24#ifdef DEBUG_SC_LUP_DECOMPOSITION
35#include <document.hxx>
51double MatrixAdd(
const double& lhs,
const double& rhs)
53 return ::rtl::math::approxAdd( lhs,rhs);
56double MatrixSub(
const double& lhs,
const double& rhs)
58 return ::rtl::math::approxSub( lhs,rhs);
61double MatrixMul(
const double& lhs,
const double& rhs)
66double MatrixDiv(
const double& lhs,
const double& rhs)
71double MatrixPow(
const double& lhs,
const double& rhs)
73 return ::pow( lhs,rhs);
80 for (
SCSIZE row = 0; row <
n; row++)
86 fSum += pA->GetDouble(k,row) * pB->GetDouble(col,k);
87 pR->PutDouble(fSum.
get(), col, row);
104 double fz = fmod(fx, fy);
123 size_t nRefInList = 0;
124 while (
nGlobalError == FormulaError::NONE && nParamCount-- > 0)
132 fx = ::rtl::math::approxFloor(
GetDouble());
148 if (aValIter.
GetFirst(nCellVal, nErr))
152 fx = ::rtl::math::approxFloor( nCellVal);
159 }
while (nErr == FormulaError::NONE && aValIter.
GetNext(nCellVal, nErr));
172 pMat->GetDimensions(nC, nR);
173 if (nC == 0 || nR == 0)
174 SetError(FormulaError::IllegalArgument);
177 double nVal = pMat->GetGcd();
183 default :
SetError(FormulaError::IllegalParameter);
break;
197 size_t nRefInList = 0;
198 while (
nGlobalError == FormulaError::NONE && nParamCount-- > 0)
206 fx = ::rtl::math::approxFloor(
GetDouble());
212 if (fx == 0.0 || fy == 0.0)
225 if (aValIter.
GetFirst(nCellVal, nErr))
229 fx = ::rtl::math::approxFloor( nCellVal);
235 if (fx == 0.0 || fy == 0.0)
239 }
while (nErr == FormulaError::NONE && aValIter.
GetNext(nCellVal, nErr));
252 pMat->GetDimensions(nC, nR);
253 if (nC == 0 || nR == 0)
254 SetError(FormulaError::IllegalArgument);
257 double nVal = pMat->GetLcm();
258 fy = (nVal * fy ) /
ScGetGCD(nVal, fy);
263 default :
SetError(FormulaError::IllegalParameter);
break;
271 rMat->SetErrorInterpreter(
this);
276 rMat->GetDimensions( nCols, nRows);
277 if ( nCols != nC || nRows != nR )
279 SetError( FormulaError::MatrixSize);
306 if (nTab1 != nTab2 ||
nGlobalError != FormulaError::NONE)
309 SetError(FormulaError::IllegalParameter);
313 if (nTab1 == nTab2 && pToken)
324 SCCOL nTempCol = nCol1;
325 SCROW nTempRow = nRow1;
330 SCSIZE nMatCols =
static_cast<SCSIZE>(nCol2 - nCol1 + 1);
331 SCSIZE nMatRows =
static_cast<SCSIZE>(nRow2 - nRow1 + 1);
339 ScTokenMatrixMap::const_iterator aIter;
371 SCROW nNextRow = nRow1;
372 SCCOL nNextCol = nCol1;
374 SCROW nThisRow = nRow2;
375 SCCOL nThisCol = nCol1 - 1;
378 for (
bool bHas = aCellIter.
first(); bHas; bHas = aCellIter.
next())
382 if (nThisCol != nNextCol || nThisRow != nNextRow)
385 for ( ; nNextCol <= nThisCol; ++nNextCol)
387 const SCSIZE nC = nNextCol - nCol1;
388 const SCSIZE nMatStopRow = ((nNextCol < nThisCol) ? nMatRows : nThisRow - nRow1);
389 for (
SCSIZE nR = nNextRow - nRow1; nR < nMatStopRow; ++nR)
391 pMat->PutEmpty( nC, nR);
396 if (nThisRow == nRow2)
398 nNextCol = nThisCol + 1;
404 nNextRow = nThisRow + 1;
407 const SCSIZE nMatCol =
static_cast<SCSIZE>(nThisCol - nCol1);
408 const SCSIZE nMatRow =
static_cast<SCSIZE>(nThisRow - nRow1);
412 pMat->PutEmpty( nMatCol, nMatRow);
426 const ScAddress aAdr( nThisCol, nThisRow, nTab1);
430 pMat->PutDouble( fVal, nMatCol, nMatRow);
438 assert(!
"aCell.what?");
439 pMat->PutEmpty( nMatCol, nMatRow);
444 if (nThisCol != nCol2 || nThisRow != nRow2)
446 for ( ; nNextCol <= nCol2; ++nNextCol)
448 SCSIZE nC = nNextCol - nCol1;
449 for (
SCSIZE nR = nNextRow - nRow1; nR < nMatRows; ++nR)
451 pMat->PutEmpty( nC, nR);
478 pMat->PutEmpty(0, 0);
485 pMat->PutString(
aStr, 0);
498 nCol2, nRow2, nTab2);
517 pMat->PutDouble( fVal, 0);
530 pMat->PutDouble( fVal, 0);
534 pMat->PutString(
aStr, 0);
551 switch (pToken->GetType())
554 pMat->PutError( pToken->GetError(), 0, 0);
557 pMat->PutDouble( pToken->GetDouble(), 0, 0);
560 pMat->PutString( pToken->GetString(), 0, 0);
572 SetError( FormulaError::IllegalArgument);
592 aRange.
GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
640 if (nErrCode != FormulaError::NONE)
661 if (nCol2 - nCol1 >=
static_cast<SCCOL>(nR) &&
662 nRow2 - nRow1 >=
static_cast<SCROW>(nC) &&
665 ScAddress aAdr( sal::static_int_cast<SCCOL>( nCol1 + nR ),
666 sal::static_int_cast<SCROW>( nRow1 + nC ), nTab1 );
699 if (nC < nCl && nR < nRw)
741 mM->FillDouble(0.0, 0, 0,
n-1,
n-1);
743 mM->PutDouble(1.0,
i,
i);
766 ::std::vector< SCSIZE> & P )
770 ::std::vector< double> aScale(
n);
782 aScale[
i] = 1.0 / fMax;
789 for (
SCSIZE k=0; k < l; ++k)
794 double fScale = aScale[k];
798 double fTmp = fScale * fabs( mA->
GetDouble( k,
i));
816 double fTmp = aScale[k];
817 aScale[k] = aScale[kp];
833 for (
SCSIZE j = k+1; j <
n; ++j)
838#ifdef DEBUG_SC_LUP_DECOMPOSITION
839 fprintf( stderr,
"\n%s\n",
"lcl_LUP_decompose(): LU");
843 fprintf( stderr,
"%8.2g ", mA->
GetDouble( j,
i));
844 fprintf( stderr,
"\n%s\n",
"");
846 fprintf( stderr,
"\n%s\n",
"lcl_LUP_decompose(): P");
848 fprintf( stderr,
"%5u ", (
unsigned)P[j]);
849 fprintf( stderr,
"\n%s\n",
"");
852 bool bSingular=
false;
867 const ::std::vector< SCSIZE> & P, const ::std::vector< double> & B,
868 ::std::vector< double> & X )
882 for (
SCSIZE j = nFirst; j <
i; ++j)
897#ifdef DEBUG_SC_LUP_DECOMPOSITION
898 fprintf( stderr,
"\n%s\n",
"lcl_LUP_solve():");
900 fprintf( stderr,
"%8.2g ",
X[
i]);
901 fprintf( stderr,
"%s\n",
"");
916 if ( !pMat->IsNumeric() )
922 pMat->GetDimensions(nC, nR);
923 if ( nC != nR || nC == 0 )
935 ::std::vector< SCSIZE> P(nR);
943 double fDet = nDetSign;
945 fDet *= xLU->GetDouble(
i,
i);
963 if ( !pMat->IsNumeric() )
969 pMat->GetDimensions(nC, nR);
974 if (pInterpreter !=
nullptr)
985 if ( nC != nR || nC == 0 )
999 ::std::vector< SCSIZE> P(nR);
1006 ::std::vector< double>
B(nR);
1007 ::std::vector< double>
X(nR);
1008 for (
SCSIZE j=0; j < nR; ++j)
1015 xY->PutDouble(
X[
i], j,
i);
1017#ifdef DEBUG_SC_LUP_DECOMPOSITION
1035 const double fInvEpsilon = 1.0E-7;
1040 lcl_MFastMult( pMat, xY.get(), pR, nR, nR, nR);
1041 fprintf( stderr,
"\n%s\n",
"ScMatInv(): mult-identity");
1044 for (
SCSIZE j=0; j < nR; ++j)
1047 fprintf( stderr,
"%8.2g ", fTmp);
1048 if (fabs( fTmp - (
i == j)) > fInvEpsilon)
1049 SetError( FormulaError::IllegalArgument);
1051 fprintf( stderr,
"\n%s\n",
"");
1074 if ( pMat1->IsNumeric() && pMat2->IsNumeric() )
1078 pMat1->GetDimensions(nC1, nR1);
1079 pMat2->GetDimensions(nC2, nR2);
1090 for (
SCSIZE j = 0; j < nC2; j++)
1093 for (
SCSIZE k = 0; k < nC1; k++)
1095 fSum += pMat1->GetDouble(k,
i)*pMat2->GetDouble(j,k);
1097 pRMat->PutDouble(fSum.
get(), j,
i);
1123 pMat->GetDimensions(nC, nR);
1127 pMat->MatTrans(*pRMat);
1164 xResMat->ExecuteBinaryOp(nMinC, nMinR, rMat1, rMat2, pInterpreter,
Op);
1172 pMat1->GetDimensions(nC1, nR1);
1173 pMat2->GetDimensions(nC2, nR2);
1187 if ( nFmt1 == SvNumFormatType::UNDEFINED && nFmt2 == SvNumFormatType::UNDEFINED )
1190 if ( nFmt1 == nFmt2 )
1192 if ( nFmt1 == SvNumFormatType::TIME || nFmt1 == SvNumFormatType::DATETIME
1193 || nFmt1 == SvNumFormatType::DURATION )
1194 nFuncFmt = SvNumFormatType::DURATION;
1197 else if ( nFmt1 == SvNumFormatType::UNDEFINED )
1199 else if ( nFmt2 == SvNumFormatType::UNDEFINED )
1203 if ( nFmt1 == SvNumFormatType::DATE || nFmt2 == SvNumFormatType::DATE ||
1204 nFmt1 == SvNumFormatType::DATETIME || nFmt2 == SvNumFormatType::DATETIME )
1206 if ( nFmt1 == SvNumFormatType::TIME || nFmt2 == SvNumFormatType::TIME )
1207 nFuncFmt = SvNumFormatType::DATETIME;
1221 double fVal1 = 0.0, fVal2 = 0.0;
1223 nFmt1 = nFmt2 = SvNumFormatType::UNDEFINED;
1224 bool bDuration =
false;
1235 case SvNumFormatType::DATE :
1236 case SvNumFormatType::TIME :
1237 case SvNumFormatType::DATETIME :
1238 case SvNumFormatType::DURATION :
1242 case SvNumFormatType::CURRENCY :
1246 case SvNumFormatType::PERCENT :
1247 nFmtPercentType = SvNumFormatType::PERCENT;
1259 case SvNumFormatType::DATE :
1260 case SvNumFormatType::TIME :
1261 case SvNumFormatType::DATETIME :
1262 case SvNumFormatType::DURATION :
1266 case SvNumFormatType::CURRENCY :
1270 case SvNumFormatType::PERCENT :
1271 nFmtPercentType = SvNumFormatType::PERCENT;
1293 else if (pMat1 || pMat2)
1310 pMat->GetDimensions(nC, nR);
1316 pMat->SubOp( bFlag, fVal, *pResMat);
1320 pMat->AddOp( fVal, *pResMat);
1330 if ( nFmtCurrencyType == SvNumFormatType::CURRENCY )
1338 if (nFmtPercentType == SvNumFormatType::PERCENT &&
nFuncFmtType == SvNumFormatType::NUMBER)
1341 if ((
nFuncFmtType == SvNumFormatType::DURATION || bDuration)
1353 PushDouble( ::rtl::math::approxSub( fVal1, fVal2 ) );
1355 PushDouble( ::rtl::math::approxAdd( fVal1, fVal2 ) );
1364 OUString sStr1, sStr2;
1381 else if (pMat1 || pMat2)
1398 pMat->GetDimensions(nC, nR);
1405 for (
SCSIZE j = 0; j < nR; ++j)
1411 for (
SCSIZE j = 0; j < nR; ++j)
1414 if (nErr != FormulaError::NONE)
1415 pResMat->PutError( nErr,
i, j);
1418 OUString aTmp = sStr + pMat->GetString(*
pFormatter,
i, j).getString();
1426 for (
SCSIZE j = 0; j < nR; ++j)
1429 if (nErr != FormulaError::NONE)
1430 pResMat->PutError( nErr,
i, j);
1433 OUString aTmp = pMat->GetString(*
pFormatter,
i, j).getString() + sStr;
1460 double fVal1 = 0.0, fVal2 = 0.0;
1470 case SvNumFormatType::CURRENCY :
1484 case SvNumFormatType::CURRENCY :
1499 else if (pMat1 || pMat2)
1511 pMat->GetDimensions(nC, nR);
1515 pMat->MulOp( fVal, *pResMat);
1524 if ( nFmtCurrencyType == SvNumFormatType::CURRENCY )
1537 double fVal1 = 0.0, fVal2 = 0.0;
1556 case SvNumFormatType::CURRENCY :
1571 else if (pMat1 || pMat2)
1588 pMat->GetDimensions(nC, nR);
1592 pMat->DivOp( bFlag, fVal, *pResMat);
1601 if ( nFmtCurrencyType == SvNumFormatType::CURRENCY &&
1602 nFmtCurrencyType2 != SvNumFormatType::CURRENCY)
1621 double fVal1 = 0.0, fVal2 = 0.0;
1638 else if (pMat1 || pMat2)
1655 pMat->GetDimensions(nC, nR);
1659 pMat->PowOp( bFlag, fVal, *pResMat);
1673 short nParamCount =
GetByte();
1681 size_t nInRefList = 0;
1685 pMatLast =
GetMatrix( --nParamCount, nInRefList);
1692 SCSIZE nC, nCLast, nR, nRLast;
1693 pMatLast->GetDimensions(nCLast, nRLast);
1694 std::vector<double> aResArray;
1695 pMatLast->GetDoubleArray(aResArray);
1697 while (nParamCount--)
1699 pMat =
GetMatrix( nParamCount, nInRefList);
1705 pMat->GetDimensions(nC, nR);
1706 if (nC != nCLast || nR != nRLast)
1712 pMat->MergeDoubleArrayMultiply(aResArray);
1716 for(
double fPosArray : aResArray )
1719 if (nErr == FormulaError::NONE)
1721 else if (nErr != FormulaError::ElementNaN)
1746 if (!pMat2 || !pMat1)
1753 pMat2->GetDimensions(nC2, nR2);
1754 pMat1->GetDimensions(nC1, nR1);
1755 if (nC1 != nC2 || nR1 != nR2)
1762 for (
i = 0;
i < nC1;
i++)
1763 for (j = 0; j < nR1; j++)
1764 if (!pMat1->IsStringOrEmpty(
i,j) && !pMat2->IsStringOrEmpty(
i,j))
1766 fVal = pMat1->GetDouble(
i,j);
1767 fSum += fVal * fVal;
1768 fVal = pMat2->GetDouble(
i,j);
1770 fSum += fVal * fVal;
1772 fSum -= fVal * fVal;
1789 if (!pMat2 || !pMat1)
1796 pMat2->GetDimensions(nC2, nR2);
1797 pMat1->GetDimensions(nC1, nR1);
1798 if (nC1 != nC2 || nR1 != nR2)
1810 PushDouble(pResMat->SumSquare(
false).maAccumulator.get());
1819 vector<double> aBinArray;
1820 vector<tools::Long> aBinIndexOrder;
1822 GetSortArray( 1, aBinArray, &aBinIndexOrder,
false,
false );
1823 SCSIZE nBinSize = aBinArray.size();
1830 vector<double> aDataArray;
1832 SCSIZE nDataSize = aDataArray.size();
1834 if (aDataArray.empty() ||
nGlobalError != FormulaError::NONE)
1846 if (nBinSize != aBinIndexOrder.size())
1854 for (j = 0; j < nBinSize; ++j)
1857 while (
i < nDataSize && aDataArray[
i] <= aBinArray[j])
1862 pResMat->PutDouble(
static_cast<double>(
nCount), aBinIndexOrder[j]);
1864 pResMat->PutDouble(
static_cast<double>(nDataSize-
i), j);
1881 fSum += pMatA->GetDouble(i) * pMatB->GetDouble(i);
1891 for (
SCSIZE row=nR; row<nN; row++)
1892 fNorm += (pMatA->GetDouble(nC,row)) * (pMatA->GetDouble(nC,row));
1893 return sqrt(fNorm.
get());
1902 fNorm += (pMatA->GetDouble(col,nR)) * (pMatA->GetDouble(col,nR));
1903 return sqrt(fNorm.
get());
1912 for (
SCSIZE row=nR; row<nN; row++)
1914 double fVal = fabs(pMatA->GetDouble(nC,row));
1928 double fVal = fabs(pMatA->GetDouble(col,nR));
1942 for (
SCSIZE row=nR; row<nN; row++)
1943 fResult += pMatA->GetDouble(nCa,row) * pMatB->GetDouble(nCb,row);
1944 return fResult.
get();
1954 fResult += pMatA->GetDouble(col,nRa) * pMatB->GetDouble(col,nRb);
1955 return fResult.
get();
1959double lcl_GetSign(
double fValue)
1961 return (fValue >= 0.0 ? 1.0 : -1.0 );
1977bool lcl_CalculateQRdecomposition(
const ScMatrixRef& pMatA,
1984 const double fScale = lcl_GetColumnMaximumNorm(pMatA, col, col, nN);
1990 for (
SCSIZE row = col; row <nN; row++)
1991 pMatA->PutDouble( pMatA->GetDouble(col,row)/fScale, col, row);
1993 const double fEuclid = lcl_GetColumnEuclideanNorm(pMatA, col, col, nN);
1994 const double fFactor = 1.0/fEuclid/(fEuclid + fabs(pMatA->GetDouble(col,col)));
1995 const double fSignum = lcl_GetSign(pMatA->GetDouble(col,col));
1996 pMatA->PutDouble( pMatA->GetDouble(col,col) + fSignum*fEuclid, col,col);
1997 pVecR[
col] = -fSignum * fScale * fEuclid;
2000 for (
SCSIZE c=col+1; c<nK; c++)
2002 const double fSum =lcl_GetColumnSumProduct(pMatA, col, pMatA, c, col, nN);
2003 for (
SCSIZE row = col; row <nN; row++)
2004 pMatA->PutDouble( pMatA->GetDouble(c,row) - fSum * fFactor * pMatA->GetDouble(col,row), c, row);
2011bool lcl_TCalculateQRdecomposition(
const ScMatrixRef& pMatA,
2016 for (
SCSIZE row = 0; row <nK; row++)
2019 const double fScale = lcl_TGetColumnMaximumNorm(pMatA, row, row, nN);
2026 pMatA->PutDouble( pMatA->GetDouble(col,row)/fScale, col, row);
2028 const double fEuclid = lcl_TGetColumnEuclideanNorm(pMatA, row, row, nN);
2029 const double fFactor = 1.0/fEuclid/(fEuclid + fabs(pMatA->GetDouble(row,row)));
2030 const double fSignum = lcl_GetSign(pMatA->GetDouble(row,row));
2031 pMatA->PutDouble( pMatA->GetDouble(row,row) + fSignum*fEuclid, row,row);
2032 pVecR[row] = -fSignum * fScale * fEuclid;
2035 for (
SCSIZE r=row+1; r<nK; r++)
2037 fSum =lcl_TGetColumnSumProduct(pMatA, row, pMatA, r, row, nN);
2040 pMatA->GetDouble(col,r) - fSum * fFactor * pMatA->GetDouble(col,row), col, r);
2056 double fDenominator = lcl_GetColumnSumProduct(pMatA, nC, pMatA, nC, nC, nN);
2057 double fNumerator = lcl_GetColumnSumProduct(pMatA, nC, pMatY, 0, nC, nN);
2058 double fFactor = 2.0 * (fNumerator/fDenominator);
2059 for (
SCSIZE row = nC; row < nN; row++)
2061 pMatY->GetDouble(row) - fFactor * pMatA->GetDouble(nC,row), row);
2069 double fDenominator = lcl_TGetColumnSumProduct(pMatA, nR, pMatA, nR, nR, nN);
2070 double fNumerator = lcl_TGetColumnSumProduct(pMatA, nR, pMatY, 0, nR, nN);
2071 double fFactor = 2.0 * (fNumerator/fDenominator);
2074 pMatY->GetDouble(col) - fFactor * pMatA->GetDouble(col,nR),
col);
2083void lcl_SolveWithUpperRightTriangle(
const ScMatrixRef& pMatA,
2084 ::std::vector< double>& pVecR,
const ScMatrixRef& pMatS,
2085 SCSIZE nK,
bool bIsTransposed)
2090 for (
SCSIZE rowp1 = nK; rowp1>0; rowp1--)
2093 KahanSum fSum = pMatS->GetDouble(row);
2096 fSum -= pMatA->GetDouble(row,col) * pMatS->GetDouble(col);
2098 fSum -= pMatA->GetDouble(col,row) * pMatS->GetDouble(col);
2099 pMatS->PutDouble( fSum.
get() / pVecR[row] , row);
2109void lcl_SolveWithLowerLeftTriangle(
const ScMatrixRef& pMatA,
2110 ::std::vector< double>& pVecR,
const ScMatrixRef& pMatT,
2111 SCSIZE nK,
bool bIsTransposed)
2114 for (
SCSIZE row = 0; row < nK; row++)
2116 KahanSum fSum = pMatT -> GetDouble(row);
2120 fSum -= pMatA->GetDouble(col,row) * pMatT->GetDouble(col);
2122 fSum -= pMatA->GetDouble(row,col) * pMatT->GetDouble(col);
2124 pMatT->PutDouble( fSum.
get() / pVecR[row] , row);
2134void lcl_ApplyUpperRightTriangle(
const ScMatrixRef& pMatA,
2135 ::std::vector< double>& pVecR,
const ScMatrixRef& pMatB,
2139 for (
SCSIZE row = 0; row < nK; row++)
2141 KahanSum fSum = pVecR[row] * pMatB->GetDouble(row);
2144 fSum += pMatA->GetDouble(row,col) * pMatB->GetDouble(col);
2146 fSum += pMatA->GetDouble(col,row) * pMatB->GetDouble(col);
2147 pMatZ->PutDouble( fSum.
get(), row);
2155 fSum += pMat->GetDouble(i);
2156 return fSum.
get()/
static_cast<double>(nN);
2167 for (
SCSIZE k=0; k < nR; k++)
2168 fSum += pX->GetDouble(i,k);
2169 pResMat ->PutDouble( fSum.
get()/
static_cast<double>(nR),i);
2178 for (
SCSIZE k=0; k < nR; k++)
2182 fSum += pX->GetDouble(i,k);
2183 pResMat ->PutDouble( fSum.
get()/
static_cast<double>(nC),k);
2191 for (
SCSIZE k = 0; k < nR; k++)
2192 pMat->PutDouble( ::rtl::math::approxSub
2193 (pMat->GetDouble(i,k) , pColumnMeans->GetDouble(i) ) , i, k);
2199 for (
SCSIZE k = 0; k < nR; k++)
2201 pMat->PutDouble( ::rtl::math::approxSub
2202 ( pMat->GetDouble(i,k) , pRowMeans->GetDouble(k) ) , i, k);
2214 const double fTemp = pMatY->GetDouble(i) - fSlope * pMatX->GetDouble(i);
2215 fSum += fTemp * fTemp;
2236 pMatY->GetDimensions(nCY, nRY);
2237 const SCSIZE nCountY = nCY * nRY;
2240 if (!pMatY->IsValue(
i))
2250 for (
SCSIZE nElem = 0; nElem < nCountY; nElem++)
2252 const double fVal = pNewY->GetDouble(nElem);
2259 pNewY->PutDouble(
log(fVal), nElem);
2266 pMatX->GetDimensions(nCX, nRX);
2267 const SCSIZE nCountX = nCX * nRX;
2269 if (!pMatX->IsValue(
i))
2274 if (nCX == nCY && nRX == nRY)
2280 else if (nCY != 1 && nRY != 1)
2299 else if (nCX != nCY)
2322 pMatX->PutDouble(
static_cast<double>(
i),
i-1);
2347 bool bConstant, bStats;
2350 if (nParamCount == 4)
2357 if (nParamCount >= 3)
2373 if (nParamCount >= 2)
2401 if (!
CheckMatrix(_bRKP,nCase,nCX,nCY,nRX,nRY,K,
N,pMatX,pMatY))
2408 if ((bConstant && (
N<K+1)) || (!bConstant && (
N<K)) || (
N<1) || (K<1))
2429 pResMat->PutError( FormulaError::NotAvailable,
i, 2);
2430 pResMat->PutError( FormulaError::NotAvailable,
i, 3);
2431 pResMat->PutError( FormulaError::NotAvailable,
i, 4);
2437 double fMeanY = 0.0;
2442 if (!pNewX || !pNewY)
2450 fMeanY = lcl_GetMeanOverAll(pMatY,
N);
2453 pMatY->PutDouble( ::rtl::math::approxSub(pMatY->GetDouble(
i),fMeanY),
i );
2460 double fMeanX = 0.0;
2463 fMeanX = lcl_GetMeanOverAll(pMatX,
N);
2466 pMatX->PutDouble( ::rtl::math::approxSub(pMatX->GetDouble(
i),fMeanX),
i );
2469 double fSumXY = lcl_GetSumProduct(pMatX,pMatY,
N);
2470 double fSumX2 = lcl_GetSumProduct(pMatX,pMatX,
N);
2476 double fSlope = fSumXY / fSumX2;
2477 double fIntercept = 0.0;
2479 fIntercept = fMeanY - fSlope * fMeanX;
2480 pResMat->PutDouble(_bRKP ? exp(fIntercept) : fIntercept, 1, 0);
2481 pResMat->PutDouble(_bRKP ? exp(fSlope) : fSlope, 0, 0);
2485 double fSSreg = fSlope * fSlope * fSumX2;
2486 pResMat->PutDouble(fSSreg, 0, 4);
2488 double fDegreesFreedom =
static_cast<double>( bConstant ?
N-2 :
N-1 );
2489 pResMat->PutDouble(fDegreesFreedom, 1, 3);
2491 double fSSresid = lcl_GetSSresid(pMatX,pMatY,fSlope,
N);
2492 pResMat->PutDouble(fSSresid, 1, 4);
2494 if (fDegreesFreedom == 0.0 || fSSresid == 0.0 || fSSreg == 0.0)
2497 pResMat->PutDouble(0.0, 1, 4);
2498 pResMat->PutError( FormulaError::NotAvailable, 0, 3);
2499 pResMat->PutDouble(0.0, 1, 2);
2500 pResMat->PutDouble(0.0, 0, 1);
2502 pResMat->PutDouble(0.0, 1, 1);
2504 pResMat->PutError( FormulaError::NotAvailable, 1, 1);
2505 pResMat->PutDouble(1.0, 0, 2);
2509 double fFstatistic = (fSSreg /
static_cast<double>(K))
2510 / (fSSresid / fDegreesFreedom);
2511 pResMat->PutDouble(fFstatistic, 0, 3);
2514 double fRMSE = sqrt(fSSresid / fDegreesFreedom);
2515 pResMat->PutDouble(fRMSE, 1, 2);
2517 double fSigmaSlope = fRMSE / sqrt(fSumX2);
2518 pResMat->PutDouble(fSigmaSlope, 0, 1);
2522 double fSigmaIntercept = fRMSE
2523 * sqrt(fMeanX*fMeanX/fSumX2 + 1.0/
static_cast<double>(
N));
2524 pResMat->PutDouble(fSigmaIntercept, 1, 1);
2528 pResMat->PutError( FormulaError::NotAvailable, 1, 1);
2531 double fR2 = fSSreg / (fSSreg + fSSresid);
2532 pResMat->PutDouble(fR2, 0, 2);
2543 ::std::vector< double> aVecR(
N);
2548 pMatZ = pMatY->Clone();
2552 if (!pMeans || !pMatZ || !pSlopes)
2559 lcl_CalculateColumnMeans(pMatX, pMeans, K,
N);
2560 lcl_CalculateColumnsDelta(pMatX, pMeans, K,
N);
2562 if (!lcl_CalculateQRdecomposition(pMatX, aVecR, K,
N))
2569 bool bIsSingular=
false;
2570 for (
SCSIZE row=0; row < K && !bIsSingular; row++)
2571 bIsSingular = aVecR[row] == 0.0;
2580 lcl_ApplyHouseholderTransformation(pMatX,
col, pMatZ,
N);
2586 pSlopes->PutDouble( pMatZ->GetDouble(
col),
col);
2588 lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pSlopes, K,
false);
2589 double fIntercept = 0.0;
2591 fIntercept = fMeanY - lcl_GetSumProduct(pMeans,pSlopes,K);
2593 pResMat->PutDouble(_bRKP ? exp(fIntercept) : fIntercept, K, 0 );
2595 pResMat->PutDouble(_bRKP ? exp(pSlopes->GetDouble(
i))
2596 : pSlopes->GetDouble(
i) , K-1-
i, 0);
2600 double fSSreg = 0.0;
2601 double fSSresid = 0.0;
2603 pMatZ->FillDouble(0.0, 0, 0, 0,
N-1);
2605 lcl_ApplyUpperRightTriangle(pMatX, aVecR, pSlopes, pMatZ, K,
false);
2607 for (
SCSIZE colp1 = K; colp1 > 0; colp1--)
2609 lcl_ApplyHouseholderTransformation(pMatX, colp1-1, pMatZ,
N);
2611 fSSreg =lcl_GetSumProduct(pMatZ, pMatZ,
N);
2613 for (
SCSIZE row = 0; row <
N; row++)
2614 pMatY->PutDouble(pMatY->GetDouble(row) - pMatZ->GetDouble(row), row);
2615 fSSresid = lcl_GetSumProduct(pMatY, pMatY,
N);
2616 pResMat->PutDouble(fSSreg, 0, 4);
2617 pResMat->PutDouble(fSSresid, 1, 4);
2619 double fDegreesFreedom =
static_cast<double>( bConstant ?
N-K-1 :
N-K );
2620 pResMat->PutDouble(fDegreesFreedom, 1, 3);
2622 if (fDegreesFreedom == 0.0 || fSSresid == 0.0 || fSSreg == 0.0)
2624 pResMat->PutDouble(0.0, 1, 4);
2626 pResMat->PutError( FormulaError::NotAvailable, 0, 3);
2628 pResMat->PutDouble(0.0, 1, 2);
2631 pResMat->PutDouble(0.0, K-1-
i, 1);
2635 pResMat->PutDouble(0.0, K, 1);
2637 pResMat->PutError( FormulaError::NotAvailable, K, 1);
2640 pResMat->PutDouble(1.0, 0, 2);
2644 double fFstatistic = (fSSreg /
static_cast<double>(K))
2645 / (fSSresid / fDegreesFreedom);
2646 pResMat->PutDouble(fFstatistic, 0, 3);
2649 double fRMSE = sqrt(fSSresid / fDegreesFreedom);
2650 pResMat->PutDouble(fRMSE, 1, 2);
2663 pMatZ->FillDouble(0.0,0,0,0,K-1);
2664 pMatZ->PutDouble(1.0,
col);
2666 lcl_SolveWithLowerLeftTriangle(pMatX, aVecR, pMatZ, K,
false);
2668 lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pMatZ, K,
false);
2670 double fSigmaSlope = fRMSE * sqrt(pMatZ->GetDouble(
col));
2671 pResMat->PutDouble(fSigmaSlope, K-1-
col, 1);
2675 fPart = lcl_GetSumProduct(pMeans, pMatZ, K);
2676 aSigmaIntercept += fPart * pMeans->GetDouble(
col);
2681 double fSigmaIntercept = fRMSE
2682 * sqrt( (aSigmaIntercept + 1.0 /
static_cast<double>(
N) ).
get() );
2683 pResMat->PutDouble(fSigmaIntercept, K, 1);
2687 pResMat->PutError( FormulaError::NotAvailable, K, 1);
2690 double fR2 = fSSreg / (fSSreg + fSSresid);
2691 pResMat->PutDouble(fR2, 0, 2);
2698 ::std::vector< double> aVecR(
N);
2703 pMatZ = pMatY->Clone();
2707 if (!pMeans || !pMatZ || !pSlopes)
2714 lcl_CalculateRowMeans(pMatX, pMeans,
N, K);
2715 lcl_CalculateRowsDelta(pMatX, pMeans,
N, K);
2718 if (!lcl_TCalculateQRdecomposition(pMatX, aVecR, K,
N))
2726 bool bIsSingular=
false;
2727 for (
SCSIZE row=0; row < K && !bIsSingular; row++)
2728 bIsSingular = aVecR[row] == 0.0;
2735 for (
SCSIZE row = 0; row < K; row++)
2737 lcl_TApplyHouseholderTransformation(pMatX, row, pMatZ,
N);
2743 pSlopes->PutDouble( pMatZ->GetDouble(
col),
col);
2745 lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pSlopes, K,
true);
2746 double fIntercept = 0.0;
2748 fIntercept = fMeanY - lcl_GetSumProduct(pMeans,pSlopes,K);
2750 pResMat->PutDouble(_bRKP ? exp(fIntercept) : fIntercept, K, 0 );
2752 pResMat->PutDouble(_bRKP ? exp(pSlopes->GetDouble(
i))
2753 : pSlopes->GetDouble(
i) , K-1-
i, 0);
2757 double fSSreg = 0.0;
2758 double fSSresid = 0.0;
2760 pMatZ->FillDouble(0.0, 0, 0,
N-1, 0);
2762 lcl_ApplyUpperRightTriangle(pMatX, aVecR, pSlopes, pMatZ, K,
true);
2764 for (
SCSIZE rowp1 = K; rowp1 > 0; rowp1--)
2766 lcl_TApplyHouseholderTransformation(pMatX, rowp1-1, pMatZ,
N);
2768 fSSreg =lcl_GetSumProduct(pMatZ, pMatZ,
N);
2771 pMatY->PutDouble(pMatY->GetDouble(
col) - pMatZ->GetDouble(
col),
col);
2772 fSSresid = lcl_GetSumProduct(pMatY, pMatY,
N);
2773 pResMat->PutDouble(fSSreg, 0, 4);
2774 pResMat->PutDouble(fSSresid, 1, 4);
2776 double fDegreesFreedom =
static_cast<double>( bConstant ?
N-K-1 :
N-K );
2777 pResMat->PutDouble(fDegreesFreedom, 1, 3);
2779 if (fDegreesFreedom == 0.0 || fSSresid == 0.0 || fSSreg == 0.0)
2781 pResMat->PutDouble(0.0, 1, 4);
2783 pResMat->PutError( FormulaError::NotAvailable, 0, 3);
2785 pResMat->PutDouble(0.0, 1, 2);
2788 pResMat->PutDouble(0.0, K-1-
i, 1);
2792 pResMat->PutDouble(0.0, K, 1);
2794 pResMat->PutError( FormulaError::NotAvailable, K, 1);
2797 pResMat->PutDouble(1.0, 0, 2);
2801 double fFstatistic = (fSSreg /
static_cast<double>(K))
2802 / (fSSresid / fDegreesFreedom);
2803 pResMat->PutDouble(fFstatistic, 0, 3);
2806 double fRMSE = sqrt(fSSresid / fDegreesFreedom);
2807 pResMat->PutDouble(fRMSE, 1, 2);
2818 for (
SCSIZE row = 0; row < K; row++)
2821 pMatZ->FillDouble(0.0,0,0,K-1,0);
2822 pMatZ->PutDouble(1.0, row);
2824 lcl_SolveWithLowerLeftTriangle(pMatX, aVecR, pMatZ, K,
true);
2826 lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pMatZ, K,
true);
2828 double fSigmaSlope = fRMSE * sqrt(pMatZ->GetDouble(row));
2829 pResMat->PutDouble(fSigmaSlope, K-1-row, 1);
2832 fPart = lcl_GetSumProduct(pMeans, pMatZ, K);
2833 aSigmaIntercept += fPart * pMeans->GetDouble(row);
2838 double fSigmaIntercept = fRMSE
2839 * sqrt( (aSigmaIntercept + 1.0 /
static_cast<double>(
N) ).
get() );
2840 pResMat->PutDouble(fSigmaIntercept, K, 1);
2844 pResMat->PutError( FormulaError::NotAvailable, K, 1);
2847 double fR2 = fSSreg / (fSSreg + fSSresid);
2848 pResMat->PutDouble(fR2, 0, 2);
2874 if (nParamCount == 4)
2882 if (nParamCount >= 3)
2898 if (nParamCount >= 2)
2926 if (!
CheckMatrix(_bGrowth,nCase,nCX,nCY,nRX,nRY,K,
N,pMatX,pMatY))
2933 if ((bConstant && (
N<K+1)) || (!bConstant && (
N<K)) || (
N<1) || (K<1))
2946 nCountXN = nCXN * nRXN;
2947 pMatNewX = pMatX->Clone();
2951 pMatNewX->GetDimensions(nCXN, nRXN);
2952 if ((nCase == 2 && K != nCXN) || (nCase == 3 && K != nRXN))
2957 nCountXN = nCXN * nRXN;
2959 if (!pMatNewX->IsValue(
i))
2982 double fMeanY = 0.0;
2987 if (!pCopyX || !pCopyY)
2995 fMeanY = lcl_GetMeanOverAll(pMatY,
N);
2998 pMatY->PutDouble( ::rtl::math::approxSub(pMatY->GetDouble(
i),fMeanY),
i );
3005 double fMeanX = 0.0;
3008 fMeanX = lcl_GetMeanOverAll(pMatX,
N);
3011 pMatX->PutDouble( ::rtl::math::approxSub(pMatX->GetDouble(
i),fMeanX),
i );
3014 double fSumXY = lcl_GetSumProduct(pMatX,pMatY,
N);
3015 double fSumX2 = lcl_GetSumProduct(pMatX,pMatX,
N);
3021 double fSlope = fSumXY / fSumX2;
3025 double fIntercept = fMeanY - fSlope * fMeanX;
3028 fHelp = pMatNewX->GetDouble(
i)*fSlope + fIntercept;
3029 pResMat->PutDouble(_bGrowth ? exp(fHelp) : fHelp,
i);
3036 fHelp = pMatNewX->GetDouble(
i)*fSlope;
3037 pResMat->PutDouble(_bGrowth ? exp(fHelp) : fHelp,
i);
3045 ::std::vector< double> aVecR(
N);
3049 if (!pMeans || !pSlopes)
3056 lcl_CalculateColumnMeans(pMatX, pMeans, K,
N);
3057 lcl_CalculateColumnsDelta(pMatX, pMeans, K,
N);
3059 if (!lcl_CalculateQRdecomposition(pMatX, aVecR, K,
N))
3066 bool bIsSingular=
false;
3067 for (
SCSIZE row=0; row < K && !bIsSingular; row++)
3068 bIsSingular = aVecR[row] == 0.0;
3077 lcl_ApplyHouseholderTransformation(pMatX,
col, pMatY,
N);
3083 pSlopes->PutDouble( pMatY->GetDouble(
col),
col);
3085 lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pSlopes, K,
false);
3088 lcl_MFastMult(pMatNewX,pSlopes,pResMat,nRXN,K,1);
3091 double fIntercept = fMeanY - lcl_GetSumProduct(pMeans,pSlopes,K);
3092 for (
SCSIZE row = 0; row < nRXN; row++)
3093 pResMat->PutDouble(pResMat->GetDouble(row)+fIntercept, row);
3098 pResMat->PutDouble(exp(pResMat->GetDouble(
i)),
i);
3104 ::std::vector< double> aVecR(
N);
3108 if (!pMeans || !pSlopes)
3115 lcl_CalculateRowMeans(pMatX, pMeans,
N, K);
3116 lcl_CalculateRowsDelta(pMatX, pMeans,
N, K);
3118 if (!lcl_TCalculateQRdecomposition(pMatX, aVecR, K,
N))
3125 bool bIsSingular=
false;
3126 for (
SCSIZE row=0; row < K && !bIsSingular; row++)
3127 bIsSingular = aVecR[row] == 0.0;
3134 for (
SCSIZE row = 0; row < K; row++)
3136 lcl_TApplyHouseholderTransformation(pMatX, row, pMatY,
N);
3142 pSlopes->PutDouble( pMatY->GetDouble(
col),
col);
3144 lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pSlopes, K,
true);
3147 lcl_MFastMult(pSlopes,pMatNewX,pResMat,1,K,nCXN);
3150 double fIntercept = fMeanY - lcl_GetSumProduct(pMeans,pSlopes,K);
3152 pResMat->PutDouble(pResMat->GetDouble(
col)+fIntercept,
col);
3157 pResMat->PutDouble(exp(pResMat->GetDouble(
i)),
i);
3185 PushError( FormulaError::RetryCircular );
3215 if ((nCols <= nC && nCols != 1) || (nRows <= nR && nRows != 1))
3255 if (nErr != FormulaError::NONE)
3274 if(
aStr ==
"SYSTEM" )
3276 else if(
aStr ==
"OSVERSION" )
3277#if (defined LINUX || defined __FreeBSD__)
3286 else if(
aStr ==
"RELEASE" )
3288 else if(
aStr ==
"NUMFILE" )
3290 else if(
aStr ==
"RECALC" )
3292 else if (
aStr ==
"DIRECTORY" ||
aStr ==
"MEMAVAIL" ||
aStr ==
"MEMUSED" ||
aStr ==
"ORIGIN" ||
aStr ==
"TOTMEM")
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
static OUString GetOSVersion()
This class provides LO with Kahan summation algorithm About this algorithm: https://en....
double get() const
Returns the final sum.
Walk through all cells in an area.
const ScAddress & GetPos() const
const ScRefCellValue & getRefCellValue() const
static void transKeyword(OUString &rName, const css::lang::Locale *pLocale, OpCode eOpCode)
SC_DLLPUBLIC sal_uInt32 GetNumberFormat(SCCOL nCol, SCROW nRow, SCTAB nTab) const
bool ShrinkToDataArea(SCTAB nTab, SCCOL &rStartCol, SCROW &rStartRow, SCCOL &rEndCol, SCROW &rEndRow) const
Shrink a range to only include data area.
SC_DLLPUBLIC double RoundValueAsShown(double fVal, sal_uInt32 nFormat, const ScInterpreterContext *pContext=nullptr) const
SC_DLLPUBLIC bool GetAutoCalc() const
void GetNumberFormatInfo(const ScInterpreterContext &rContext, SvNumFormatType &nType, sal_uInt32 &nIndex, const ScAddress &rPos) const
SC_DLLPUBLIC svl::SharedStringPool & GetSharedStringPool()
void FillMatrix(ScMatrix &rMat, SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, svl::SharedStringPool *pPool=nullptr) const
::formula::FormulaTokenRef TokenRef
static css::lang::Locale & GetLocale()
void SetError(FormulaError nError)
svl::SharedString GetString()
bool CheckMatrix(bool _bLOG, sal_uInt8 &nCase, SCSIZE &nCX, SCSIZE &nCY, SCSIZE &nRX, SCSIZE &nRY, SCSIZE &M, SCSIZE &N, ScMatrixRef &pMatX, ScMatrixRef &pMatY)
bool MustHaveParamCount(short nAct, short nMust)
void PopExternalSingleRef(sal_uInt16 &rFileId, OUString &rTabName, ScSingleRefData &rRef)
bool MustHaveParamCountMin(short nAct, short nMin)
SubtotalFlags mnSubTotalFlags
void PushIllegalParameter()
FormulaError nGlobalError
void PushIllegalArgument()
void Push(const formula::FormulaToken &r)
Does substitute with formula::FormulaErrorToken in case nGlobalError is set and the token passed is n...
void CalculateMatrixValue(const ScMatrix *pMat, SCSIZE nC, SCSIZE nR)
void CalculateRGPRKP(bool _bRKP)
formula::StackVar GetRawStackType()
Raw stack type without default replacements.
const formula::FormulaToken * pCur
ScInterpreterContext & mrContext
SvNumFormatType nFuncFmtType
sal_uInt32 GetUInt32()
if GetDouble() not within uint32 limits sets nGlobalError and returns SAL_MAX_UINT32
void GetCellString(svl::SharedString &rStr, ScRefCellValue &rCell)
void PushError(FormulaError nError)
sal_uInt8 GetByte() const
bool CheckStringResultLen(OUString &rResult, sal_Int32 nIncrease)
ScMatrixRef GetNewMat(SCSIZE nC, SCSIZE nR, bool bEmpty=false)
static void MEMat(const ScMatrixRef &mM, SCSIZE n)
void PushDouble(double nVal)
sc::RangeMatrix PopRangeMatrix()
const formula::FormulaToken ** pStack
void PopSingleRef(ScAddress &)
ScTokenMatrixMap maTokenMatrixMap
SvNumberFormatter * pFormatter
static double div(const double &fNumerator, const double &fDenominator)
Fail safe division, returning a FormulaError::DivisionByZero coded into a double if denominator is 0....
void MakeMatNew(ScMatrixRef &rMat, SCSIZE nC, SCSIZE nR)
void CalculateTrendGrowth(bool _bGrowth)
void CalculateAddSub(bool _bSub)
void PopDoubleRef(ScRange &rRange, short &rParam, size_t &rRefInList)
If formula::StackVar formula::svDoubleRef pop ScDoubleRefToken and return values of ScComplexRefData.
void PushMatrix(const sc::RangeMatrix &rMat)
void PopExternalDoubleRef(sal_uInt16 &rFileId, OUString &rTabName, ScComplexRefData &rRef)
double GetCellValue(const ScAddress &, ScRefCellValue &rCell)
void PushTempToken(formula::FormulaToken *)
Does substitute with formula::FormulaErrorToken in case nGlobalError is set and the token passed is n...
sc::RangeMatrix GetRangeMatrix()
void GetSortArray(sal_uInt8 nParamCount, ::std::vector< double > &rSortArray, ::std::vector< tools::Long > *pIndexOrder, bool bConvertTextInArray, bool bAllowEmptyArray)
ScMatrixRef MatConcat(const ScMatrixRef &pMat1, const ScMatrixRef &pMat2)
formula::StackVar GetStackType()
Stack type with replacement of defaults, e.g. svMissing and formula::svEmptyCell will result in formu...
svl::SharedStringPool & mrStrPool
static double ScGetGCD(double fx, double fy)
SvNumFormatType nCurFmtType
void CalculateSumX2MY2SumX2DY2(bool _bSumX2DY2)
void PushString(const OUString &rStr)
ScMatrixRef CreateMatrixFromDoubleRef(const formula::FormulaToken *pToken, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2)
Matrix data type that can store values of mixed types.
ScMatrixValue Get(SCSIZE nC, SCSIZE nR) const
@ATTENTION: If bString the ScMatrixValue->pS may still be NULL to indicate an empty string!
static bool IsEmptyPathType(ScMatValType nType)
Empty path, but not empty or any other type.
std::function< double(double, double)> CalculateOpFunction
static bool IsEmptyType(ScMatValType nType)
Empty, but not empty path or any other type.
double GetDouble(SCSIZE nC, SCSIZE nR) const
static bool IsSizeAllocatable(SCSIZE nC, SCSIZE nR)
Checks nC or nR for zero and uses GetElementsMax() whether a matrix of the size of nC*nR could be all...
static bool IsNonValueType(ScMatValType nType)
String, empty or empty path, but not value nor boolean.
void PutDouble(double fVal, SCSIZE nC, SCSIZE nR)
void GetDimensions(SCSIZE &rC, SCSIZE &rR) const
void GetVars(SCCOL &nCol1, SCROW &nRow1, SCTAB &nTab1, SCCOL &nCol2, SCROW &nRow2, SCTAB &nTab2) const
bool GetFirst(double &rValue, FormulaError &rErr)
Does NOT reset rValue if no value found!
bool GetNext(double &rValue, FormulaError &rErr)
Does NOT reset rValue if no value found!
SharedString intern(const OUString &rStr)
const OUString & getString() const
static OUString getBuildIdData(OUString const &_sDefault)
double CreateDoubleError(FormulaError nErr)
FormulaError GetDoubleErrorValue(double fVal)
static void lcl_GetDiffDateTimeFmtType(SvNumFormatType &nFuncFmt, SvNumFormatType nFmt1, SvNumFormatType nFmt2)
static SCSIZE lcl_GetMinExtent(SCSIZE n1, SCSIZE n2)
Minimum extent of one result matrix dimension.
static int lcl_LUP_decompose(ScMatrix *mA, const SCSIZE n, ::std::vector< SCSIZE > &P)
static void lcl_LUP_solve(const ScMatrix *mLU, const SCSIZE n, const ::std::vector< SCSIZE > &P, const ::std::vector< double > &B, ::std::vector< double > &X)
static ScMatrixRef lcl_MatrixCalculation(const ScMatrix &rMat1, const ScMatrix &rMat2, ScInterpreter *pInterpreter, ScMatrix::CalculateOpFunction Op)
RttiCompleteObjectLocator col
Op_< std::function< void(double &, double)>, double > Op
double power(const double &fVal1, const double &fVal2)
Return pow(fVal1,fVal2) with error handling.
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
OUString ScResId(TranslateId aId)
static bool isOpenCLEnabled()
Complex reference (a range) into the sheet.
bool IsTrimToData() const
Try NOT to use this struct.
const svl::SharedString & GetString() const
Only valid if ScMatrix methods indicate so!
This is very similar to ScCellValue, except that it references the original value instead of copying ...
ScFormulaCell * getFormula() const
OUString getString(const ScDocument *pDoc) const
Retrieve string value.
ScFormulaCell * mpFormula
::boost::intrusive_ptr< ScMatrix > ScMatrixRef