Kaydet (Commit) 20f72678 authored tarafından Łukasz Hryniuk's avatar Łukasz Hryniuk Kaydeden (comit) Markus Mohrhard

tdf#89387 Use Collect method in FTest

Change-Id: Ib397b70f5c33fcf0f8ab26c82bffe7713e1042fd
Reviewed-on: https://gerrit.libreoffice.org/17595Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 69374b8a
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "formulacell.hxx" #include "formulacell.hxx"
#include "document.hxx" #include "document.hxx"
#include "dociter.hxx" #include "dociter.hxx"
#include "matrixoperators.hxx"
#include "scmatrix.hxx" #include "scmatrix.hxx"
#include "globstr.hrc" #include "globstr.hrc"
...@@ -2761,7 +2762,6 @@ void ScInterpreter::ScFTest() ...@@ -2761,7 +2762,6 @@ void ScInterpreter::ScFTest()
} }
SCSIZE nC1, nC2; SCSIZE nC1, nC2;
SCSIZE nR1, nR2; SCSIZE nR1, nR2;
SCSIZE i, j;
pMat1->GetDimensions(nC1, nR1); pMat1->GetDimensions(nC1, nR1);
pMat2->GetDimensions(nC2, nR2); pMat2->GetDimensions(nC2, nR2);
double fCount1 = 0.0; double fCount1 = 0.0;
...@@ -2770,29 +2770,21 @@ void ScInterpreter::ScFTest() ...@@ -2770,29 +2770,21 @@ void ScInterpreter::ScFTest()
double fSumSqr1 = 0.0; double fSumSqr1 = 0.0;
double fSum2 = 0.0; double fSum2 = 0.0;
double fSumSqr2 = 0.0; double fSumSqr2 = 0.0;
double fVal;
for (i = 0; i < nC1; i++) std::vector<std::unique_ptr<sc::op::Op>> aOp;
for (j = 0; j < nR1; j++) aOp.emplace_back(new sc::op::Op(0.0, [](double& rAccum, double fVal){rAccum += fVal;}));
{ aOp.emplace_back(new sc::op::Op(0.0, [](double& rAccum, double fVal){rAccum += fVal * fVal;}));
if (!pMat1->IsString(i,j))
{ auto aVal1 = pMat1->Collect(false, aOp);
fVal = pMat1->GetDouble(i,j); fSum1 = aVal1[0].mfFirst + aVal1[0].mfRest;
fSum1 += fVal; fSumSqr1 = aVal1[1].mfFirst + aVal1[1].mfRest;
fSumSqr1 += fVal * fVal; fCount1 = aVal1[2].mnCount;
fCount1++;
} auto aVal2 = pMat2->Collect(false, aOp);
} fSum2 = aVal2[0].mfFirst + aVal2[0].mfRest;
for (i = 0; i < nC2; i++) fSumSqr2 = aVal2[1].mfFirst + aVal2[1].mfRest;
for (j = 0; j < nR2; j++) fCount2 = aVal2[2].mnCount;
{
if (!pMat2->IsString(i,j))
{
fVal = pMat2->GetDouble(i,j);
fSum2 += fVal;
fSumSqr2 += fVal * fVal;
fCount2++;
}
}
if (fCount1 < 2.0 || fCount2 < 2.0) if (fCount1 < 2.0 || fCount2 < 2.0)
{ {
PushNoValue(); PushNoValue();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment