[Libreoffice-commits] core.git: 2 commits - sc/qa sc/source

2013-11-17 Thread yiming ju
 sc/qa/unit/data/xls/opencl/math/sumproduct_mixSliding.xls |binary
 sc/qa/unit/opencl-test.cxx|   38 +
 sc/source/core/opencl/formulagroupcl.cxx  |   57 +++---
 3 files changed, 86 insertions(+), 9 deletions(-)

New commits:
commit 59c0051b26c28a0b277a83177f7e7d5db012b6cf
Author: yiming ju yim...@multicorewareinc.com
Date:   Sun Nov 17 18:29:16 2013 +0800

GPU Calc: unit test cases for SUMPRODUCT WITH FIXED WINDOWS

AMLOEXT-214 BUG

Change-Id: Ib5adff235593b3a38f6aa7e63edf0196d31b8e82
Signed-off-by: haochen haoc...@multicorewareinc.com
Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com

diff --git a/sc/qa/unit/data/xls/opencl/math/sumproduct_mixSliding.xls 
b/sc/qa/unit/data/xls/opencl/math/sumproduct_mixSliding.xls
new file mode 100644
index 000..09ff33e
Binary files /dev/null and 
b/sc/qa/unit/data/xls/opencl/math/sumproduct_mixSliding.xls differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 0cbf365..987fc40 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -240,6 +240,7 @@ public:
 void testStatisticalFormulaStDevP();
 void testStatisticalFormulaCovar();
 void testLogicalFormulaAnd();
+void testMathFormulaSumProduct();
 CPPUNIT_TEST_SUITE(ScOpenclTest);
 CPPUNIT_TEST(testSharedFormulaXLS);
 CPPUNIT_TEST(testFinacialFormula);
@@ -411,6 +412,7 @@ public:
 CPPUNIT_TEST(testStatisticalFormulaStDevP);
 CPPUNIT_TEST(testStatisticalFormulaCovar);
 CPPUNIT_TEST(testLogicalFormulaAnd);
+CPPUNIT_TEST(testMathFormulaSumProduct);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -4716,6 +4718,42 @@ void ScOpenclTest:: testArrayFormulaSumXMY2()
 xDocSh-DoClose();
 xDocShRes-DoClose();
 }
