summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormulei <mulei@multicorewareinc.com>2013-12-16 11:58:41 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-12-19 17:54:02 -0600
commitc46a3b6c78e56b64f1c36a257143abded69af370 (patch)
treea0a6f5404e00f530da30529bccbf05227aea538a
parentbfef2c95524bdb7ad8f6c6271e8858acd4585e25 (diff)
GPU Calc: implemented SECH
AMLOEXT-368 FIX Change-Id: I8c0bece5ec12cd6def88431cf1d075d542369ca4 Signed-off-by: haochen <haochen@multicorewareinc.com> Signed-off-by: Wei Wei <weiwei@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.cxx28
-rw-r--r--sc/source/core/opencl/op_math.hxx8
3 files changed, 39 insertions, 1 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 98661689b4be..c42dd4999366 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -2581,6 +2581,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i], new OpSec));
break;
+ case ocSecantHyp:
+ mvSubArguments.push_back(SoPHelper(ts,
+ ft->Children[i], new OpSecH));
+ 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 3a68fc62e748..e109b039a5f2 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -84,7 +84,33 @@ void OpCosh::BinInlineFun(std::set<std::string>& decls,
decls.insert(local_coshDecl);
funs.insert(local_cosh);
}
-
+void OpSecH::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 << " return pow(cosh(arg0),-1 );\n";
+ ss << "}";
+}
void OpCosh::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 057df6571172..b1d95f6f3240 100644
--- a/sc/source/core/opencl/op_math.hxx
+++ b/sc/source/core/opencl/op_math.hxx
@@ -30,6 +30,14 @@ public:
virtual std::string BinFuncName(void) const { return "Sec"; }
};
+class OpSecH: public Normal
+{
+public:
+ virtual void GenSlidingWindowFunction(std::stringstream &ss,
+ const std::string sSymName, SubArguments &vSubArguments);
+
+ virtual std::string BinFuncName(void) const { return "SecH"; }
+};
class OpCsc: public Normal
{
public: