summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-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 ada65df24d34..dd6b169ec334 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1084,6 +1084,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i],new OpNormdist));
break;
+ case ocArcCos:
+ mvSubArguments.push_back(SoPHelper(ts,
+ ft->Children[i], new OpArcCos));
+ 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 a24872e4cff1..b54ee0f2408b 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -234,6 +234,34 @@ void OpAbs::GenSlidingWindowFunction(std::stringstream &ss,
ss << " return fabs(tmp);\n";
ss << "}";
}
+void OpArcCos::GenSlidingWindowFunction(std::stringstream &ss,
+ const std::string sSymName, SubArguments &vSubArguments)
+{
+ 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 tmp = " << GetBottom() << ";\n";
+#ifdef ISNAN
+ FormulaToken *tmpCur0 = vSubArguments[0]->GetFormulaToken();
+ const formula::SingleVectorRefToken*tmpCurDVR0=
+ dynamic_cast<const formula::SingleVectorRefToken *>(tmpCur0);
+ ss << " int buffer_len = "<< tmpCurDVR0->GetArrayLength()<< ";\n";
+ ss << " if((gid0)>=buffer_len || isNan(";
+ ss << vSubArguments[0]->GenSlidingWindowDeclRef()<< "))\n";
+ ss << " tmp = " << GetBottom() << ";\n";
+ ss << " else \n ";
+#endif
+ ss << " tmp = ";
+ ss << vSubArguments[0]->GenSlidingWindowDeclRef()<< ";\n";
+ ss << " return acos(tmp);\n";
+ ss << "}";
+}
void OpTan::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 d6dda45a4549..e888849d9334 100644
--- a/sc/source/core/opencl/op_math.hxx
+++ b/sc/source/core/opencl/op_math.hxx
@@ -58,6 +58,13 @@ public:
virtual std::string GetBottom(void) { return "0.0"; }
virtual std::string BinFuncName(void) const { return "ScAbs"; }
};
+class OpArcCos:public Normal{
+public:
+ virtual void GenSlidingWindowFunction(std::stringstream &ss,
+ const std::string sSymName, SubArguments &vSubArguments);
+ virtual std::string GetBottom(void) { return "0.0"; }
+ virtual std::string BinFuncName(void) const { return "ScACos"; }
+};
class OpTan: public Normal
{
public: