20#include <rtl/math.hxx>
24#ifdef DEBUG_SC_LUP_DECOMPOSITION
34#include <document.hxx>
50double MatrixAdd(
const double& lhs,
const double& rhs)
52 return ::rtl::math::approxAdd( lhs,rhs);
55double MatrixSub(
const double& lhs,
const double& rhs)
57 return ::rtl::math::approxSub( lhs,rhs);
60double MatrixMul(
const double& lhs,
const double& rhs)
65double MatrixDiv(
const double& lhs,
const double& rhs)
70double MatrixPow(
const double& lhs,
const double& rhs)
72 return ::pow( lhs,rhs);
79 for (
SCSIZE row = 0; row <
n; row++)
85 fSum += pA->GetDouble(k,row) * pB->GetDouble(col,k);
86 pR->PutDouble(fSum.
get(), col, row);
103 double fz = fmod(fx, fy);
122 size_t nRefInList = 0;
123 while (
nGlobalError == FormulaError::NONE && nParamCount-- > 0)
131 fx = ::rtl::math::approxFloor(
GetDouble());
147 if (aValIter.
GetFirst(nCellVal, nErr))
151 fx = ::rtl::math::approxFloor( nCellVal);
158 }
while (nErr == FormulaError::NONE && aValIter.
GetNext(nCellVal, nErr));
171 pMat->GetDimensions(nC, nR);
172 if (nC == 0 || nR == 0)
173 SetError(FormulaError::IllegalArgument);
176 double nVal = pMat->GetGcd();
182 default :
SetError(FormulaError::IllegalParameter);
break;
196 size_t nRefInList = 0;
197 while (
nGlobalError == FormulaError::NONE && nParamCount-- > 0)
205 fx = ::rtl::math::approxFloor(
GetDouble());
211 if (fx == 0.0 || fy == 0.0)
224 if (aValIter.
GetFirst(nCellVal, nErr))
228 fx = ::rtl::math::approxFloor( nCellVal);
234 if (fx == 0.0 || fy == 0.0)
238 }
while (nErr == FormulaError::NONE && aValIter.
GetNext(nCellVal, nErr));
251 pMat->GetDimensions(nC, nR);
252 if (nC == 0 || nR == 0)
253 SetError(FormulaError::IllegalArgument);
256 double nVal = pMat->GetLcm();
257 fy = (nVal * fy ) /
ScGetGCD(nVal, fy);
262 default :
SetError(FormulaError::IllegalParameter);
break;
270 rMat->SetErrorInterpreter(
this);
275 rMat->GetDimensions( nCols, nRows);
276 if ( nCols != nC || nRows != nR )
278 SetError( FormulaError::MatrixSize);
305 if (nTab1 != nTab2 ||
nGlobalError != FormulaError::NONE)
308 SetError(FormulaError::IllegalParameter);
312 if (nTab1 == nTab2 && pToken)
323 SCCOL nTempCol = nCol1;
324 SCROW nTempRow = nRow1;
329 SCSIZE nMatCols =
static_cast<SCSIZE>(nCol2 - nCol1 + 1);
330 SCSIZE nMatRows =
static_cast<SCSIZE>(nRow2 - nRow1 + 1);
338 ScTokenMatrixMap::const_iterator aIter;
370 SCROW nNextRow = nRow1;
371 SCCOL nNextCol = nCol1;
373 SCROW nThisRow = nRow2;
374 SCCOL nThisCol = nCol1 - 1;
377 for (
bool bHas = aCellIter.
first(); bHas; bHas = aCellIter.
next())
381 if (nThisCol != nNextCol || nThisRow != nNextRow)
384 for ( ; nNextCol <= nThisCol; ++nNextCol)
386 const SCSIZE nC = nNextCol - nCol1;
387 const SCSIZE nMatStopRow = ((nNextCol < nThisCol) ? nMatRows : nThisRow - nRow1);
388 for (
SCSIZE nR = nNextRow - nRow1; nR < nMatStopRow; ++nR)
390 pMat->PutEmpty( nC, nR);
395 if (nThisRow == nRow2)
397 nNextCol = nThisCol + 1;
403 nNextRow = nThisRow + 1;
406 const SCSIZE nMatCol =
static_cast<SCSIZE>(nThisCol - nCol1);
407 const SCSIZE nMatRow =
static_cast<SCSIZE>(nThisRow - nRow1);
411 pMat->PutEmpty( nMatCol, nMatRow);
425 const ScAddress aAdr( nThisCol, nThisRow, nTab1);
429 pMat->PutDouble( fVal, nMatCol, nMatRow);
437 assert(!
"aCell.what?");
438 pMat->PutEmpty( nMatCol, nMatRow);
443 if (nThisCol != nCol2 || nThisRow != nRow2)
445 for ( ; nNextCol <= nCol2; ++nNextCol)
447 SCSIZE nC = nNextCol - nCol1;
448 for (
SCSIZE nR = nNextRow - nRow1; nR < nMatRows; ++nR)
450 pMat->PutEmpty( nC, nR);
477 pMat->PutEmpty(0, 0);
484 pMat->PutString(
aStr, 0);
497 nCol2, nRow2, nTab2);
516 pMat->PutDouble( fVal, 0);
529 pMat->PutDouble( fVal, 0);
533 pMat->PutString(
aStr, 0);
550 switch (pToken->GetType())
553 pMat->PutError( pToken->GetError(), 0, 0);
556 pMat->PutDouble( pToken->GetDouble(), 0, 0);
559 pMat->PutString( pToken->GetString(), 0, 0);
571 SetError( FormulaError::IllegalArgument);
591 aRange.
GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
639 if (nErrCode != FormulaError::NONE)
660 if (nCol2 - nCol1 >=
static_cast<SCCOL>(nR) &&
661 nRow2 - nRow1 >=
static_cast<SCROW>(nC) &&
664 ScAddress aAdr( sal::static_int_cast<SCCOL>( nCol1 + nR ),
665 sal::static_int_cast<SCROW>( nRow1 + nC ), nTab1 );
698 if (nC < nCl && nR < nRw)
740 mM->FillDouble(0.0, 0, 0,
n-1,
n-1);
742 mM->PutDouble(1.0,
i,
i);
765 ::std::vector< SCSIZE> & P )
769 ::std::vector< double> aScale(
n);
781 aScale[
i] = 1.0 / fMax;
788 for (
SCSIZE k=0; k < l; ++k)
793 double fScale = aScale[k];
797 double fTmp = fScale * fabs( mA->
GetDouble( k,
i));
815 double fTmp = aScale[k];
816 aScale[k] = aScale[kp];
832 for (
SCSIZE j = k+1; j <
n; ++j)
837#ifdef DEBUG_SC_LUP_DECOMPOSITION
838 fprintf( stderr,
"\n%s\n",
"lcl_LUP_decompose(): LU");
842 fprintf( stderr,
"%8.2g ", mA->
GetDouble( j,
i));
843 fprintf( stderr,
"\n%s\n",
"");
845 fprintf( stderr,
"\n%s\n",
"lcl_LUP_decompose(): P");
847 fprintf( stderr,
"%5u ", (
unsigned)P[j]);
848 fprintf( stderr,
"\n%s\n",
"");
851 bool bSingular=
false;
866 const ::std::vector< SCSIZE> & P, const ::std::vector< double> & B,
867 ::std::vector< double> & X )
881 for (
SCSIZE j = nFirst; j <
i; ++j)
896#ifdef DEBUG_SC_LUP_DECOMPOSITION
897 fprintf( stderr,
"\n%s\n",
"lcl_LUP_solve():");
899 fprintf( stderr,
"%8.2g ",
X[
i]);
900 fprintf( stderr,
"%s\n",
"");
915 if ( !pMat->IsNumeric() )
921 pMat->GetDimensions(nC, nR);
922 if ( nC != nR || nC == 0 )
934 ::std::vector< SCSIZE> P(nR);
942 double fDet = nDetSign;
944 fDet *= xLU->GetDouble(
i,
i);
962 if ( !pMat->IsNumeric() )
968 pMat->GetDimensions(nC, nR);
973 if (pInterpreter !=
nullptr)
984 if ( nC != nR || nC == 0 )
998 ::std::vector< SCSIZE> P(nR);
1005 ::std::vector< double>
B(nR);
1006 ::std::vector< double>
X(nR);
1007 for (
SCSIZE j=0; j < nR; ++j)
1014 xY->PutDouble(
X[
i], j,
i);
1016#ifdef DEBUG_SC_LUP_DECOMPOSITION
1034 const double fInvEpsilon = 1.0E-7;
1039 lcl_MFastMult( pMat, xY.get(), pR, nR, nR, nR);
1040 fprintf( stderr,
"\n%s\n",
"ScMatInv(): mult-identity");
1043 for (
SCSIZE j=0; j < nR; ++j)
1046 fprintf( stderr,
"%8.2g ", fTmp);
1047 if (fabs( fTmp - (
i == j)) > fInvEpsilon)
1048 SetError( FormulaError::IllegalArgument);
1050 fprintf( stderr,
"\n%s\n",
"");
1073 if ( pMat1->IsNumeric() && pMat2->IsNumeric() )
1077 pMat1->GetDimensions(nC1, nR1);
1078 pMat2->GetDimensions(nC2, nR2);
1089 for (
SCSIZE j = 0; j < nC2; j++)
1092 for (
SCSIZE k = 0; k < nC1; k++)
1094 fSum += pMat1->GetDouble(k,
i)*pMat2->GetDouble(j,k);
1096 pRMat->PutDouble(fSum.
get(), j,
i);
1122 pMat->GetDimensions(nC, nR);
1126 pMat->MatTrans(*pRMat);
1163 xResMat->ExecuteBinaryOp(nMinC, nMinR, rMat1, rMat2, pInterpreter,
Op);
1171 pMat1->GetDimensions(nC1, nR1);
1172 pMat2->GetDimensions(nC2, nR2);
1186 if ( nFmt1 == SvNumFormatType::UNDEFINED && nFmt2 == SvNumFormatType::UNDEFINED )
1189 if ( nFmt1 == nFmt2 )
1191 if ( nFmt1 == SvNumFormatType::TIME || nFmt1 == SvNumFormatType::DATETIME
1192 || nFmt1 == SvNumFormatType::DURATION )
1193 nFuncFmt = SvNumFormatType::DURATION;
1196 else if ( nFmt1 == SvNumFormatType::UNDEFINED )
1198 else if ( nFmt2 == SvNumFormatType::UNDEFINED )
1202 if ( nFmt1 == SvNumFormatType::DATE || nFmt2 == SvNumFormatType::DATE ||
1203 nFmt1 == SvNumFormatType::DATETIME || nFmt2 == SvNumFormatType::DATETIME )
1205 if ( nFmt1 == SvNumFormatType::TIME || nFmt2 == SvNumFormatType::TIME )
1206 nFuncFmt = SvNumFormatType::DATETIME;
1220 double fVal1 = 0.0, fVal2 = 0.0;
1222 nFmt1 = nFmt2 = SvNumFormatType::UNDEFINED;
1233 case SvNumFormatType::DATE :
1234 case SvNumFormatType::TIME :
1235 case SvNumFormatType::DATETIME :
1236 case SvNumFormatType::DURATION :
1239 case SvNumFormatType::CURRENCY :
1243 case SvNumFormatType::PERCENT :
1244 nFmtPercentType = SvNumFormatType::PERCENT;
1256 case SvNumFormatType::DATE :
1257 case SvNumFormatType::TIME :
1258 case SvNumFormatType::DATETIME :
1259 case SvNumFormatType::DURATION :
1262 case SvNumFormatType::CURRENCY :
1266 case SvNumFormatType::PERCENT :
1267 nFmtPercentType = SvNumFormatType::PERCENT;
1289 else if (pMat1 || pMat2)
1306 pMat->GetDimensions(nC, nR);
1312 pMat->SubOp( bFlag, fVal, *pResMat);
1316 pMat->AddOp( fVal, *pResMat);
1326 if ( nFmtCurrencyType == SvNumFormatType::CURRENCY )
1334 if (nFmtPercentType == SvNumFormatType::PERCENT &&
nFuncFmtType == SvNumFormatType::NUMBER)
1338 PushDouble( ::rtl::math::approxSub( fVal1, fVal2 ) );
1340 PushDouble( ::rtl::math::approxAdd( fVal1, fVal2 ) );
1348 OUString sStr1, sStr2;
1365 else if (pMat1 || pMat2)
1382 pMat->GetDimensions(nC, nR);
1389 for (
SCSIZE j = 0; j < nR; ++j)
1395 for (
SCSIZE j = 0; j < nR; ++j)
1398 if (nErr != FormulaError::NONE)
1399 pResMat->PutError( nErr,
i, j);
1402 OUString aTmp = sStr + pMat->GetString(*
pFormatter,
i, j).getString();
1410 for (
SCSIZE j = 0; j < nR; ++j)
1413 if (nErr != FormulaError::NONE)
1414 pResMat->PutError( nErr,
i, j);
1417 OUString aTmp = pMat->GetString(*
pFormatter,
i, j).getString() + sStr;
1444 double fVal1 = 0.0, fVal2 = 0.0;
1454 case SvNumFormatType::CURRENCY :
1468 case SvNumFormatType::CURRENCY :
1483 else if (pMat1 || pMat2)
1495 pMat->GetDimensions(nC, nR);
1499 pMat->MulOp( fVal, *pResMat);
1508 if ( nFmtCurrencyType == SvNumFormatType::CURRENCY )
1521 double fVal1 = 0.0, fVal2 = 0.0;
1540 case SvNumFormatType::CURRENCY :
1555 else if (pMat1 || pMat2)
1572 pMat->GetDimensions(nC, nR);
1576 pMat->DivOp( bFlag, fVal, *pResMat);
1585 if ( nFmtCurrencyType == SvNumFormatType::CURRENCY &&
1586 nFmtCurrencyType2 != SvNumFormatType::CURRENCY)
1605 double fVal1 = 0.0, fVal2 = 0.0;
1622 else if (pMat1 || pMat2)
1639 pMat->GetDimensions(nC, nR);
1643 pMat->PowOp( bFlag, fVal, *pResMat);
1657 short nParamCount =
GetByte();
1665 size_t nInRefList = 0;
1669 pMatLast =
GetMatrix( --nParamCount, nInRefList);
1676 SCSIZE nC, nCLast, nR, nRLast;
1677 pMatLast->GetDimensions(nCLast, nRLast);
1678 std::vector<double> aResArray;
1679 pMatLast->GetDoubleArray(aResArray);
1681 while (nParamCount--)
1683 pMat =
GetMatrix( nParamCount, nInRefList);
1689 pMat->GetDimensions(nC, nR);
1690 if (nC != nCLast || nR != nRLast)
1696 pMat->MergeDoubleArrayMultiply(aResArray);
1700 for(
double fPosArray : aResArray )
1703 if (nErr == FormulaError::NONE)
1705 else if (nErr != FormulaError::ElementNaN)
1730 if (!pMat2 || !pMat1)
1737 pMat2->GetDimensions(nC2, nR2);
1738 pMat1->GetDimensions(nC1, nR1);
1739 if (nC1 != nC2 || nR1 != nR2)
1746 for (
i = 0;
i < nC1;
i++)
1747 for (j = 0; j < nR1; j++)
1748 if (!pMat1->IsStringOrEmpty(
i,j) && !pMat2->IsStringOrEmpty(
i,j))
1750 fVal = pMat1->GetDouble(
i,j);
1751 fSum += fVal * fVal;
1752 fVal = pMat2->GetDouble(
i,j);
1754 fSum += fVal * fVal;
1756 fSum -= fVal * fVal;
1773 if (!pMat2 || !pMat1)
1780 pMat2->GetDimensions(nC2, nR2);
1781 pMat1->GetDimensions(nC1, nR1);
1782 if (nC1 != nC2 || nR1 != nR2)
1794 PushDouble(pResMat->SumSquare(
false).maAccumulator.get());
1803 vector<double> aBinArray;
1804 vector<tools::Long> aBinIndexOrder;
1806 GetSortArray( 1, aBinArray, &aBinIndexOrder,
false,
false );
1807 SCSIZE nBinSize = aBinArray.size();
1814 vector<double> aDataArray;
1816 SCSIZE nDataSize = aDataArray.size();
1818 if (aDataArray.empty() ||
nGlobalError != FormulaError::NONE)
1830 if (nBinSize != aBinIndexOrder.size())
1838 for (j = 0; j < nBinSize; ++j)
1841 while (
i < nDataSize && aDataArray[
i] <= aBinArray[j])
1846 pResMat->PutDouble(
static_cast<double>(
nCount), aBinIndexOrder[j]);
1848 pResMat->PutDouble(
static_cast<double>(nDataSize-
i), j);
1865 fSum += pMatA->GetDouble(i) * pMatB->GetDouble(i);
1875 for (
SCSIZE row=nR; row<nN; row++)
1876 fNorm += (pMatA->GetDouble(nC,row)) * (pMatA->GetDouble(nC,row));
1877 return sqrt(fNorm.
get());
1886 fNorm += (pMatA->GetDouble(col,nR)) * (pMatA->GetDouble(col,nR));
1887 return sqrt(fNorm.
get());
1896 for (
SCSIZE row=nR; row<nN; row++)
1898 double fVal = fabs(pMatA->GetDouble(nC,row));
1912 double fVal = fabs(pMatA->GetDouble(col,nR));
1926 for (
SCSIZE row=nR; row<nN; row++)
1927 fResult += pMatA->GetDouble(nCa,row) * pMatB->GetDouble(nCb,row);
1928 return fResult.
get();
1938 fResult += pMatA->GetDouble(col,nRa) * pMatB->GetDouble(col,nRb);
1939 return fResult.
get();
1943double lcl_GetSign(
double fValue)
1945 return (fValue >= 0.0 ? 1.0 : -1.0 );
1961bool lcl_CalculateQRdecomposition(
const ScMatrixRef& pMatA,
1968 const double fScale = lcl_GetColumnMaximumNorm(pMatA, col, col, nN);
1974 for (
SCSIZE row = col; row <nN; row++)
1975 pMatA->PutDouble( pMatA->GetDouble(col,row)/fScale, col, row);
1977 const double fEuclid = lcl_GetColumnEuclideanNorm(pMatA, col, col, nN);
1978 const double fFactor = 1.0/fEuclid/(fEuclid + fabs(pMatA->GetDouble(col,col)));
1979 const double fSignum = lcl_GetSign(pMatA->GetDouble(col,col));
1980 pMatA->PutDouble( pMatA->GetDouble(col,col) + fSignum*fEuclid, col,col);
1981 pVecR[
col] = -fSignum * fScale * fEuclid;
1984 for (
SCSIZE c=col+1; c<nK; c++)
1986 const double fSum =lcl_GetColumnSumProduct(pMatA, col, pMatA, c, col, nN);
1987 for (
SCSIZE row = col; row <nN; row++)
1988 pMatA->PutDouble( pMatA->GetDouble(c,row) - fSum * fFactor * pMatA->GetDouble(col,row), c, row);
1995bool lcl_TCalculateQRdecomposition(
const ScMatrixRef& pMatA,
2000 for (
SCSIZE row = 0; row <nK; row++)
2003 const double fScale = lcl_TGetColumnMaximumNorm(pMatA, row, row, nN);
2010 pMatA->PutDouble( pMatA->GetDouble(col,row)/fScale, col, row);
2012 const double fEuclid = lcl_TGetColumnEuclideanNorm(pMatA, row, row, nN);
2013 const double fFactor = 1.0/fEuclid/(fEuclid + fabs(pMatA->GetDouble(row,row)));
2014 const double fSignum = lcl_GetSign(pMatA->GetDouble(row,row));
2015 pMatA->PutDouble( pMatA->GetDouble(row,row) + fSignum*fEuclid, row,row);
2016 pVecR[row] = -fSignum * fScale * fEuclid;
2019 for (
SCSIZE r=row+1; r<nK; r++)
2021 fSum =lcl_TGetColumnSumProduct(pMatA, row, pMatA, r, row, nN);
2024 pMatA->GetDouble(col,r) - fSum * fFactor * pMatA->GetDouble(col,row), col, r);
2040 double fDenominator = lcl_GetColumnSumProduct(pMatA, nC, pMatA, nC, nC, nN);
2041 double fNumerator = lcl_GetColumnSumProduct(pMatA, nC, pMatY, 0, nC, nN);
2042 double fFactor = 2.0 * (fNumerator/fDenominator);
2043 for (
SCSIZE row = nC; row < nN; row++)
2045 pMatY->GetDouble(row) - fFactor * pMatA->GetDouble(nC,row), row);
2053 double fDenominator = lcl_TGetColumnSumProduct(pMatA, nR, pMatA, nR, nR, nN);
2054 double fNumerator = lcl_TGetColumnSumProduct(pMatA, nR, pMatY, 0, nR, nN);
2055 double fFactor = 2.0 * (fNumerator/fDenominator);
2058 pMatY->GetDouble(col) - fFactor * pMatA->GetDouble(col,nR),
col);
2067void lcl_SolveWithUpperRightTriangle(
const ScMatrixRef& pMatA,
2068 ::std::vector< double>& pVecR,
const ScMatrixRef& pMatS,
2069 SCSIZE nK,
bool bIsTransposed)
2074 for (
SCSIZE rowp1 = nK; rowp1>0; rowp1--)
2077 KahanSum fSum = pMatS->GetDouble(row);
2080 fSum -= pMatA->GetDouble(row,col) * pMatS->GetDouble(col);
2082 fSum -= pMatA->GetDouble(col,row) * pMatS->GetDouble(col);
2083 pMatS->PutDouble( fSum.
get() / pVecR[row] , row);
2093void lcl_SolveWithLowerLeftTriangle(
const ScMatrixRef& pMatA,
2094 ::std::vector< double>& pVecR,
const ScMatrixRef& pMatT,
2095 SCSIZE nK,
bool bIsTransposed)
2098 for (
SCSIZE row = 0; row < nK; row++)
2100 KahanSum fSum = pMatT -> GetDouble(row);
2104 fSum -= pMatA->GetDouble(col,row) * pMatT->GetDouble(col);
2106 fSum -= pMatA->GetDouble(row,col) * pMatT->GetDouble(col);
2108 pMatT->PutDouble( fSum.
get() / pVecR[row] , row);
2118void lcl_ApplyUpperRightTriangle(
const ScMatrixRef& pMatA,
2119 ::std::vector< double>& pVecR,
const ScMatrixRef& pMatB,
2123 for (
SCSIZE row = 0; row < nK; row++)
2125 KahanSum fSum = pVecR[row] * pMatB->GetDouble(row);
2128 fSum += pMatA->GetDouble(row,col) * pMatB->GetDouble(col);
2130 fSum += pMatA->GetDouble(col,row) * pMatB->GetDouble(col);
2131 pMatZ->PutDouble( fSum.
get(), row);
2139 fSum += pMat->GetDouble(i);
2140 return fSum.
get()/
static_cast<double>(nN);
2151 for (
SCSIZE k=0; k < nR; k++)
2152 fSum += pX->GetDouble(i,k);
2153 pResMat ->PutDouble( fSum.
get()/
static_cast<double>(nR),i);
2162 for (
SCSIZE k=0; k < nR; k++)
2166 fSum += pX->GetDouble(i,k);
2167 pResMat ->PutDouble( fSum.
get()/
static_cast<double>(nC),k);
2175 for (
SCSIZE k = 0; k < nR; k++)
2176 pMat->PutDouble( ::rtl::math::approxSub
2177 (pMat->GetDouble(i,k) , pColumnMeans->GetDouble(i) ) , i, k);
2183 for (
SCSIZE k = 0; k < nR; k++)
2185 pMat->PutDouble( ::rtl::math::approxSub
2186 ( pMat->GetDouble(i,k) , pRowMeans->GetDouble(k) ) , i, k);
2198 const double fTemp = pMatY->GetDouble(i) - fSlope * pMatX->GetDouble(i);
2199 fSum += fTemp * fTemp;
2220 pMatY->GetDimensions(nCY, nRY);
2221 const SCSIZE nCountY = nCY * nRY;
2224 if (!pMatY->IsValue(
i))
2234 for (
SCSIZE nElem = 0; nElem < nCountY; nElem++)
2236 const double fVal = pNewY->GetDouble(nElem);
2243 pNewY->PutDouble(
log(fVal), nElem);
2250 pMatX->GetDimensions(nCX, nRX);
2251 const SCSIZE nCountX = nCX * nRX;
2253 if (!pMatX->IsValue(
i))
2258 if (nCX == nCY && nRX == nRY)
2264 else if (nCY != 1 && nRY != 1)
2283 else if (nCX != nCY)
2306 pMatX->PutDouble(
static_cast<double>(
i),
i-1);
2331 bool bConstant, bStats;
2334 if (nParamCount == 4)
2341 if (nParamCount >= 3)
2357 if (nParamCount >= 2)
2385 if (!
CheckMatrix(_bRKP,nCase,nCX,nCY,nRX,nRY,K,
N,pMatX,pMatY))
2392 if ((bConstant && (
N<K+1)) || (!bConstant && (
N<K)) || (
N<1) || (K<1))
2413 pResMat->PutError( FormulaError::NotAvailable,
i, 2);
2414 pResMat->PutError( FormulaError::NotAvailable,
i, 3);
2415 pResMat->PutError( FormulaError::NotAvailable,
i, 4);
2421 double fMeanY = 0.0;
2426 if (!pNewX || !pNewY)
2434 fMeanY = lcl_GetMeanOverAll(pMatY,
N);
2437 pMatY->PutDouble( ::rtl::math::approxSub(pMatY->GetDouble(
i),fMeanY),
i );
2444 double fMeanX = 0.0;
2447 fMeanX = lcl_GetMeanOverAll(pMatX,
N);
2450 pMatX->PutDouble( ::rtl::math::approxSub(pMatX->GetDouble(
i),fMeanX),
i );
2453 double fSumXY = lcl_GetSumProduct(pMatX,pMatY,
N);
2454 double fSumX2 = lcl_GetSumProduct(pMatX,pMatX,
N);
2460 double fSlope = fSumXY / fSumX2;
2461 double fIntercept = 0.0;
2463 fIntercept = fMeanY - fSlope * fMeanX;
2464 pResMat->PutDouble(_bRKP ? exp(fIntercept) : fIntercept, 1, 0);
2465 pResMat->PutDouble(_bRKP ? exp(fSlope) : fSlope, 0, 0);
2469 double fSSreg = fSlope * fSlope * fSumX2;
2470 pResMat->PutDouble(fSSreg, 0, 4);
2472 double fDegreesFreedom =
static_cast<double>( bConstant ?
N-2 :
N-1 );
2473 pResMat->PutDouble(fDegreesFreedom, 1, 3);
2475 double fSSresid = lcl_GetSSresid(pMatX,pMatY,fSlope,
N);
2476 pResMat->PutDouble(fSSresid, 1, 4);
2478 if (fDegreesFreedom == 0.0 || fSSresid == 0.0 || fSSreg == 0.0)
2481 pResMat->PutDouble(0.0, 1, 4);
2482 pResMat->PutError( FormulaError::NotAvailable, 0, 3);
2483 pResMat->PutDouble(0.0, 1, 2);
2484 pResMat->PutDouble(0.0, 0, 1);
2486 pResMat->PutDouble(0.0, 1, 1);
2488 pResMat->PutError( FormulaError::NotAvailable, 1, 1);
2489 pResMat->PutDouble(1.0, 0, 2);
2493 double fFstatistic = (fSSreg /
static_cast<double>(K))
2494 / (fSSresid / fDegreesFreedom);
2495 pResMat->PutDouble(fFstatistic, 0, 3);
2498 double fRMSE = sqrt(fSSresid / fDegreesFreedom);
2499 pResMat->PutDouble(fRMSE, 1, 2);
2501 double fSigmaSlope = fRMSE / sqrt(fSumX2);
2502 pResMat->PutDouble(fSigmaSlope, 0, 1);
2506 double fSigmaIntercept = fRMSE
2507 * sqrt(fMeanX*fMeanX/fSumX2 + 1.0/
static_cast<double>(
N));
2508 pResMat->PutDouble(fSigmaIntercept, 1, 1);
2512 pResMat->PutError( FormulaError::NotAvailable, 1, 1);
2515 double fR2 = fSSreg / (fSSreg + fSSresid);
2516 pResMat->PutDouble(fR2, 0, 2);
2527 ::std::vector< double> aVecR(
N);
2532 pMatZ = pMatY->Clone();
2536 if (!pMeans || !pMatZ || !pSlopes)
2543 lcl_CalculateColumnMeans(pMatX, pMeans, K,
N);
2544 lcl_CalculateColumnsDelta(pMatX, pMeans, K,
N);
2546 if (!lcl_CalculateQRdecomposition(pMatX, aVecR, K,
N))
2553 bool bIsSingular=
false;
2554 for (
SCSIZE row=0; row < K && !bIsSingular; row++)
2555 bIsSingular = aVecR[row] == 0.0;
2564 lcl_ApplyHouseholderTransformation(pMatX,
col, pMatZ,
N);
2570 pSlopes->PutDouble( pMatZ->GetDouble(
col),
col);
2572 lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pSlopes, K,
false);
2573 double fIntercept = 0.0;
2575 fIntercept = fMeanY - lcl_GetSumProduct(pMeans,pSlopes,K);
2577 pResMat->PutDouble(_bRKP ? exp(fIntercept) : fIntercept, K, 0 );
2579 pResMat->PutDouble(_bRKP ? exp(pSlopes->GetDouble(
i))
2580 : pSlopes->GetDouble(
i) , K-1-
i, 0);
2584 double fSSreg = 0.0;
2585 double fSSresid = 0.0;
2587 pMatZ->FillDouble(0.0, 0, 0, 0,
N-1);
2589 lcl_ApplyUpperRightTriangle(pMatX, aVecR, pSlopes, pMatZ, K,
false);
2591 for (
SCSIZE colp1 = K; colp1 > 0; colp1--)
2593 lcl_ApplyHouseholderTransformation(pMatX, colp1-1, pMatZ,
N);
2595 fSSreg =lcl_GetSumProduct(pMatZ, pMatZ,
N);
2597 for (
SCSIZE row = 0; row <
N; row++)
2598 pMatY->PutDouble(pMatY->GetDouble(row) - pMatZ->GetDouble(row), row);
2599 fSSresid = lcl_GetSumProduct(pMatY, pMatY,
N);
2600 pResMat->PutDouble(fSSreg, 0, 4);
2601 pResMat->PutDouble(fSSresid, 1, 4);
2603 double fDegreesFreedom =
static_cast<double>( bConstant ?
N-K-1 :
N-K );
2604 pResMat->PutDouble(fDegreesFreedom, 1, 3);
2606 if (fDegreesFreedom == 0.0 || fSSresid == 0.0 || fSSreg == 0.0)
2608 pResMat->PutDouble(0.0, 1, 4);
2610 pResMat->PutError( FormulaError::NotAvailable, 0, 3);
2612 pResMat->PutDouble(0.0, 1, 2);
2615 pResMat->PutDouble(0.0, K-1-
i, 1);
2619 pResMat->PutDouble(0.0, K, 1);
2621 pResMat->PutError( FormulaError::NotAvailable, K, 1);
2624 pResMat->PutDouble(1.0, 0, 2);
2628 double fFstatistic = (fSSreg /
static_cast<double>(K))
2629 / (fSSresid / fDegreesFreedom);
2630 pResMat->PutDouble(fFstatistic, 0, 3);
2633 double fRMSE = sqrt(fSSresid / fDegreesFreedom);
2634 pResMat->PutDouble(fRMSE, 1, 2);
2647 pMatZ->FillDouble(0.0,0,0,0,K-1);
2648 pMatZ->PutDouble(1.0,
col);
2650 lcl_SolveWithLowerLeftTriangle(pMatX, aVecR, pMatZ, K,
false);
2652 lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pMatZ, K,
false);
2654 double fSigmaSlope = fRMSE * sqrt(pMatZ->GetDouble(
col));
2655 pResMat->PutDouble(fSigmaSlope, K-1-
col, 1);
2659 fPart = lcl_GetSumProduct(pMeans, pMatZ, K);
2660 aSigmaIntercept += fPart * pMeans->GetDouble(
col);
2665 double fSigmaIntercept = fRMSE
2666 * sqrt( (aSigmaIntercept + 1.0 /
static_cast<double>(
N) ).
get() );
2667 pResMat->PutDouble(fSigmaIntercept, K, 1);
2671 pResMat->PutError( FormulaError::NotAvailable, K, 1);
2674 double fR2 = fSSreg / (fSSreg + fSSresid);
2675 pResMat->PutDouble(fR2, 0, 2);
2682 ::std::vector< double> aVecR(
N);
2687 pMatZ = pMatY->Clone();
2691 if (!pMeans || !pMatZ || !pSlopes)
2698 lcl_CalculateRowMeans(pMatX, pMeans,
N, K);
2699 lcl_CalculateRowsDelta(pMatX, pMeans,
N, K);
2702 if (!lcl_TCalculateQRdecomposition(pMatX, aVecR, K,
N))
2710 bool bIsSingular=
false;
2711 for (
SCSIZE row=0; row < K && !bIsSingular; row++)
2712 bIsSingular = aVecR[row] == 0.0;
2719 for (
SCSIZE row = 0; row < K; row++)
2721 lcl_TApplyHouseholderTransformation(pMatX, row, pMatZ,
N);
2727 pSlopes->PutDouble( pMatZ->GetDouble(
col),
col);
2729 lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pSlopes, K,
true);
2730 double fIntercept = 0.0;
2732 fIntercept = fMeanY - lcl_GetSumProduct(pMeans,pSlopes,K);
2734 pResMat->PutDouble(_bRKP ? exp(fIntercept) : fIntercept, K, 0 );
2736 pResMat->PutDouble(_bRKP ? exp(pSlopes->GetDouble(
i))
2737 : pSlopes->GetDouble(
i) , K-1-
i, 0);
2741 double fSSreg = 0.0;
2742 double fSSresid = 0.0;
2744 pMatZ->FillDouble(0.0, 0, 0,
N-1, 0);
2746 lcl_ApplyUpperRightTriangle(pMatX, aVecR, pSlopes, pMatZ, K,
true);
2748 for (
SCSIZE rowp1 = K; rowp1 > 0; rowp1--)
2750 lcl_TApplyHouseholderTransformation(pMatX, rowp1-1, pMatZ,
N);
2752 fSSreg =lcl_GetSumProduct(pMatZ, pMatZ,
N);
2755 pMatY->PutDouble(pMatY->GetDouble(
col) - pMatZ->GetDouble(
col),
col);
2756 fSSresid = lcl_GetSumProduct(pMatY, pMatY,
N);
2757 pResMat->PutDouble(fSSreg, 0, 4);
2758 pResMat->PutDouble(fSSresid, 1, 4);
2760 double fDegreesFreedom =
static_cast<double>( bConstant ?
N-K-1 :
N-K );
2761 pResMat->PutDouble(fDegreesFreedom, 1, 3);
2763 if (fDegreesFreedom == 0.0 || fSSresid == 0.0 || fSSreg == 0.0)
2765 pResMat->PutDouble(0.0, 1, 4);
2767 pResMat->PutError( FormulaError::NotAvailable, 0, 3);
2769 pResMat->PutDouble(0.0, 1, 2);
2772 pResMat->PutDouble(0.0, K-1-
i, 1);
2776 pResMat->PutDouble(0.0, K, 1);
2778 pResMat->PutError( FormulaError::NotAvailable, K, 1);
2781 pResMat->PutDouble(1.0, 0, 2);
2785 double fFstatistic = (fSSreg /
static_cast<double>(K))
2786 / (fSSresid / fDegreesFreedom);
2787 pResMat->PutDouble(fFstatistic, 0, 3);
2790 double fRMSE = sqrt(fSSresid / fDegreesFreedom);
2791 pResMat->PutDouble(fRMSE, 1, 2);
2802 for (
SCSIZE row = 0; row < K; row++)
2805 pMatZ->FillDouble(0.0,0,0,K-1,0);
2806 pMatZ->PutDouble(1.0, row);
2808 lcl_SolveWithLowerLeftTriangle(pMatX, aVecR, pMatZ, K,
true);
2810 lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pMatZ, K,
true);
2812 double fSigmaSlope = fRMSE * sqrt(pMatZ->GetDouble(row));
2813 pResMat->PutDouble(fSigmaSlope, K-1-row, 1);
2816 fPart = lcl_GetSumProduct(pMeans, pMatZ, K);
2817 aSigmaIntercept += fPart * pMeans->GetDouble(row);
2822 double fSigmaIntercept = fRMSE
2823 * sqrt( (aSigmaIntercept + 1.0 /
static_cast<double>(
N) ).
get() );
2824 pResMat->PutDouble(fSigmaIntercept, K, 1);
2828 pResMat->PutError( FormulaError::NotAvailable, K, 1);
2831 double fR2 = fSSreg / (fSSreg + fSSresid);
2832 pResMat->PutDouble(fR2, 0, 2);
2858 if (nParamCount == 4)
2866 if (nParamCount >= 3)
2882 if (nParamCount >= 2)
2910 if (!
CheckMatrix(_bGrowth,nCase,nCX,nCY,nRX,nRY,K,
N,pMatX,pMatY))
2917 if ((bConstant && (
N<K+1)) || (!bConstant && (
N<K)) || (
N<1) || (K<1))
2930 nCountXN = nCXN * nRXN;
2931 pMatNewX = pMatX->Clone();
2935 pMatNewX->GetDimensions(nCXN, nRXN);
2936 if ((nCase == 2 && K != nCXN) || (nCase == 3 && K != nRXN))
2941 nCountXN = nCXN * nRXN;
2943 if (!pMatNewX->IsValue(
i))
2966 double fMeanY = 0.0;
2971 if (!pCopyX || !pCopyY)
2979 fMeanY = lcl_GetMeanOverAll(pMatY,
N);
2982 pMatY->PutDouble( ::rtl::math::approxSub(pMatY->GetDouble(
i),fMeanY),
i );
2989 double fMeanX = 0.0;
2992 fMeanX = lcl_GetMeanOverAll(pMatX,
N);
2995 pMatX->PutDouble( ::rtl::math::approxSub(pMatX->GetDouble(
i),fMeanX),
i );
2998 double fSumXY = lcl_GetSumProduct(pMatX,pMatY,
N);
2999 double fSumX2 = lcl_GetSumProduct(pMatX,pMatX,
N);
3005 double fSlope = fSumXY / fSumX2;
3009 double fIntercept = fMeanY - fSlope * fMeanX;
3012 fHelp = pMatNewX->GetDouble(
i)*fSlope + fIntercept;
3013 pResMat->PutDouble(_bGrowth ? exp(fHelp) : fHelp,
i);
3020 fHelp = pMatNewX->GetDouble(
i)*fSlope;
3021 pResMat->PutDouble(_bGrowth ? exp(fHelp) : fHelp,
i);
3029 ::std::vector< double> aVecR(
N);
3033 if (!pMeans || !pSlopes)
3040 lcl_CalculateColumnMeans(pMatX, pMeans, K,
N);
3041 lcl_CalculateColumnsDelta(pMatX, pMeans, K,
N);
3043 if (!lcl_CalculateQRdecomposition(pMatX, aVecR, K,
N))
3050 bool bIsSingular=
false;
3051 for (
SCSIZE row=0; row < K && !bIsSingular; row++)
3052 bIsSingular = aVecR[row] == 0.0;
3061 lcl_ApplyHouseholderTransformation(pMatX,
col, pMatY,
N);
3067 pSlopes->PutDouble( pMatY->GetDouble(
col),
col);
3069 lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pSlopes, K,
false);
3072 lcl_MFastMult(pMatNewX,pSlopes,pResMat,nRXN,K,1);
3075 double fIntercept = fMeanY - lcl_GetSumProduct(pMeans,pSlopes,K);
3076 for (
SCSIZE row = 0; row < nRXN; row++)
3077 pResMat->PutDouble(pResMat->GetDouble(row)+fIntercept, row);
3082 pResMat->PutDouble(exp(pResMat->GetDouble(
i)),
i);
3088 ::std::vector< double> aVecR(
N);
3092 if (!pMeans || !pSlopes)
3099 lcl_CalculateRowMeans(pMatX, pMeans,
N, K);
3100 lcl_CalculateRowsDelta(pMatX, pMeans,
N, K);
3102 if (!lcl_TCalculateQRdecomposition(pMatX, aVecR, K,
N))
3109 bool bIsSingular=
false;
3110 for (
SCSIZE row=0; row < K && !bIsSingular; row++)
3111 bIsSingular = aVecR[row] == 0.0;
3118 for (
SCSIZE row = 0; row < K; row++)
3120 lcl_TApplyHouseholderTransformation(pMatX, row, pMatY,
N);
3126 pSlopes->PutDouble( pMatY->GetDouble(
col),
col);
3128 lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pSlopes, K,
true);
3131 lcl_MFastMult(pSlopes,pMatNewX,pResMat,1,K,nCXN);
3134 double fIntercept = fMeanY - lcl_GetSumProduct(pMeans,pSlopes,K);
3136 pResMat->PutDouble(pResMat->GetDouble(
col)+fIntercept,
col);
3141 pResMat->PutDouble(exp(pResMat->GetDouble(
i)),
i);
3169 PushError( FormulaError::RetryCircular );
3199 if ((nCols <= nC && nCols != 1) || (nRows <= nR && nRows != 1))
3239 if (nErr != FormulaError::NONE)
3258 if(
aStr ==
"SYSTEM" )
3260 else if(
aStr ==
"OSVERSION" )
3261#if (defined LINUX || defined __FreeBSD__)
3270 else if(
aStr ==
"RELEASE" )
3272 else if(
aStr ==
"NUMFILE" )
3274 else if(
aStr ==
"RECALC" )
3276 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