summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorzhenyu yuan <zhenyuyuan@multicorewareinc.com>2013-11-06 17:01:36 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-13 17:44:08 -0600
commit90ce20aebcd090e10e0820f175e09c11ae437dda (patch)
tree0bfc08068b15e2eee33a4087e661d4a13ff67fa4 /sc
parent7db412400b24eec53b6030974551edbbb35ab89d (diff)
GPU Calc: implemented COSH
AMLOEXT-85 FIX Change-Id: Ie2110026b35d9ffade209e0e3c31f7a868e56f03 Signed-off-by: haochen <haochen@multicorewareinc.com> Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx4
-rw-r--r--sc/source/core/opencl/op_math.cxx29
-rw-r--r--sc/source/core/opencl/op_math.hxx8
3 files changed, 41 insertions, 0 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 96e15d3c62f5..d1884697ec92 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1148,6 +1148,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i], new OpArcCot));
break;
+ case ocCosHyp:
+ mvSubArguments.push_back(SoPHelper(ts,
+ ft->Children[i], new OpCosh));
+ break;
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 04065d44e1ac..a7f237a90e23 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -51,6 +51,35 @@ void OpCos::GenSlidingWindowFunction(std::stringstream &ss,
ss << "}";
}
+void OpCosh::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{\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=cosh(arg0);\n";
+ ss << " return tmp;\n";
+ ss << "}";
+}
+
void OpCsc::GenSlidingWindowFunction(
std::stringstream &ss, const std::string sSymName, SubArguments &vSubArguments)
{
diff --git a/sc/source/core/opencl/op_math.hxx b/sc/source/core/opencl/op_math.hxx
index 9dc1a45b69f8..58e131d0a108 100644
--- a/sc/source/core/opencl/op_math.hxx
+++ b/sc/source/core/opencl/op_math.hxx
@@ -37,6 +37,14 @@ public:
const std::string sSymName, SubArguments &vSubArguments);
virtual std::string BinFuncName(void) const { return "SumIfs"; }
};
+class OpCosh: public Normal
+{
+public:
+ virtual void GenSlidingWindowFunction(std::stringstream &ss,
+ const std::string sSymName, SubArguments &vSubArguments);
+
+ virtual std::string BinFuncName(void) const { return "Cosh"; }
+};
class OpSinh: public Normal
{
public: