summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordechuang <dechuang@multicorewareinc.com>2013-11-04 14:35:12 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-04 00:58:55 -0600
commitb5c268388ddbc812c2ba07a196f1200a939c6a9a (patch)
tree0974e9e545648a2666401aa71a90ceb94c3c3596
parentcd4d44e5e8b540816ed7757e243f01256418b43e (diff)
GPU Calc: implement fix for SINH
AMLOEXT-116 FIX Change-Id: I0c369a65ffb3de2ac91fdd3d04ca6afe658b9bee Signed-off-by: haochen <haochen@multicorewareinc.com> Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx3
-rw-r--r--sc/source/core/opencl/op_math.cxx31
-rw-r--r--sc/source/core/opencl/op_math.hxx7
3 files changed, 41 insertions, 0 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 1cc0b9f48a95..f0fd68ba2e2a 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 33ca0e51f43f..32d2eb588a96 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 dd497fbf3a58..7399a6a8c016 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