sc/qa/unit/data/xls/opencl/math/sinh.xls |binary
 sc/qa/unit/opencl-test.cxx               |   20 ++++++++++++++++++++
 sc/source/core/opencl/formulagroupcl.cxx |    3 +++
 sc/source/core/opencl/op_math.cxx        |   31 +++++++++++++++++++++++++++++++
 sc/source/core/opencl/op_math.hxx        |    7 +++++++
 sc/source/core/tool/token.cxx            |    1 +
 solenv/gbuild/platform/com_MSC_defs.mk   |    2 +-
 7 files changed, 63 insertions(+), 1 deletion(-)

New commits:
commit 75240ea50fcbc6e66297948614e2cb2e9a6c0b2d
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Mon Nov 4 00:27:53 2013 +0100

    add original PATH to PATH during unit tests
    
    we need this for our opencl tests to be able to execute the opencl compiler 
during the test
    
    Change-Id: I9f9e8f3ceb26ff62789d888e6eb9f4f94010bb1f

diff --git a/solenv/gbuild/platform/com_MSC_defs.mk 
b/solenv/gbuild/platform/com_MSC_defs.mk
index b57dad0..de82c9f 100644
--- a/solenv/gbuild/platform/com_MSC_defs.mk
+++ b/solenv/gbuild/platform/com_MSC_defs.mk
@@ -296,6 +296,6 @@ gb_LTOFLAGS := $(if $(filter TRUE,$(ENABLE_LTO)),-GL)
 gb_Helper_OUTDIRLIBDIR := $(OUTDIR)/bin
 
 # need windows path with backslashes here
-gb_Helper_set_ld_path := PATH="$(shell cygpath -w $(OUTDIR)/bin);$(shell 
cygpath -w $(INSTDIR)/$(LIBO_URE_LIB_FOLDER));$(shell cygpath -w 
$(INSTDIR)/$(LIBO_BIN_FOLDER))"
+gb_Helper_set_ld_path := PATH="$(PATH);$(shell cygpath -w 
$(OUTDIR)/bin);$(shell cygpath -w $(INSTDIR)/$(LIBO_URE_LIB_FOLDER));$(shell 
cygpath -w $(INSTDIR)/$(LIBO_BIN_FOLDER))"
 
 # vim: set noet sw=4:
commit 9cde31bff56cc489ef86999d5816fc698a31f0ba
Author: dechuang <dechu...@multicorewareinc.com>
Date:   Mon Nov 4 14:35:12 2013 +0800

    GPU Calc: implement fix for SINH
    
    AMLOEXT-116 FIX
    
    Change-Id: I0c369a65ffb3de2ac91fdd3d04ca6afe658b9bee
    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 07ea246..3e80351 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1020,6 +1020,9 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
                 mvSubArguments.push_back(SoPHelper(ts,
                          ft->Children[i], new OpDuration));
                 break;
+            case ocSinHyp:
+                mvSubArguments.push_back(SoPHelper(ts,
+                         ft->Children[i],new OpSinh));
             case ocExternal:
                 if ( !(pChild->GetExternal().compareTo(OUString(
                     "com.sun.star.sheet.addin.Analysis.getEffect"))))
diff --git a/sc/source/core/opencl/op_math.cxx 
b/sc/source/core/opencl/op_math.cxx
index 33ca0e5..32d2eb5 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -80,6 +80,37 @@ void OpCsc::GenSlidingWindowFunction(
     ss << "}";
 }
 
