summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhaochen <haochen@multicorewareinc.com>2013-10-23 15:32:19 +0800
committerKohei Yoshida <kohei.yoshida@collabora.com>2013-10-29 17:00:05 -0400
commitcc9765be821bf7c6f3d503375e835ec0b3e23bae (patch)
tree2faa8a4cd4735db0ac5ce95bc6f3af42c98b62ff
parentcfa655db546bb9672263d5116819fbbbf669ce96 (diff)
Implement FISHER in GPU Calc interpreter
Change-Id: I2c56f330107d71b36d79b19cabf5cfc53c22617c Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
-rw-r--r--sc/source/core/opencl/OP_Statistical.cxx39
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx3
2 files changed, 40 insertions, 2 deletions
diff --git a/sc/source/core/opencl/OP_Statistical.cxx b/sc/source/core/opencl/OP_Statistical.cxx
index 2569400aa46b..ee620cad1d6e 100644
--- a/sc/source/core/opencl/OP_Statistical.cxx
+++ b/sc/source/core/opencl/OP_Statistical.cxx
@@ -17,6 +17,41 @@
using namespace formula;
namespace sc { namespace opencl {
+ #define ISNAN
+class OpFisher:public Normal{
+ public:
+ virtual void 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\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=atanh(arg0);\n\t";
+ ss << "return tmp;\n";
+ ss << "}\n";
+ }
+ virtual std::string BinFuncName(void) const { return "Fisher"; }
+};
-}}
-#endif \ No newline at end of file
+}
+}
+
+#endif
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index cc8fb5b26ee5..a11093aa9d7c 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -504,6 +504,9 @@ DynamicKernelSoPArguments<Op>::DynamicKernelSoPArguments(const std::string &s,
case ocKapz:
mvSubArguments.push_back(SoPHelper<OpPPMT>(ts, ft->Children[i]));
break;
+ case ocFisher:
+ mvSubArguments.push_back(SoPHelper<OpFisher>(ts, ft->Children[i]));
+ break;
case ocExternal:
if ( !(pChild->GetExternal().compareTo(OUString(
"com.sun.star.sheet.addin.Analysis.getEffect"))))