+//[AMLOEXT-214]
+void ScOpenclTest::testMathFormulaSumProduct()
+{
+if (!detectOpenCLDevice())
+return;
+ScDocShellRef xDocSh = loadDoc(opencl/math/sumproduct_mixSliding., XLS);
+ScDocument* pDoc = xDocSh-GetDocument();
+CPPUNIT_ASSERT(pDoc);
+enableOpenCL();
+pDoc-CalcAll();
+ScDocShellRef xDocShRes = loadDoc(opencl/math/sumproduct_mixSliding., 
XLS);
+ScDocument* pDocRes = xDocShRes-GetDocument();
+CPPUNIT_ASSERT(pDocRes);
+// Check the results of formula cells in the shared formula range.
+for (SCROW i = 0; i = 9; ++i)
+{
+double fLibre = pDoc-GetValue(ScAddress(2,i,0));
+double fExcel = pDocRes-GetValue(ScAddress(2,i,0));
+if ( i == 1 )
+CPPUNIT_ASSERT_DOUBLES_EQUAL(82,  fLibre, fabs(0.0001*fExcel));
+else if ( i == 2 )
+CPPUNIT_ASSERT_DOUBLES_EQUAL(113, fLibre, fabs(0.0001*fExcel));
+else if ( i == 4 )
+CPPUNIT_ASSERT_DOUBLES_EQUAL(175, fLibre, fabs(0.0001*fExcel));
+else if ( i == 5 )
+CPPUNIT_ASSERT_DOUBLES_EQUAL(206, fLibre, fabs(0.0001*fExcel));
+else if ( i == 6 )
+CPPUNIT_ASSERT_DOUBLES_EQUAL(237, fLibre, fabs(0.0001*fExcel));
+else if ( i == 7 )
+CPPUNIT_ASSERT_DOUBLES_EQUAL(268, fLibre, fabs(0.0001*fExcel));
+else
+CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+}
+xDocSh-DoClose();
+xDocShRes-DoClose();
+}
 //[AMLOEXT-217]
 void ScOpenclTest:: testLogicalFormulaAnd()
 {
commit 62f23965591ad3e2a3ee772e518d3fccd6b5ae9f
Author: yiming ju yim...@multicorewareinc.com
Date:   Sun Nov 17 18:58:23 2013 +0800

GPU Calc: implemented SUMPRODUCT WITH FIXED WINDOWS

AMLOEXT-214 FIX

Change-Id: Ifb2797899ec30f998a2387ce9c5752c8e8a03b79
Signed-off-by: haochen haoc...@multicorewareinc.com
Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 85ebdf0..43aa30d 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -808,6 +808,8 @@ public:
 const std::string sSymName, SubArguments vSubArguments)
 {
 size_t nCurWindowSize = 0;
+FormulaToken *tmpCur = NULL;
+const formula::DoubleVectorRefToken *pCurDVR = NULL;
 ss  \ndouble   sSymName;
 ss  _ BinFuncName() (;
 for (unsigned i = 0; i  vSubArguments.size(); i++)
@@ -816,15 +818,50 @@ public:
 ss  ,;
 vSubArguments[i]-GenSlidingWindowDecl(ss);
 size_t nCurChildWindowSize = vSubArguments[i]-GetWindowSize();
-nCurWindowSize = (nCurWindowSize  nCurChildWindowSize) ?
+nCurWindowSize = (nCurWindowSize  nCurChildWindowSize)?
 nCurChildWindowSize:nCurWindowSize;
+tmpCur = vSubArguments[i]-GetFormulaToken();
+if (  ocPush==tmpCur-GetOpCode() )
+{
+
+pCurDVR = dynamic_cast
+const formula::DoubleVectorRefToken*(tmpCur);
+if ( !
+( (!pCurDVR-IsStartFixed

[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 4 commits - sc/Library_scopencl.mk sc/qa sc/source

2013-11-17 Thread yiming ju
 sc/Library_scopencl.mk|1 
 sc/qa/unit/data/xls/opencl/logical/and.xls|binary
 sc/qa/unit/data/xls/opencl/math/sumproduct_mixSliding.xls |binary
 sc/qa/unit/opencl-test.cxx|   68 
 sc/source/core/opencl/formulagroupcl.cxx  |   62 ++-
 sc/source/core/opencl/op_logical.cxx  |  109 ++
 sc/source/core/opencl/op_logical.hxx  |   29 +++
 sc/source/core/tool/token.cxx |1 
 8 files changed, 261 insertions(+), 9 deletions(-)

New commits:
commit 2c64547663697834ca9fb2359109edfd924b9f97
Author: yiming ju yim...@multicorewareinc.com
Date:   Sun Nov 17 18:29:16 2013 +0800

GPU Calc: unit test cases for SUMPRODUCT WITH FIXED WINDOWS

AMLOEXT-214 BUG

Change-Id: Ib5adff235593b3a38f6aa7e63edf0196d31b8e82
Signed-off-by: haochen haoc...@multicorewareinc.com
Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com

diff --git a/sc/qa/unit/data/xls/opencl/math/sumproduct_mixSliding.xls 
b/sc/qa/unit/data/xls/opencl/math/sumproduct_mixSliding.xls
new file mode 100644
index 000..09ff33e
Binary files /dev/null and 
b/sc/qa/unit/data/xls/opencl/math/sumproduct_mixSliding.xls differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 437602a..f810121 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -242,6 +242,7 @@ public:
 void testStatisticalFormulaStDevP();
 void testStatisticalFormulaCovar();
 void testLogicalFormulaAnd();
+void testMathFormulaSumProduct();
 CPPUNIT_TEST_SUITE(ScOpenclTest);
 CPPUNIT_TEST(testSharedFormulaXLS);
 CPPUNIT_TEST(testFinacialFormula);
@@ -413,6 +414,7 @@ public:
 CPPUNIT_TEST(testStatisticalFormulaStDevP);
 CPPUNIT_TEST(testStatisticalFormulaCovar);
 CPPUNIT_TEST(testLogicalFormulaAnd);
+CPPUNIT_TEST(testMathFormulaSumProduct);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -4716,6 +4718,42 @@ void ScOpenclTest:: testArrayFormulaSumXMY2()
 xDocSh-DoClose();
 xDocShRes-DoClose();
 }
+//[AMLOEXT-214]
+void ScOpenclTest::testMathFormulaSumProduct()
+{
+if (!detectOpenCLDevice())
+return;
+ScDocShellRef xDocSh = loadDoc(opencl/math/sumproduct_mixSliding., XLS);
+ScDocument* pDoc = xDocSh-GetDocument();
+CPPUNIT_ASSERT(pDoc);
+enableOpenCL();
+pDoc-CalcAll();
+ScDocShellRef xDocShRes = loadDoc(opencl/math/sumproduct_mixSliding., 
XLS);
+ScDocument* pDocRes = xDocShRes-GetDocument();
+CPPUNIT_ASSERT(pDocRes);
+// Check the results of formula cells in the shared formula range.
+for (SCROW i = 0; i = 9; ++i)
+{
+double fLibre = pDoc-GetValue(ScAddress(2,i,0));
+double fExcel = pDocRes-GetValue(ScAddress(2,i,0));
+if ( i == 1 )
+CPPUNIT_ASSERT_DOUBLES_EQUAL(82,  fLibre, fabs(0.0001*fExcel));
+else if ( i == 2 )
+CPPUNIT_ASSERT_DOUBLES_EQUAL(113, fLibre, fabs(0.0001*fExcel));
+else if ( i == 4 )
+CPPUNIT_ASSERT_DOUBLES_EQUAL(175, fLibre, fabs(0.0001*fExcel));
+else if ( i == 5 )
+CPPUNIT_ASSERT_DOUBLES_EQUAL(206, fLibre, fabs(0.0001*fExcel));
+else if ( i == 6 )
+CPPUNIT_ASSERT_DOUBLES_EQUAL(237, fLibre, fabs(0.0001*fExcel));
+else if ( i == 7 )
+CPPUNIT_ASSERT_DOUBLES_EQUAL(268, fLibre, fabs(0.0001*fExcel));
+else
+CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+}
+xDocSh-DoClose();
+xDocShRes-DoClose();
+}
 //[AMLOEXT-217]
 void ScOpenclTest:: testLogicalFormulaAnd()
 {
commit e7c752b9903c4e056ebbd9ee0ac5035aeeeb1637
Author: yiming ju yim...@multicorewareinc.com
Date:   Sun Nov 17 18:58:23 2013 +0800

GPU Calc: implemented SUMPRODUCT WITH FIXED WINDOWS

AMLOEXT-214 FIX

Change-Id: Ifb2797899ec30f998a2387ce9c5752c8e8a03b79
Signed-off-by: haochen haoc...@multicorewareinc.com
Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 8c63199..dfb2037 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -808,6 +808,8 @@ public:
 const std::string sSymName, SubArguments vSubArguments)
 {
 size_t nCurWindowSize = 0;
+FormulaToken *tmpCur = NULL;
+const formula::DoubleVectorRefToken *pCurDVR = NULL;
 ss  \ndouble   sSymName;
 ss  _ BinFuncName() (;
 for (unsigned i = 0; i  vSubArguments.size(); i++)
@@ -816,15 +818,50 @@ public:
 ss  ,;
 vSubArguments[i]-GenSlidingWindowDecl(ss);
 size_t nCurChildWindowSize = vSubArguments[i]-GetWindowSize();
-nCurWindowSize = (nCurWindowSize  nCurChildWindowSize) ?
+nCurWindowSize = (nCurWindowSize  nCurChildWindowSize

[Libreoffice-commits] core.git: 2 commits - sc/qa sc/source

2013-11-05 Thread yiming ju
 sc/qa/unit/data/xls/opencl/financial/PV.xls |binary
 sc/qa/unit/opencl-test.cxx  |   24 
 sc/source/core/opencl/formulagroupcl.cxx|4 
 sc/source/core/opencl/op_financial.cxx  |  144 
 sc/source/core/opencl/op_financial.hxx  |8 +
 sc/source/core/tool/token.cxx   |1 
 6 files changed, 181 insertions(+)

New commits:
commit c1492fe9ea81eb7d6af3e636f022a23fb7874b9d
Author: yiming ju yim...@multicorewareinc.com
Date:   Mon Nov 4 15:54:15 2013 +0800

GPU Calc: implement fix for PV

AMLOEXT-73 FIX

Change-Id: I0b9014a5d78165adaaa41c7e6cc05e876981f37d
Signed-off-by: haochen haoc...@multicorewareinc.com
Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index d3ad8bc..c8c07e4 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1028,6 +1028,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
 mvSubArguments.push_back(SoPHelper(ts,
  ft-Children[i], new OpAbs));
 break;
+case ocBW:
+mvSubArguments.push_back(SoPHelper(ts,
+ ft-Children[i], new OpPV));
+break;
 case ocExternal:
 if ( !(pChild-GetExternal().compareTo(OUString(
 com.sun.star.sheet.addin.Analysis.getEffect
diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index d5853f6..cb31cd1 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -3388,6 +3388,150 @@ void OpTbillyield::GenSlidingWindowFunction(
 ss  }\n;
 }
 
+void OpPV::GenSlidingWindowFunction(
+std::stringstream ss, const std::string sSymName, SubArguments 
+vSubArguments)
+{
+ss  \ndouble   sSymName;
+ss  _ BinFuncName() (;
+for (unsigned i = 0; i  vSubArguments.size(); i++)
+{
+if (i)
+ss  ,;
+vSubArguments[i]-GenSlidingWindowDecl(ss);
+}
+ss  ) {\n;
+ss  double result =  0;\n;
+ss  int gid0 = get_global_id(0);\n;
+ss  double zins;\n;
+ss  double zzr;\n;
+ss  double rmz;\n;
+ss  double zw;\n;
+ss  double flag;\n;
+
+#ifdef ISNAN
+ FormulaToken *tmpCur0 = vSubArguments[0]-GetFormulaToken();
+ const formula::SingleVectorRefToken*tmpCurDVR0= dynamic_castconst
+ formula::SingleVectorRefToken *(tmpCur0);
+
+ FormulaToken *tmpCur1 = vSubArguments[1]-GetFormulaToken();
+ const formula::SingleVectorRefToken*tmpCurDVR1= dynamic_castconst
+ formula::SingleVectorRefToken *(tmpCur1);
+
+ FormulaToken *tmpCur2 = vSubArguments[2]-GetFormulaToken();
+ const formula::SingleVectorRefToken*tmpCurDVR2= dynamic_castconst
+ formula::SingleVectorRefToken *(tmpCur2);
+
+ const formula::SingleVectorRefToken*tmpCurDVR3;
+ const formula::SingleVectorRefToken*tmpCurDVR4;
+
+if(vSubArguments.size()3)
+{
+FormulaToken *tmpCur3 = vSubArguments[3]-GetFormulaToken();
+tmpCurDVR3= dynamic_castconst formula::SingleVectorRefToken *(
+tmpCur3);
+ss int buffer_zw_len = ;
+ss tmpCurDVR3-GetArrayLength();
+ss  ;\n;
+}
+
+if(vSubArguments.size()4)
+{
+FormulaToken *tmpCur4 = vSubArguments[4]-GetFormulaToken();
+tmpCurDVR4= dynamic_castconst formula::SingleVectorRefToken *(
+tmpCur4);
+ss int buffer_flag_len = ;
+ss tmpCurDVR4-GetArrayLength();
+ss  ;\n;
+}
+
+ss int buffer_zins_len = ;
+ss tmpCurDVR0-GetArrayLength();
+ss  ;\n;
+
+ss int buffer_zzr_len = ;
+ss tmpCurDVR1-GetArrayLength();
+ss  ;\n;
+
+ss int buffer_rmz_len = ;
+ss tmpCurDVR2-GetArrayLength();
+ss  ;\n;
+
+#endif
+
+#ifdef ISNAN
+ssif(gid0=buffer_zins_len || isNan(;
+ss  vSubArguments[0]-GenSlidingWindowDeclRef();
+ss))\n;
+sszins = 0;\nelse \n;
+#endif
+sszins = ;
+ss  vSubArguments[0]-GenSlidingWindowDeclRef();
+ss;\n;
+
+#ifdef ISNAN
+ssif(gid0=buffer_zzr_len || isNan(;
+ss  vSubArguments[1]-GenSlidingWindowDeclRef();
+ss))\n;
+sszzr = 0;\nelse \n;
+#endif
+sszzr = ;
+ss  vSubArguments[1]-GenSlidingWindowDeclRef();
+ss;\n;
+
+#ifdef ISNAN
+ssif(gid0=buffer_rmz_len || isNan(;
+ss  vSubArguments[2]-GenSlidingWindowDeclRef();
+ss))\n;
+ssrmz = 0;\nelse \n;
+#endif
+ssrmz = ;
+ss  vSubArguments[2]-GenSlidingWindowDeclRef();
+ss;\n;
+
+if(vSubArguments.size()3)
+{
+#ifdef ISNAN
+ssif(gid0=buffer_zw_len || isNan(;
+ss  vSubArguments[3]-GenSlidingWindowDeclRef();
+ss))\n;
+sszw = 0;\nelse \n;
+#endif
+ss

[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source

2013-11-05 Thread yiming ju
 sc/qa/unit/data/xls/opencl/financial/PV.xls |binary
 sc/qa/unit/opencl-test.cxx  |   24 
 sc/source/core/opencl/formulagroupcl.cxx|4 
 sc/source/core/opencl/op_financial.cxx  |  144 
 sc/source/core/opencl/op_financial.hxx  |8 +
 sc/source/core/tool/token.cxx   |1 
 6 files changed, 181 insertions(+)

New commits:
commit cdb3b9f846278a9b148d094f5e5ddd3a567b09a4
Author: yiming ju yim...@multicorewareinc.com
Date:   Mon Nov 4 15:54:15 2013 +0800

GPU Calc: implement fix for PV

AMLOEXT-73 FIX

Change-Id: I0b9014a5d78165adaaa41c7e6cc05e876981f37d
Signed-off-by: haochen haoc...@multicorewareinc.com
Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 0b69d4e..72cf329 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1028,6 +1028,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
 mvSubArguments.push_back(SoPHelper(ts,
  ft-Children[i], new OpAbs));
 break;
+case ocBW:
+mvSubArguments.push_back(SoPHelper(ts,
+ ft-Children[i], new OpPV));
+break;
 case ocExternal:
 if ( !(pChild-GetExternal().compareTo(OUString(
 com.sun.star.sheet.addin.Analysis.getEffect
diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index b5b9a5c..3597f9f 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -3390,6 +3390,150 @@ void OpTbillyield::GenSlidingWindowFunction(
 ss  }\n;
 }
 
+void OpPV::GenSlidingWindowFunction(
+std::stringstream ss, const std::string sSymName, SubArguments 
+vSubArguments)
+{
+ss  \ndouble   sSymName;
+ss  _ BinFuncName() (;
+for (unsigned i = 0; i  vSubArguments.size(); i++)
+{
+if (i)
+ss  ,;
+vSubArguments[i]-GenSlidingWindowDecl(ss);
+}
+ss  ) {\n;
+ss  double result =  0;\n;
+ss  int gid0 = get_global_id(0);\n;
+ss  double zins;\n;
+ss  double zzr;\n;
+ss  double rmz;\n;
+ss  double zw;\n;
+ss  double flag;\n;
+
+#ifdef ISNAN
+ FormulaToken *tmpCur0 = vSubArguments[0]-GetFormulaToken();
+ const formula::SingleVectorRefToken*tmpCurDVR0= dynamic_castconst
+ formula::SingleVectorRefToken *(tmpCur0);
+
+ FormulaToken *tmpCur1 = vSubArguments[1]-GetFormulaToken();
+ const formula::SingleVectorRefToken*tmpCurDVR1= dynamic_castconst
+ formula::SingleVectorRefToken *(tmpCur1);
+
+ FormulaToken *tmpCur2 = vSubArguments[2]-GetFormulaToken();
+ const formula::SingleVectorRefToken*tmpCurDVR2= dynamic_castconst
+ formula::SingleVectorRefToken *(tmpCur2);
+
+ const formula::SingleVectorRefToken*tmpCurDVR3;
+ const formula::SingleVectorRefToken*tmpCurDVR4;
+
+if(vSubArguments.size()3)
+{
+FormulaToken *tmpCur3 = vSubArguments[3]-GetFormulaToken();
+tmpCurDVR3= dynamic_castconst formula::SingleVectorRefToken *(
+tmpCur3);
+ss int buffer_zw_len = ;
+ss tmpCurDVR3-GetArrayLength();
+ss  ;\n;
+}
+
+if(vSubArguments.size()4)
+{
+FormulaToken *tmpCur4 = vSubArguments[4]-GetFormulaToken();
+tmpCurDVR4= dynamic_castconst formula::SingleVectorRefToken *(
+tmpCur4);
+ss int buffer_flag_len = ;
+ss tmpCurDVR4-GetArrayLength();
+ss  ;\n;
+}
+
+ss int buffer_zins_len = ;
+ss tmpCurDVR0-GetArrayLength();
+ss  ;\n;
+
+ss int buffer_zzr_len = ;
+ss tmpCurDVR1-GetArrayLength();
+ss  ;\n;
+
+ss int buffer_rmz_len = ;
+ss tmpCurDVR2-GetArrayLength();
+ss  ;\n;
+
+#endif
+
+#ifdef ISNAN
+ssif(gid0=buffer_zins_len || isNan(;
+ss  vSubArguments[0]-GenSlidingWindowDeclRef();
+ss))\n;
+sszins = 0;\nelse \n;
+#endif
+sszins = ;
+ss  vSubArguments[0]-GenSlidingWindowDeclRef();
+ss;\n;
+
+#ifdef ISNAN
+ssif(gid0=buffer_zzr_len || isNan(;
+ss  vSubArguments[1]-GenSlidingWindowDeclRef();
+ss))\n;
+sszzr = 0;\nelse \n;
+#endif
+sszzr = ;
+ss  vSubArguments[1]-GenSlidingWindowDeclRef();
+ss;\n;
+
+#ifdef ISNAN
+ssif(gid0=buffer_rmz_len || isNan(;
+ss  vSubArguments[2]-GenSlidingWindowDeclRef();
+ss))\n;
+ssrmz = 0;\nelse \n;
+#endif
+ssrmz = ;
+ss  vSubArguments[2]-GenSlidingWindowDeclRef();
+ss;\n;
+
+if(vSubArguments.size()3)
+{
+#ifdef ISNAN
+ssif(gid0=buffer_zw_len || isNan(;
+ss  vSubArguments[3]-GenSlidingWindowDeclRef();
+ss))\n;
+sszw = 0;\nelse \n;
+#endif
+ss

[Libreoffice-commits] core.git: sc/source

2013-11-01 Thread yiming ju
 sc/source/core/opencl/opinlinefun_finacial.cxx |  941 +
 1 file changed, 490 insertions(+), 451 deletions(-)

New commits:
commit 4ea4239719551ba06cc2ee9758a1d232a1c1e84e
Author: yiming ju yim...@multicorewareinc.com
Date:   Fri Nov 1 17:48:31 2013 +0800

GPU Calc: refactor string formatting in some GPU inline functions

Change-Id: I4ceb86ca84854a4e14c0720d6216d4c658a97859
Signed-off-by: haochen haoc...@multicorewareinc.com
Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com

diff --git a/sc/source/core/opencl/opinlinefun_finacial.cxx 
b/sc/source/core/opencl/opinlinefun_finacial.cxx
index 05e6a5f..27a1625 100644
--- a/sc/source/core/opencl/opinlinefun_finacial.cxx
+++ b/sc/source/core/opencl/opinlinefun_finacial.cxx
@@ -14,10 +14,10 @@ std::string approxEqual =
 bool approxEqual(double a, double b)\n
 {\n
  if (a == b)\n
-\t\treturn true;\n
-\tdouble x = a - b;\n
-\treturn (x  0.0 ? -x : x)  ((a  0.0 ? -a : a) * (1.0 / (16777216.0 *
-16777216.0)));\n
+return true;\n
+ double x = a - b;\n
+ return (x  0.0 ? -x : x)  ((a  0.0 ? -a : a) * (1.0 / (16777216.0 *
+16777216.0)));\n
 }\n;
 
 std::string nKorrValDecl =double constant nKorrVal[]
@@ -32,21 +32,22 @@ std::string RoundDecl = double  Round(double fValue);\n;
 std::string Round =
 double  Round(double fValue)\n
 {\n
-\tif (fValue == 0.0)\n
-\t\treturn fValue;\n
-\tdouble fFac = 0;\n
-\tint nExp;\n
-\tif (fValue  0.0)\n
-\t\tnExp = (floor(log10(fValue)));\n
-\telse\n
-\t\tnExp = 0;\n
-\tint nIndex = 15 - nExp;\n
-\tif (nIndex  15)\n
-\t\tnIndex = 15;\n
-\telse if (nIndex = 1)\n
-\t\tnIndex = 0;\n
-\tfValue = floor(fValue + 0.5 + nKorrVal[nIndex]);\n
-\treturn fValue;\n
+if ( fValue == 0.0  )\n
+return fValue;\n
+\n
+double fFac = 0;\n
+int nExp;\n
+if ( fValue  0.0 )\n
+nExp = ( floor( log10( fValue ) ) );\n
+else\n
+nExp = 0;\n
+int nIndex = 15 - nExp;\n
+if ( nIndex  15 )\n
+nIndex = 15;\n
+else if ( nIndex = 1 )\n
+nIndex = 0;\n
+fValue = floor( fValue + 0.5 + nKorrVal[nIndex] );\n
+return fValue;\n
 }\n;
 
 std::string GetRmzDecl =
@@ -55,27 +56,29 @@ std::string GetRmzDecl =
 std::string GetRmz=
 double GetRmz( double fZins, double fZzr, double fBw, double fZw, int nF )\n
 {\n
-\tdouble  fRmz;\n
-\tif( fZins == 0.0 )\n
-\t\tfRmz = ( fBw + fZw ) / fZzr;\n
-\telse\n
-\t\t{\n
-\t\t\tdouble  fTerm = pow( 1.0 + fZins, fZzr );\n
-\t\t\tif( nF  0 )\n
-  \t\t\t\tfRmz = ( fZw * fZins / ( fTerm - 1.0 ) + fBw
-   * fZins / ( 1.0 - 1.0 / fTerm ) ) / ( 1.0 + fZins );\n
-\t\t\telse\n
-\t\t\t\tfRmz = fZw * fZins / ( fTerm - 1.0 ) + fBw * fZins /
-( 1.0 - 1.0 / fTerm );\n
-\t\t}\n
-\treturn -fRmz;\n
-}\n\n;
+double  fRmz;\n
+if( fZins == 0.0 )\n
+fRmz = ( fBw + fZw ) / fZzr;\n
+else\n
+{\n
+double  fTerm = pow( 1.0 + fZins, fZzr );\n
+if( nF  0 )\n
+fRmz = ( fZw * fZins / ( fTerm - 1.0 ) + fBw * fZins / ( 1.0 - 1.
+0 / fTerm ) ) / ( 1.0 + fZins );\n
+else\n
+fRmz = fZw * fZins / ( fTerm - 1.0 ) + fBw * fZins /( 1.0 - 1.0 
+/ fTerm );\n
+}\n
+return -fRmz;\n
+}\n;
 
 std::string GetZwDecl =
-double GetZw( double fZins, double fZzr, double fRmz, double fBw, int nF 
);\n;
+double GetZw( double fZins, double fZzr, double fRmz,
+double fBw, int nF );\n;
 
 std::string GetZw =
-double GetZw( double fZins, double fZzr, double fRmz, double fBw, int nF )\n
+double GetZw( double fZins, double fZzr, double fRmz,
+double fBw, int nF )\n
 {\n
 double  fZw;\n
 if( fZins == 0.0 )\n
@@ -84,13 +87,13 @@ std::string GetZw =
 {\n
 double  fTerm = pow( 1.0 + fZins, fZzr );\n
 if( nF  0 )\n
-fZw = fBw * fTerm + fRmz * ( 1.0 + fZins ) *
-( fTerm - 1.0 ) / fZins;\n
+fZw = fBw * fTerm + fRmz * ( 1.0 + fZins ) *( fTerm - 1.0 ) 
+/ fZins;\n
 else\n
-fZw = fBw * fTerm + fRmz * ( fTerm - 1.0 ) / fZins;\n
+fZw = fBw * fTerm + fRmz * ( fTerm - 1.0 ) / fZins;\n
 }\n
 return -fZw;\n
-}\n\n;
+}\n;
 
 std::string IsLeapYearDecl =
 bool IsLeapYear( int n );\n;
@@ -98,7 +101,8 @@ std::string IsLeapYearDecl =
 std::string IsLeapYear =
 bool IsLeapYear( int n )\n
 {\n
-return ( (( ( n % 4 ) == 0 )  ( ( n % 100 ) != 0)) || ( ( n % 400 ) == 
0 ) );\n
+return ( (( ( n % 4 ) == 0 )  ( ( n % 100 ) != 0)) || ( ( n % 400 ) == 
+0 ) );\n
 }\n;
 
 std::string DaysInMonthDecl=
@@ -107,8 +111,8 @@ std::string DaysInMonthDecl=
 std::string DaysInMonth =
 int DaysInMonth( int nMonth, int nYear )\n
 {\n
-int aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30,\n
-31, 31, 30, 31, 30, 31 };\n
+int

[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-11-01 Thread yiming ju
 sc/source/core/opencl/opinlinefun_finacial.cxx |  941 +
 1 file changed, 490 insertions(+), 451 deletions(-)

New commits:
commit 63798515b249dabd4af0ca4fd913536398f739ff
Author: yiming ju yim...@multicorewareinc.com
Date:   Fri Nov 1 17:48:31 2013 +0800

GPU Calc: refactor string formatting in some GPU inline functions

Change-Id: I4ceb86ca84854a4e14c0720d6216d4c658a97859
Signed-off-by: haochen haoc...@multicorewareinc.com
Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com

diff --git a/sc/source/core/opencl/opinlinefun_finacial.cxx 
b/sc/source/core/opencl/opinlinefun_finacial.cxx
index 05e6a5f..27a1625 100644
--- a/sc/source/core/opencl/opinlinefun_finacial.cxx
+++ b/sc/source/core/opencl/opinlinefun_finacial.cxx
@@ -14,10 +14,10 @@ std::string approxEqual =
 bool approxEqual(double a, double b)\n
 {\n
  if (a == b)\n
-\t\treturn true;\n
-\tdouble x = a - b;\n
-\treturn (x  0.0 ? -x : x)  ((a  0.0 ? -a : a) * (1.0 / (16777216.0 *
-16777216.0)));\n
+return true;\n
+ double x = a - b;\n
+ return (x  0.0 ? -x : x)  ((a  0.0 ? -a : a) * (1.0 / (16777216.0 *
+16777216.0)));\n
 }\n;
 
 std::string nKorrValDecl =double constant nKorrVal[]
@@ -32,21 +32,22 @@ std::string RoundDecl = double  Round(double fValue);\n;
 std::string Round =
 double  Round(double fValue)\n
 {\n
-\tif (fValue == 0.0)\n
-\t\treturn fValue;\n
-\tdouble fFac = 0;\n
-\tint nExp;\n
-\tif (fValue  0.0)\n
-\t\tnExp = (floor(log10(fValue)));\n
-\telse\n
-\t\tnExp = 0;\n
-\tint nIndex = 15 - nExp;\n
-\tif (nIndex  15)\n
-\t\tnIndex = 15;\n
-\telse if (nIndex = 1)\n
-\t\tnIndex = 0;\n
-\tfValue = floor(fValue + 0.5 + nKorrVal[nIndex]);\n
-\treturn fValue;\n
+if ( fValue == 0.0  )\n
+return fValue;\n
+\n
+double fFac = 0;\n
+int nExp;\n
+if ( fValue  0.0 )\n
+nExp = ( floor( log10( fValue ) ) );\n
+else\n
+nExp = 0;\n
+int nIndex = 15 - nExp;\n
+if ( nIndex  15 )\n
+nIndex = 15;\n
+else if ( nIndex = 1 )\n
+nIndex = 0;\n
+fValue = floor( fValue + 0.5 + nKorrVal[nIndex] );\n
+return fValue;\n
 }\n;
 
 std::string GetRmzDecl =
@@ -55,27 +56,29 @@ std::string GetRmzDecl =
 std::string GetRmz=
 double GetRmz( double fZins, double fZzr, double fBw, double fZw, int nF )\n
 {\n
-\tdouble  fRmz;\n
-\tif( fZins == 0.0 )\n
-\t\tfRmz = ( fBw + fZw ) / fZzr;\n
-\telse\n
-\t\t{\n
-\t\t\tdouble  fTerm = pow( 1.0 + fZins, fZzr );\n
-\t\t\tif( nF  0 )\n
-  \t\t\t\tfRmz = ( fZw * fZins / ( fTerm - 1.0 ) + fBw
-   * fZins / ( 1.0 - 1.0 / fTerm ) ) / ( 1.0 + fZins );\n
-\t\t\telse\n
-\t\t\t\tfRmz = fZw * fZins / ( fTerm - 1.0 ) + fBw * fZins /
-( 1.0 - 1.0 / fTerm );\n
-\t\t}\n
-\treturn -fRmz;\n
-}\n\n;
+double  fRmz;\n
+if( fZins == 0.0 )\n
+fRmz = ( fBw + fZw ) / fZzr;\n
+else\n
+{\n
+double  fTerm = pow( 1.0 + fZins, fZzr );\n
+if( nF  0 )\n
+fRmz = ( fZw * fZins / ( fTerm - 1.0 ) + fBw * fZins / ( 1.0 - 1.
+0 / fTerm ) ) / ( 1.0 + fZins );\n
+else\n
+fRmz = fZw * fZins / ( fTerm - 1.0 ) + fBw * fZins /( 1.0 - 1.0 
+/ fTerm );\n
+}\n
+return -fRmz;\n
+}\n;
 
 std::string GetZwDecl =
-double GetZw( double fZins, double fZzr, double fRmz, double fBw, int nF 
);\n;
+double GetZw( double fZins, double fZzr, double fRmz,
+double fBw, int nF );\n;
 
 std::string GetZw =
-double GetZw( double fZins, double fZzr, double fRmz, double fBw, int nF )\n
+double GetZw( double fZins, double fZzr, double fRmz,
+double fBw, int nF )\n
 {\n
 double  fZw;\n
 if( fZins == 0.0 )\n
@@ -84,13 +87,13 @@ std::string GetZw =
 {\n
 double  fTerm = pow( 1.0 + fZins, fZzr );\n
 if( nF  0 )\n
-fZw = fBw * fTerm + fRmz * ( 1.0 + fZins ) *
-( fTerm - 1.0 ) / fZins;\n
+fZw = fBw * fTerm + fRmz * ( 1.0 + fZins ) *( fTerm - 1.0 ) 
+/ fZins;\n
 else\n
-fZw = fBw * fTerm + fRmz * ( fTerm - 1.0 ) / fZins;\n
+fZw = fBw * fTerm + fRmz * ( fTerm - 1.0 ) / fZins;\n
 }\n
 return -fZw;\n
-}\n\n;
+}\n;
 
 std::string IsLeapYearDecl =
 bool IsLeapYear( int n );\n;
@@ -98,7 +101,8 @@ std::string IsLeapYearDecl =
 std::string IsLeapYear =
 bool IsLeapYear( int n )\n
 {\n
-return ( (( ( n % 4 ) == 0 )  ( ( n % 100 ) != 0)) || ( ( n % 400 ) == 
0 ) );\n
+return ( (( ( n % 4 ) == 0 )  ( ( n % 100 ) != 0)) || ( ( n % 400 ) == 
+0 ) );\n
 }\n;
 
 std::string DaysInMonthDecl=
@@ -107,8 +111,8 @@ std::string DaysInMonthDecl=
 std::string DaysInMonth =
 int DaysInMonth( int nMonth, int nYear )\n
 {\n
-int aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30,\n
-31, 31, 30, 31, 30, 31 };\n
+int