+void OpSinh::GenSlidingWindowFunction(std::stringstream &ss,
+            const std::string sSymName, SubArguments &vSubArguments)
+{
+    FormulaToken *tmpCur = vSubArguments[0]->GetFormulaToken();
+    const formula::SingleVectorRefToken*tmpCurDVR= dynamic_cast<const
+              formula::SingleVectorRefToken *>(tmpCur);
+    ss << "\ndouble " << sSymName;
+    ss << "_"<< BinFuncName() <<"(";
+    for (unsigned i = 0; i < vSubArguments.size(); i++)
+    {
+        if (i)
+            ss << ",";
+        vSubArguments[i]->GenSlidingWindowDecl(ss);
+    }
+    ss <<") {\n";
+    ss <<"    int gid0=get_global_id(0);\n";
+    ss <<"    double arg0 = " <<
+        vSubArguments[0]->GenSlidingWindowDeclRef();
+    ss <<";\n";
+#ifdef ISNAN
+    ss<< "    if(isNan(arg0)||(gid0>=";
+    ss<<tmpCurDVR->GetArrayLength();
+    ss<<"))\n";
+    ss<<"        arg0 = 0;\n";
+#endif
+    ss << "    double tmp=( exp(arg0)-exp(-arg0) )/2;\n";
+    ss << "    return tmp;\n";
+    ss << "}";
+}
+
+
 }}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/opencl/op_math.hxx 
b/sc/source/core/opencl/op_math.hxx
index dd497fb..7399a6a 100644
--- a/sc/source/core/opencl/op_math.hxx
+++ b/sc/source/core/opencl/op_math.hxx
@@ -31,6 +31,13 @@ public:
     virtual std::string BinFuncName(void) const { return "Csc"; }
 };
 
+class OpSinh: public Normal
+{
+public:
+    virtual void GenSlidingWindowFunction(std::stringstream &ss,
+            const std::string sSymName, SubArguments &vSubArguments);
+    virtual std::string BinFuncName(void) const { return "Sinh"; }
+};
 }}
 
 #endif
commit 1f94fc3cd5f35c952d496a500272d9138e553c7e
Author: dechuang <dechu...@multicorewareinc.com>
Date:   Mon Nov 4 14:23:11 2013 +0800

    GPU Calc: unit test cases for SINH
    
    Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test
    
    AMLOEXT-116 BUG
    
    Change-Id: Ic3cf18c9b475bc37bdca40cb64c582742bba8a5a
    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/sinh.xls 
b/sc/qa/unit/data/xls/opencl/math/sinh.xls
new file mode 100644
index 0000000..1a960b2
Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/math/sinh.xls differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 9199a5d..f0d1e88 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -124,6 +124,7 @@ public:
     void testFinacialPriceFormula();
     void testFinancialDurationFormula();
     void testFinancialCoupnumFormula();
+    void testMathFormulaSinh();
     CPPUNIT_TEST_SUITE(ScOpenclTest);
     CPPUNIT_TEST(testSharedFormulaXLS);
     CPPUNIT_TEST(testFinacialFormula);
@@ -177,6 +178,7 @@ public:
     CPPUNIT_TEST(testFinacialPriceFormula);
     CPPUNIT_TEST(testFinancialDurationFormula);
     CPPUNIT_TEST(testFinancialCoupnumFormula);
+    CPPUNIT_TEST(testMathFormulaSinh);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -473,6 +475,24 @@ void ScOpenclTest::testMathFormulaCos()
     xDocSh->DoClose();
     xDocShRes->DoClose();
 }
+//[AMLOEXT-116]
+void ScOpenclTest::testMathFormulaSinh()
+{
+    ScDocShellRef xDocSh = loadDoc("opencl/math/sinh.", XLS);
+    enableOpenCL();   ScDocument* pDoc = xDocSh->GetDocument();
+    CPPUNIT_ASSERT(pDoc);   xDocSh->DoHardRecalc(true);
+    ScDocShellRef xDocShRes = loadDoc("opencl/math/sinh.", XLS);
+    ScDocument* pDocRes = xDocShRes->GetDocument();
+    CPPUNIT_ASSERT(pDocRes);
+    for (SCROW i = 0; i <= 15; ++i)
+    {
+        double fLibre = pDoc->GetValue(ScAddress(1,i,0));
+        double fExcel = pDocRes->GetValue(ScAddress(1,i,0));
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+    }
+    xDocSh->DoClose();
+    xDocShRes->DoClose();
+}
 
 void ScOpenclTest::testFinacialFormula()
 {
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 5845c63..6333abb 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1368,6 +1368,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
             case ocCosecantHyp:
             case ocISPMT:
             case ocLaufz:
+            case ocSinHyp:
             // Don't change the state.
             break;
             default:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to