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

2013-11-12 Thread xinjiang
 sc/qa/unit/data/xls/opencl/financial/FV.xls|binary
 sc/qa/unit/data/xls/opencl/financial/MDuration.xls |binary
 sc/qa/unit/data/xls/opencl/financial/ddb.xls   |binary
 sc/qa/unit/opencl-test.cxx |   72 ++
 sc/source/core/opencl/formulagroupcl.cxx   |   14 +
 sc/source/core/opencl/op_financial.cxx |  229 -
 sc/source/core/opencl/op_financial.hxx |   34 +++
 sc/source/core/tool/token.cxx  |2 
 8 files changed, 347 insertions(+), 4 deletions(-)

New commits:
commit c6987eb1ddde4c4f474e2940773c7e5069c1f154
Author: xinjiang 
Date:   Tue Nov 5 13:15:24 2013 +0800

GPU Calc: unit test cases for MDURATION

Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test

AMLOEXT-126 BUG

Change-Id: If308a54a79f9a093a845e53e65b9fae3b050c4e5
Signed-off-by: haochen 
Signed-off-by: I-Jui (Ray) Sung 

diff --git a/sc/qa/unit/data/xls/opencl/financial/MDuration.xls 
b/sc/qa/unit/data/xls/opencl/financial/MDuration.xls
new file mode 100644
index 000..807ca2d
Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/financial/MDuration.xls 
differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 0c575ad..e733217 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -138,6 +138,7 @@ public:
 void testFinancialAmorlincFormula();
 void testFinancialDDBFormula();
 void testFinancialFVFormula();
+void testFinancialMDurationFormula();
 CPPUNIT_TEST_SUITE(ScOpenclTest);
 CPPUNIT_TEST(testSharedFormulaXLS);
 CPPUNIT_TEST(testFinacialFormula);
@@ -205,6 +206,7 @@ public:
 CPPUNIT_TEST(testFinancialAmorlincFormula);
 CPPUNIT_TEST(testFinancialDDBFormula);
 CPPUNIT_TEST(testFinancialFVFormula);
+CPPUNIT_TEST(testFinancialMDurationFormula);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2002,6 +2004,28 @@ void ScOpenclTest:: testFinancialDuration_ADDFormula()
 xDocSh->DoClose();
 xDocShRes->DoClose();
 }
+//[AMLOEXT-126]
+void ScOpenclTest:: testFinancialMDurationFormula()
+{
+if (!detectOpenCLDevice())
+return;
+ScDocShellRef xDocSh = loadDoc("opencl/financial/MDuration.", XLS);
+ScDocument* pDoc = xDocSh->GetDocument();
+CPPUNIT_ASSERT(pDoc);
+enableOpenCL();
+pDoc->CalcAll();
+ScDocShellRef xDocShRes = loadDoc("opencl/financial/MDuration.", XLS);
+ScDocument* pDocRes = xDocShRes->GetDocument();
+CPPUNIT_ASSERT(pDocRes);
+for (SCROW i = 0; i <= 9; ++i)
+{
+double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
+double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+}
+xDocSh->DoClose();
+xDocShRes->DoClose();
+}
 //[AMLOEXT-131]
 void ScOpenclTest:: testFinancialFVFormula()
 {
commit 45e97047a23e610f93bb6023b55999b03e4bb6ea
Author: I-Jui (Ray) Sung 
Date:   Tue Nov 12 22:27:34 2013 -0600

GPU Calc: fix compilation error in calling GetNullDate()

Fix OpenCL compiler internal errors triggered by wrong # of args,
on NVIDIA.

Change-Id: Ifcc29d6fb59ac41d8e54ace348d02c942343ca5b

diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index 82fe534..0c592d5 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -365,7 +365,7 @@ void OpDISC::GenSlidingWindowFunction(
 ss<<"mode = ";
 ss << vSubArguments[4]->GenSlidingWindowDeclRef();
 ss<<";\n\t";
-ss << "int nNullDate = GetNullDate( 30 , 12 , 1899 );\n\t";
+ss << "int nNullDate = GetNullDate();\n\t";
 ss << "tmp = 1.0 - price / redemp;\n\t";
 ss << "tmp /= GetYearFrac( nNullDate , settle , maturity , mode );\n\t";
 ss << "return tmp;\n";
@@ -481,7 +481,7 @@ void OpINTRATE::GenSlidingWindowFunction(
 ss << "mode = ";
 ss << vSubArguments[4]->GenSlidingWindowDeclRef();
 ss << ";\n\t";
-ss << "int nNullDate = GetNullDate(30,12,1899);\n\t";
+ss << "int nNullDate = GetNullDate();\n\t";
 ss << "tmp = (redemp / price - 1.0) / GetYearDiff(nNullDate, settle, 
maturity, mode);\n\t";
 ss << "return tmp;\n";
 ss << "}";
@@ -678,7 +678,7 @@ void 
OpDuration_ADD::GenSlidingWindowFunction(std::stringstream& ss,
 ss << ";\n";
 }
 }
-ss << "int nNullDate = GetNullDate(30, 12, 1899);\n";
+ss << "int nNullDate = GetNullDate();\n";
 ss << "tmp = GetDuration( nNullDate, (int)arg0, (int)arg1, arg2,";
 ss << &qu

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

2013-11-12 Thread xinjiang
 sc/qa/unit/data/xls/opencl/financial/FV.xls|binary
 sc/qa/unit/data/xls/opencl/financial/MDuration.xls |binary
 sc/qa/unit/data/xls/opencl/financial/ddb.xls   |binary
 sc/qa/unit/opencl-test.cxx |   72 ++
 sc/source/core/opencl/formulagroupcl.cxx   |   14 +
 sc/source/core/opencl/op_financial.cxx |  229 -
 sc/source/core/opencl/op_financial.hxx |   34 +++
 sc/source/core/tool/token.cxx  |2 
 8 files changed, 347 insertions(+), 4 deletions(-)

New commits:
commit c396d531ad2a076885d91fa38e8c5f000cb61ea7
Author: xinjiang 
Date:   Tue Nov 5 13:15:24 2013 +0800

GPU Calc: unit test cases for MDURATION

Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test

AMLOEXT-126 BUG

Change-Id: If308a54a79f9a093a845e53e65b9fae3b050c4e5
Signed-off-by: haochen 
Signed-off-by: I-Jui (Ray) Sung 

diff --git a/sc/qa/unit/data/xls/opencl/financial/MDuration.xls 
b/sc/qa/unit/data/xls/opencl/financial/MDuration.xls
new file mode 100644
index 000..807ca2d
Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/financial/MDuration.xls 
differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 5890c62..6fd60a4 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -136,6 +136,7 @@ public:
 void testFinancialAmorlincFormula();
 void testFinancialDDBFormula();
 void testFinancialFVFormula();
+void testFinancialMDurationFormula();
 CPPUNIT_TEST_SUITE(ScOpenclTest);
 CPPUNIT_TEST(testSharedFormulaXLS);
 CPPUNIT_TEST(testFinacialFormula);
@@ -203,6 +204,7 @@ public:
 CPPUNIT_TEST(testFinancialAmorlincFormula);
 CPPUNIT_TEST(testFinancialDDBFormula);
 CPPUNIT_TEST(testFinancialFVFormula);
+CPPUNIT_TEST(testFinancialMDurationFormula);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2000,6 +2002,28 @@ void ScOpenclTest:: testFinancialDuration_ADDFormula()
 xDocSh->DoClose();
 xDocShRes->DoClose();
 }
+//[AMLOEXT-126]
+void ScOpenclTest:: testFinancialMDurationFormula()
+{
+if (!detectOpenCLDevice())
+return;
+ScDocShellRef xDocSh = loadDoc("opencl/financial/MDuration.", XLS);
+ScDocument* pDoc = xDocSh->GetDocument();
+CPPUNIT_ASSERT(pDoc);
+enableOpenCL();
+pDoc->CalcAll();
+ScDocShellRef xDocShRes = loadDoc("opencl/financial/MDuration.", XLS);
+ScDocument* pDocRes = xDocShRes->GetDocument();
+CPPUNIT_ASSERT(pDocRes);
+for (SCROW i = 0; i <= 9; ++i)
+{
+double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
+double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+}
+xDocSh->DoClose();
+xDocShRes->DoClose();
+}
 //[AMLOEXT-131]
 void ScOpenclTest:: testFinancialFVFormula()
 {
commit 63c897a672c1522896822c4a92f65c61d96872a6
Author: I-Jui (Ray) Sung 
Date:   Tue Nov 12 22:27:34 2013 -0600

GPU Calc: fix compilation error in calling GetNullDate()

Fix OpenCL compiler internal errors triggered by wrong # of args,
on NVIDIA.

Change-Id: Ifcc29d6fb59ac41d8e54ace348d02c942343ca5b

diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index 34f8ebd..30d4c85 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -365,7 +365,7 @@ void OpDISC::GenSlidingWindowFunction(
 ss<<"mode = ";
 ss << vSubArguments[4]->GenSlidingWindowDeclRef();
 ss<<";\n\t";
-ss << "int nNullDate = GetNullDate( 30 , 12 , 1899 );\n\t";
+ss << "int nNullDate = GetNullDate();\n\t";
 ss << "tmp = 1.0 - price / redemp;\n\t";
 ss << "tmp /= GetYearFrac( nNullDate , settle , maturity , mode );\n\t";
 ss << "return tmp;\n";
@@ -481,7 +481,7 @@ void OpINTRATE::GenSlidingWindowFunction(
 ss << "mode = ";
 ss << vSubArguments[4]->GenSlidingWindowDeclRef();
 ss << ";\n\t";
-ss << "int nNullDate = GetNullDate(30,12,1899);\n\t";
+ss << "int nNullDate = GetNullDate();\n\t";
 ss << "tmp = (redemp / price - 1.0) / GetYearDiff(nNullDate, settle, 
maturity, mode);\n\t";
 ss << "return tmp;\n";
 ss << "}";
@@ -678,7 +678,7 @@ void 
OpDuration_ADD::GenSlidingWindowFunction(std::stringstream& ss,
 ss << ";\n";
 }
 }
-ss << "int nNullDate = GetNullDate(30, 12, 1899);\n";
+ss << "int nNullDate = GetNullDate();\n";
 ss << "tmp = GetDuration( nNullDate, (int)arg0, (int)arg1, arg2,";
 ss << &qu

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

2013-11-12 Thread xinjiang
 sc/qa/unit/data/xls/opencl/financial/Duration_ADD.xls |binary
 sc/qa/unit/opencl-test.cxx|   25 +++
 sc/source/core/opencl/formulagroupcl.cxx  |6 +
 sc/source/core/opencl/op_financial.cxx|   60 ++
 sc/source/core/opencl/op_financial.hxx|   14 
 sc/source/core/opencl/opinlinefun_finacial.cxx|   32 +
 6 files changed, 136 insertions(+), 1 deletion(-)

New commits:
commit 163fd27708ab56baf731d9c65ccc7a5120024f45
Author: xinjiang 
Date:   Tue Nov 5 09:31:14 2013 +0800

GPU Calc: unit test cases for DURATION_ADD

Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test

AMLOEXT-121 BUG

Change-Id: Id78c89f77cdfe14d368831c22ff708b968e8fee2
Signed-off-by: haochen 
Signed-off-by: I-Jui (Ray) Sung 

diff --git a/sc/qa/unit/data/xls/opencl/financial/Duration_ADD.xls 
b/sc/qa/unit/data/xls/opencl/financial/Duration_ADD.xls
new file mode 100644
index 000..18e5ddb
Binary files /dev/null and 
b/sc/qa/unit/data/xls/opencl/financial/Duration_ADD.xls differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 69c8c3e..3ecd34c 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -133,6 +133,7 @@ public:
 void testStatisticalFormulaStandard();
 void testStatisticalFormulaWeibull();
 void testStatisticalFormulaMedian();
+void testFinancialDuration_ADDFormula();
 CPPUNIT_TEST_SUITE(ScOpenclTest);
 CPPUNIT_TEST(testSharedFormulaXLS);
 CPPUNIT_TEST(testFinacialFormula);
@@ -195,6 +196,7 @@ public:
 CPPUNIT_TEST(testStatisticalFormulaStandard);
 CPPUNIT_TEST(testStatisticalFormulaWeibull);
 CPPUNIT_TEST(testStatisticalFormulaMedian);
+CPPUNIT_TEST(testFinancialDuration_ADDFormula);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1904,7 +1906,28 @@ void ScOpenclTest:: testFinacialPPMTFormula()
 xDocSh->DoClose();
 xDocShRes->DoClose();
 }
-
+//[AMLOEXT-121]
+void ScOpenclTest:: testFinancialDuration_ADDFormula()
+{
+if (!detectOpenCLDevice())
+return;
+ScDocShellRef xDocSh = loadDoc("opencl/financial/Duration_ADD.", XLS);
+ScDocument* pDoc = xDocSh->GetDocument();
+CPPUNIT_ASSERT(pDoc);
+enableOpenCL();
+pDoc->CalcAll();
+ScDocShellRef xDocShRes = loadDoc("opencl/financial/Duration_ADD.", XLS);
+ScDocument* pDocRes = xDocShRes->GetDocument();
+CPPUNIT_ASSERT(pDocRes);
+for (SCROW i = 0; i <= 9; ++i)
+{
+double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
+double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+}
+xDocSh->DoClose();
+xDocShRes->DoClose();
+}
 ScOpenclTest::ScOpenclTest()
   : ScBootstrapFixture( "/sc/qa/unit/data" )
 {
commit 159bc70c590e2efb74fc1234480b43cff220731b
Author: xinjiang 
Date:   Tue Nov 5 09:47:10 2013 +0800

GPU Calc: implement fix for DURATION_ADD

AMLOEXT-121 FIX

Change-Id: Ie6b10eacc4e5fc0b2dcfe816982836b8b244af05
Signed-off-by: haochen 
Signed-off-by: I-Jui (Ray) Sung 

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 96e8f0f..fec3a68 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1179,6 +1179,12 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
 mvSubArguments.push_back(SoPHelper(ts, ft->Children[i],
 new OpCoupnum));
 }
