summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortianyao <tianyao@multicorewareinc.com>2013-11-09 12:08:15 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-14 14:09:48 -0600
commit02d28b8cca5f4ed635b003bce75d37bff18eed3a (patch)
tree6515fe5b60195e099ab2354bce7db97860ebd4b4
parent52a17171d45ce25177277a569e78ee9318f705bf (diff)
GPU Calc: implemented CSCH
AMLOEXT-106 FIX Change-Id: Ib03ddf99705424001971c5080baf998236b2e48e 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.cxx28
-rw-r--r--sc/source/core/opencl/op_math.hxx7
3 files changed, 39 insertions, 0 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index e25ce6bed3cd..5b5cd478b848 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1257,6 +1257,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i], new OpBetaDist));
break;
+ case ocCosecantHyp:
+ mvSubArguments.push_back(SoPHelper(ts,
+ ft->Children[i], new OpCscH));
+ 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 ab556d95c510..5b6857b240af 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -232,6 +232,34 @@ void OpSumIfs::GenSlidingWindowFunction(std::stringstream &ss,
ss << "return tmp;\n";
ss << "}";
}
+void OpCscH::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\t";
+ ss <<"int gid0=get_global_id(0);\n\t";
+ ss << "double arg0 = " << vSubArguments[0]->GenSlidingWindowDeclRef();
+ ss << ";\n\t";
+#ifdef ISNAN
+ ss<< "if(isNan(arg0)||(gid0>=";
+ ss<<tmpCurDVR->GetArrayLength();
+ ss<<"))\n\t\t";
+ ss<<"arg0 = 0;\n\t";
+#endif
+ ss << "double tmp=1/sinh(arg0);\n\t";
+ ss << "return tmp;\n";
+ ss << "}";
+}
void OpSinh::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 22f70c9352cd..0772245bc075 100644
--- a/sc/source/core/opencl/op_math.hxx
+++ b/sc/source/core/opencl/op_math.hxx
@@ -204,6 +204,13 @@ public:
const std::string sSymName, SubArguments &vSubArguments);
virtual std::string BinFuncName(void) const { return "Floor"; }
};
+class OpCscH: public Normal
+{
+public:
+ virtual void GenSlidingWindowFunction(std::stringstream &ss,
+ const std::string sSymName, SubArguments &vSubArguments);
+ virtual std::string BinFuncName(void) const { return "CscH"; }
+};
}}
#endif