summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhenyu yuan <zhenyuyuan@multicorewareinc.com>2013-11-07 15:43:16 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-14 14:09:40 -0600
commit76af0bf451db99c0549f360f0fb3b6bf5d5ef07a (patch)
treef18d8a35732de7daa55634c337dba5dfbf862ffe
parente4be59b2b15cd6a52a7833e12fe3af8ba9f8330c (diff)
GPU Calc: implemented COTH
AMLOEXT-91 FIX Change-Id: I27b885734f926dc3ca8a8375efcfe281e17b2adb 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.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 3e4f79f09ad4..ae1deb1d0220 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1204,6 +1204,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i], new OpCot));
break;
+ case ocCotHyp:
+ mvSubArguments.push_back(SoPHelper(ts,
+ ft->Children[i], new OpCoth));
+ 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 46c990fac22a..3dda88bf11d1 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -109,6 +109,35 @@ void OpCot::GenSlidingWindowFunction(std::stringstream &ss,
ss << "}";
}
+void OpCoth::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=1/tanh(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 1f6beec707d8..1dbcc1babdc9 100644
--- a/sc/source/core/opencl/op_math.hxx
+++ b/sc/source/core/opencl/op_math.hxx
@@ -175,6 +175,14 @@ public:
virtual std::string BinFuncName(void) const { return "Cot"; }
};
+class OpCoth: public Normal
+{
+public:
+ virtual void GenSlidingWindowFunction(std::stringstream &ss,
+ const std::string sSymName, SubArguments &vSubArguments);
+
+ virtual std::string BinFuncName(void) const { return "Coth"; }
+};
}}
#endif