+else if ( !(pChild->GetExternal().compareTo(OUString(
+   "com.sun.star.sheet.addin.Analysis.getDuration"
+{
+mvSubArguments.push_back(
+SoPHelper(ts, ft->Children[i], new OpDuration_ADD));
+}
 break;
 default:
 throw UnhandledToken(pChild, "unhandled opcode");
diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index 3597f9f..0b46835 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -574,6 +574,66 @@ void 
OpDuration::GenSlidingWindowFunction(std::stringstream& ss,
 ss << "}";
 }
 
+void OpDuration_ADD::BinInlineFun(std::set& decls,
+std::set& funs)
+{
+decls.insert(GetDurationDecl);decls.insert(lcl_GetcoupnumDecl);
+decls.insert(GetYearFracDecl);decls.insert(DaysToDateDecl);
+decls.insert(GetNullDateDecl);decls.insert(DateToDaysDecl);
+decls.insert(DaysInMonthDecl);decls.insert(IsLeapYearDecl);
+funs.insert(GetDuration);funs.insert(lcl_Getcoupnum);
+funs.insert(GetYearFrac);funs.insert(DaysToDate);
+funs.insert(GetNullDate);funs.insert(DateTo

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

2013-11-12 Thread xinjiang
 sc/qa/unit/data/xls/opencl/financial/Duration_ADD.xls |binary
 sc/qa/unit/opencl-test.cxx|   25 +++
 sc/source/core/opencl/formulagroupcl.cxx  |6 +
 sc/source/core/opencl/op_financial.cxx|   60 ++
 sc/source/core/opencl/op_financial.hxx|   14 
 sc/source/core/opencl/opinlinefun_finacial.cxx|   32 +
 6 files changed, 136 insertions(+), 1 deletion(-)

New commits:
commit 20029a72b3bb9a119e99bff7974bf6bb20e17924
Author: xinjiang 
Date:   Tue Nov 5 09:31:14 2013 +0800

GPU Calc: unit test cases for DURATION_ADD

Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test

AMLOEXT-121 BUG

Change-Id: Id78c89f77cdfe14d368831c22ff708b968e8fee2
Signed-off-by: haochen 
Signed-off-by: I-Jui (Ray) Sung 

diff --git a/sc/qa/unit/data/xls/opencl/financial/Duration_ADD.xls 
b/sc/qa/unit/data/xls/opencl/financial/Duration_ADD.xls
new file mode 100644
index 000..18e5ddb
Binary files /dev/null and 
b/sc/qa/unit/data/xls/opencl/financial/Duration_ADD.xls differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index b593174..b040e32 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -131,6 +131,7 @@ public:
 void testStatisticalFormulaStandard();
 void testStatisticalFormulaWeibull();
 void testStatisticalFormulaMedian();
+void testFinancialDuration_ADDFormula();
 CPPUNIT_TEST_SUITE(ScOpenclTest);
 CPPUNIT_TEST(testSharedFormulaXLS);
 CPPUNIT_TEST(testFinacialFormula);
@@ -193,6 +194,7 @@ public:
 CPPUNIT_TEST(testStatisticalFormulaStandard);
 CPPUNIT_TEST(testStatisticalFormulaWeibull);
 CPPUNIT_TEST(testStatisticalFormulaMedian);
+CPPUNIT_TEST(testFinancialDuration_ADDFormula);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1902,7 +1904,28 @@ void ScOpenclTest:: testFinacialPPMTFormula()
 xDocSh->DoClose();
 xDocShRes->DoClose();
 }
-
+//[AMLOEXT-121]
+void ScOpenclTest:: testFinancialDuration_ADDFormula()
+{
+if (!detectOpenCLDevice())
+return;
+ScDocShellRef xDocSh = loadDoc("opencl/financial/Duration_ADD.", XLS);
+ScDocument* pDoc = xDocSh->GetDocument();
+CPPUNIT_ASSERT(pDoc);
+enableOpenCL();
+pDoc->CalcAll();
+ScDocShellRef xDocShRes = loadDoc("opencl/financial/Duration_ADD.", XLS);
+ScDocument* pDocRes = xDocShRes->GetDocument();
+CPPUNIT_ASSERT(pDocRes);
+for (SCROW i = 0; i <= 9; ++i)
+{
+double fLibre = pDoc->GetValue(ScAddress(6, i, 0));
+double fExcel = pDocRes->GetValue(ScAddress(6, i, 0));
+CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+}
+xDocSh->DoClose();
+xDocShRes->DoClose();
+}
 ScOpenclTest::ScOpenclTest()
   : ScBootstrapFixture( "/sc/qa/unit/data" )
 {
commit 9425b3a938faf2df4d58acdcaf4437dc52ebd23c
Author: xinjiang 
Date:   Tue Nov 5 09:47:10 2013 +0800

GPU Calc: implement fix for DURATION_ADD

AMLOEXT-121 FIX

Change-Id: Ie6b10eacc4e5fc0b2dcfe816982836b8b244af05
Signed-off-by: haochen 
Signed-off-by: I-Jui (Ray) Sung 

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index c6ae8e8..6d613a4 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1179,6 +1179,12 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
 mvSubArguments.push_back(SoPHelper(ts, ft->Children[i],
 new OpCoupnum));
 }
+else if ( !(pChild->GetExternal().compareTo(OUString(
+   "com.sun.star.sheet.addin.Analysis.getDuration"
+{
+mvSubArguments.push_back(
+SoPHelper(ts, ft->Children[i], new OpDuration_ADD));
+}
 break;
 default:
 throw UnhandledToken(pChild, "unhandled opcode");
diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index cb31cd1..1db9119 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -574,6 +574,66 @@ void 
OpDuration::GenSlidingWindowFunction(std::stringstream& ss,
 ss << "}";
 }
 
+void OpDuration_ADD::BinInlineFun(std::set& decls,
+std::set& funs)
+{
+decls.insert(GetDurationDecl);decls.insert(lcl_GetcoupnumDecl);
+decls.insert(GetYearFracDecl);decls.insert(DaysToDateDecl);
+decls.insert(GetNullDateDecl);decls.insert(DateToDaysDecl);
+decls.insert(DaysInMonthDecl);decls.insert(IsLeapYearDecl);
+funs.insert(GetDuration);funs.insert(lcl_Getcoupnum);
+funs.insert(GetYearFrac);funs.insert(DaysToDate);
+funs.insert(GetNullDate);funs.insert(DateTo

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

2013-11-03 Thread xinjiang
 sc/qa/unit/data/ods/opencl/financial/Duration.ods |binary
 sc/qa/unit/opencl-test.cxx|   24 
 sc/source/core/opencl/formulagroupcl.cxx  |4 ++
 sc/source/core/opencl/op_financial.cxx|   42 ++
 sc/source/core/opencl/op_financial.hxx|   12 ++
 sc/source/core/tool/token.cxx |1 
 6 files changed, 83 insertions(+)

New commits:
commit 6f1aef5e9e3be786e6e841ad100d01a1a0744c8d
Author: xinjiang 
Date:   Mon Nov 4 11:18:04 2013 +0800

GPU Calc: implemented DURATION

AMLOEXT-111 FIX

Change-Id: I114e5b20326657f7fd3e0de7162a8ae190059b2a
Signed-off-by: haochen 
Signed-off-by: I-Jui (Ray) Sung 

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 2362cba..bc758f4 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1016,6 +1016,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
 case ocISPMT:
 mvSubArguments.push_back(SoPHelper(ts, ft->Children[i], new 
OpISPMT));
 break;
+case ocLaufz:
+mvSubArguments.push_back(SoPHelper(ts,
+ ft->Children[i], new OpDuration));
+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 f9f1fa6..a40a113 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -531,6 +531,48 @@ void OpISPMT::GenSlidingWindowFunction(std::stringstream& 
ss,
 ss << "}";
 }
 
+void OpDuration::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 tmp = " << GetBottom() << ";\n";
+ss << "int gid0 = get_global_id(0);\n";
+ss << "double arg0 = " << GetBottom() << ";\n";
+ss << "double arg1 = " << GetBottom() << ";\n";
+ss << "double arg2 = " << GetBottom() << ";\n";
+unsigned i = vSubArguments.size();
+while (i--)
+{
+FormulaToken* pCur = vSubArguments[i]->GetFormulaToken();
+assert(pCur);
+if(pCur->GetType() == formula::svSingleVectorRef)
+{
+#ifdef  ISNAN
+const formula::SingleVectorRefToken* pSVR =
+dynamic_cast< const formula::SingleVectorRefToken* >(pCur);
+ss << "if(gid0 >= " << pSVR->GetArrayLength() << " || isNan(";
+ss << vSubArguments[i]->GenSlidingWindowDeclRef();
+ss << "))\n";
+ss << "arg" << i << " = " <
Date:   Mon Nov 4 11:12:17 2013 +0800

GPU Calc: unit test cases for DURATION

AMLOEXT-111 BUG

Change-Id: I1d206b0eda0dca8254f0491399d0a4679eb39ef8
Signed-off-by: haochen 
Signed-off-by: I-Jui (Ray) Sung 

diff --git a/sc/qa/unit/data/ods/opencl/financial/Duration.ods 
b/sc/qa/unit/data/ods/opencl/financial/Duration.ods
new file mode 100644
index 000..d884dfe
Binary files /dev/null and b/sc/qa/unit/data/ods/opencl/financial/Duration.ods 
differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index d41046b..6654517 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -122,6 +122,7 @@ public:
 void testFinacialPPMTFormula();
 void testFinancialISPMTFormula();
 void testFinacialPriceFormula();
+void testFinancialDurationFormula();
 CPPUNIT_TEST_SUITE(ScOpenclTest);
 CPPUNIT_TEST(testSharedFormulaXLS);
 CPPUNIT_TEST(testFinacialFormula);
@@ -173,6 +174,7 @@ public:
 CPPUNIT_TEST(testFinacialPMTFormula);
 CPPUNIT_TEST(testFinancialISPMTFormula);
 CPPUNIT_TEST(testFinacialPriceFormula);
+CPPUNIT_TEST(testFinancialDurationFormula);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1610,6 +1612,28 @@ void ScOpenclTest:: testFinacialPMTFormula()
 xDocSh->DoClose();
 xDocShRes->DoClose();
 }
+//[AMLOEXT-111]
+void ScOpenclTest:: testFinanc

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

2013-11-03 Thread xinjiang
 sc/qa/unit/data/ods/opencl/financial/Duration.ods |binary
 sc/qa/unit/opencl-test.cxx|   24 
 sc/source/core/opencl/formulagroupcl.cxx  |4 ++
 sc/source/core/opencl/op_financial.cxx|   42 ++
 sc/source/core/opencl/op_financial.hxx|   12 ++
 sc/source/core/tool/token.cxx |1 
 6 files changed, 83 insertions(+)

New commits:
commit 0644c59f1e2822c687ef0366f6c02b3b21a3f01a
Author: xinjiang 
Date:   Mon Nov 4 11:18:04 2013 +0800

GPU Calc: implemented DURATION

AMLOEXT-111 FIX

Change-Id: I114e5b20326657f7fd3e0de7162a8ae190059b2a
Signed-off-by: haochen 
Signed-off-by: I-Jui (Ray) Sung 

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index ce3223e..24647bf 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1016,6 +1016,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
 case ocISPMT:
 mvSubArguments.push_back(SoPHelper(ts, ft->Children[i], new 
OpISPMT));
 break;
+case ocLaufz:
+mvSubArguments.push_back(SoPHelper(ts,
+ ft->Children[i], new OpDuration));
+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 f9f1fa6..a40a113 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -531,6 +531,48 @@ void OpISPMT::GenSlidingWindowFunction(std::stringstream& 
ss,
 ss << "}";
 }
 
+void OpDuration::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 tmp = " << GetBottom() << ";\n";
+ss << "int gid0 = get_global_id(0);\n";
+ss << "double arg0 = " << GetBottom() << ";\n";
+ss << "double arg1 = " << GetBottom() << ";\n";
+ss << "double arg2 = " << GetBottom() << ";\n";
+unsigned i = vSubArguments.size();
+while (i--)
+{
+FormulaToken* pCur = vSubArguments[i]->GetFormulaToken();
+assert(pCur);
+if(pCur->GetType() == formula::svSingleVectorRef)
+{
+#ifdef  ISNAN
+const formula::SingleVectorRefToken* pSVR =
+dynamic_cast< const formula::SingleVectorRefToken* >(pCur);
+ss << "if(gid0 >= " << pSVR->GetArrayLength() << " || isNan(";
+ss << vSubArguments[i]->GenSlidingWindowDeclRef();
+ss << "))\n";
+ss << "arg" << i << " = " <
Date:   Mon Nov 4 11:12:17 2013 +0800

GPU Calc: unit test cases for DURATION

AMLOEXT-111 BUG

Change-Id: I1d206b0eda0dca8254f0491399d0a4679eb39ef8
Signed-off-by: haochen 
Signed-off-by: I-Jui (Ray) Sung 

diff --git a/sc/qa/unit/data/ods/opencl/financial/Duration.ods 
b/sc/qa/unit/data/ods/opencl/financial/Duration.ods
new file mode 100644
index 000..d884dfe
Binary files /dev/null and b/sc/qa/unit/data/ods/opencl/financial/Duration.ods 
differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 7264c7e..0d228d5 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -120,6 +120,7 @@ public:
 void testFinacialPPMTFormula();
 void testFinancialISPMTFormula();
 void testFinacialPriceFormula();
+void testFinancialDurationFormula();
 CPPUNIT_TEST_SUITE(ScOpenclTest);
 CPPUNIT_TEST(testSharedFormulaXLS);
 CPPUNIT_TEST(testFinacialFormula);
@@ -171,6 +172,7 @@ public:
 CPPUNIT_TEST(testFinacialPMTFormula);
 CPPUNIT_TEST(testFinancialISPMTFormula);
 CPPUNIT_TEST(testFinacialPriceFormula);
+CPPUNIT_TEST(testFinancialDurationFormula);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1608,6 +1610,28 @@ void ScOpenclTest:: testFinacialPMTFormula()
 xDocSh->DoClose();
 xDocShRes->DoClose();
 }
+//[AMLOEXT-111]
+void ScOpenclTest:: testFinanc

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

2013-11-03 Thread xinjiang
 sc/qa/unit/data/xls/opencl/financial/ISPMT.xls |binary
 sc/qa/unit/opencl-test.cxx |   24 +
 sc/source/core/opencl/formulagroupcl.cxx   |3 +
 sc/source/core/opencl/op_financial.cxx |   45 +
 sc/source/core/opencl/op_financial.hxx |   11 ++
 sc/source/core/tool/token.cxx  |1 
 6 files changed, 84 insertions(+)

New commits:
commit 2cfd2307ac641f251dc3276f12b32b5a617cef24
Author: xinjiang 
Date:   Mon Nov 4 10:40:51 2013 +0800

GPU Calc: implemented ISPMT in GPU calc

AMLOEXT-99 FIX

Change-Id: I8cd9f130c190e6925873a00579cb7c334201f418
Signed-off-by: haochen 
Signed-off-by: I-Jui (Ray) Sung 

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index b4bb0f9..b47e192 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1013,6 +1013,9 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
 case ocCosecant:
 mvSubArguments.push_back(SoPHelper(ts, ft->Children[i], new 
OpCsc));
 break;
+case ocISPMT:
+mvSubArguments.push_back(SoPHelper(ts, ft->Children[i], new 
OpISPMT));
+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 329dd77..503087b 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -487,6 +487,51 @@ void OpINTRATE::GenSlidingWindowFunction(
 ss << "}";
 }
 
+void OpISPMT::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 tmp = " << GetBottom() << ";\n";
+ss << "int gid0 = get_global_id(0);\n";
+ss << "double arg0 = " << GetBottom() << ";\n";
+ss << "double arg1 = " << GetBottom() << ";\n";
+ss << "double arg2 = " << GetBottom() << ";\n";
+ss << "double arg3 = " << GetBottom() << ";\n";
+unsigned i = vSubArguments.size();
+while (i--)
+{
+FormulaToken* pCur = vSubArguments[i]->GetFormulaToken();
+assert(pCur);
+if(pCur->GetType() == formula::svSingleVectorRef)
+{
+#ifdef  ISNAN
+const formula::SingleVectorRefToken* pSVR =
+dynamic_cast< const formula::SingleVectorRefToken* >(pCur);
+ss << "if(gid0 >= " << pSVR->GetArrayLength() << " || isNan(";
+ss << vSubArguments[i]->GenSlidingWindowDeclRef();
+ss << "))\n";
+ss << "arg" << i << " = " <
Date:   Mon Nov 4 10:36:28 2013 +0800

GPU Calc: unit test cases for ISPMT in GPU calc

AMLOEXT-99 BUG

Change-Id: I4388b184b23cf616dacfb20c61d2295765925ede
Signed-off-by: haochen 
Signed-off-by: I-Jui (Ray) Sung 

diff --git a/sc/qa/unit/data/xls/opencl/financial/ISPMT.xls 
b/sc/qa/unit/data/xls/opencl/financial/ISPMT.xls
new file mode 100644
index 000..8759e7e
Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/financial/ISPMT.xls 
differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 043c99f..dd3630e 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -120,6 +120,7 @@ public:
 void testFinacialYIELDMATFormula();
 void testFinacialPMTFormula();
 void testFinacialPPMTFormula();
+void testFinancialISPMTFormula();
 CPPUNIT_TEST_SUITE(ScOpenclTest);
 CPPUNIT_TEST(testSharedFormulaXLS);
 CPPUNIT_TEST(testFinacialFormula);
@@ -169,6 +170,7 @@ public:
 CPPUNIT_TEST(testFinacialYIELDMATFormula);
 CPPUNIT_TEST(testFinacialPPMTFormula);
 CPPUNIT_TEST(testFinacialPMTFormula);
+CPPUNIT_TEST(testFinancialISPMTFormula);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1260,6 +1262,28 @@ void ScOpenclTest::testFinacialXNPVFormula()
 xDocSh->DoClose();
 xDocShRes->DoClose();
 }
+//[AMLOEXT-99]
+

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

2013-11-03 Thread xinjiang
 sc/qa/unit/data/xls/opencl/financial/ISPMT.xls |binary
 sc/qa/unit/opencl-test.cxx |   24 +
 sc/source/core/opencl/formulagroupcl.cxx   |3 +
 sc/source/core/opencl/op_financial.cxx |   45 +
 sc/source/core/opencl/op_financial.hxx |   11 ++
 sc/source/core/tool/token.cxx  |1 
 6 files changed, 84 insertions(+)

New commits:
commit 1c239f51064e30713ac87abd3697d73bc5e5bcc1
Author: xinjiang 
Date:   Mon Nov 4 10:40:51 2013 +0800

GPU Calc: implemented ISPMT in GPU calc

AMLOEXT-99 FIX

Change-Id: I8cd9f130c190e6925873a00579cb7c334201f418
Signed-off-by: haochen 
Signed-off-by: I-Jui (Ray) Sung 

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index d4dada6..9610a4a 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1013,6 +1013,9 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
 case ocCosecant:
 mvSubArguments.push_back(SoPHelper(ts, ft->Children[i], new 
OpCsc));
 break;
+case ocISPMT:
+mvSubArguments.push_back(SoPHelper(ts, ft->Children[i], new 
OpISPMT));
+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 329dd77..503087b 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -487,6 +487,51 @@ void OpINTRATE::GenSlidingWindowFunction(
 ss << "}";
 }
 
+void OpISPMT::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 tmp = " << GetBottom() << ";\n";
+ss << "int gid0 = get_global_id(0);\n";
+ss << "double arg0 = " << GetBottom() << ";\n";
+ss << "double arg1 = " << GetBottom() << ";\n";
+ss << "double arg2 = " << GetBottom() << ";\n";
+ss << "double arg3 = " << GetBottom() << ";\n";
+unsigned i = vSubArguments.size();
+while (i--)
+{
+FormulaToken* pCur = vSubArguments[i]->GetFormulaToken();
+assert(pCur);
+if(pCur->GetType() == formula::svSingleVectorRef)
+{
+#ifdef  ISNAN
+const formula::SingleVectorRefToken* pSVR =
+dynamic_cast< const formula::SingleVectorRefToken* >(pCur);
+ss << "if(gid0 >= " << pSVR->GetArrayLength() << " || isNan(";
+ss << vSubArguments[i]->GenSlidingWindowDeclRef();
+ss << "))\n";
+ss << "arg" << i << " = " <
Date:   Mon Nov 4 10:36:28 2013 +0800

GPU Calc: unit test cases for ISPMT in GPU calc

AMLOEXT-99 BUG

Change-Id: I4388b184b23cf616dacfb20c61d2295765925ede
Signed-off-by: haochen 
Signed-off-by: I-Jui (Ray) Sung 

diff --git a/sc/qa/unit/data/xls/opencl/financial/ISPMT.xls 
b/sc/qa/unit/data/xls/opencl/financial/ISPMT.xls
new file mode 100644
index 000..8759e7e
Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/financial/ISPMT.xls 
differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index c8cf326..dd626cd 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -118,6 +118,7 @@ public:
 void testFinacialYIELDMATFormula();
 void testFinacialPMTFormula();
 void testFinacialPPMTFormula();
+void testFinancialISPMTFormula();
 CPPUNIT_TEST_SUITE(ScOpenclTest);
 CPPUNIT_TEST(testSharedFormulaXLS);
 CPPUNIT_TEST(testFinacialFormula);
@@ -167,6 +168,7 @@ public:
 CPPUNIT_TEST(testFinacialYIELDMATFormula);
 CPPUNIT_TEST(testFinacialPPMTFormula);
 CPPUNIT_TEST(testFinacialPMTFormula);
+CPPUNIT_TEST(testFinancialISPMTFormula);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1258,6 +1260,28 @@ void ScOpenclTest::testFinacialXNPVFormula()
 xDocSh->DoClose();
 xDocShRes->DoClose();
 }
+//[AMLOEXT-99]
+