summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhaochen <haochen@multicorewareinc.com>2013-10-23 15:51:52 +0800
committerKohei Yoshida <kohei.yoshida@collabora.com>2013-10-29 17:00:05 -0400
commit951baee0b38c14dd6a0d00585a050f0fcdb3ecd2 (patch)
treeba8d6a769cab714387e9d361ce811435344d87cf
parent831c570e33cba22e478a1fabfc0e4d34e3260011 (diff)
Implement FISHERINV in GPU Calc
Change-Id: Ica0e40772085530436e9659a692e8111299fad7b Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
-rw-r--r--sc/source/core/opencl/OP_Statistical.cxx36
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx34
2 files changed, 58 insertions, 12 deletions
diff --git a/sc/source/core/opencl/OP_Statistical.cxx b/sc/source/core/opencl/OP_Statistical.cxx
index ee620cad1d6e..befb45a1158a 100644
--- a/sc/source/core/opencl/OP_Statistical.cxx
+++ b/sc/source/core/opencl/OP_Statistical.cxx
@@ -51,7 +51,39 @@ class OpFisher:public Normal{
virtual std::string BinFuncName(void) const { return "Fisher"; }
};
-}
-}
+class OpFisherInv: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=tanh(arg0);\n\t";
+ ss << "return tmp;\n";
+ ss << "}\n";
+ }
+ virtual std::string BinFuncName(void) const { return "FisherInv"; }
+};
+}}
#endif
+
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index a11093aa9d7c..6f52454f2bb8 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -456,27 +456,34 @@ DynamicKernelSoPArguments<Op>::DynamicKernelSoPArguments(const std::string &s,
}
break;
case ocDiv:
- mvSubArguments.push_back(SoPHelper<OpDiv>(ts, ft->Children[i]));
+ mvSubArguments.push_back(SoPHelper<OpDiv>(ts,
+ ft->Children[i]));
break;
case ocMul:
- mvSubArguments.push_back(SoPHelper<OpMul>(ts, ft->Children[i]));
+ mvSubArguments.push_back(SoPHelper<OpMul>(ts,
+ ft->Children[i]));
break;
case ocSub:
- mvSubArguments.push_back(SoPHelper<OpSub>(ts, ft->Children[i]));
+ mvSubArguments.push_back(SoPHelper<OpSub>(ts,
+ ft->Children[i]));
break;
case ocAdd:
case ocSum:
case ocAverage:
- mvSubArguments.push_back(SoPHelper<OpSum>(ts, ft->Children[i]));
+ mvSubArguments.push_back(SoPHelper<OpSum>(ts,
+ ft->Children[i]));
break;
case ocMin:
- mvSubArguments.push_back(SoPHelper<OpMin>(ts, ft->Children[i]));
+ mvSubArguments.push_back(SoPHelper<OpMin>(ts,
+ ft->Children[i]));
break;
case ocMax:
- mvSubArguments.push_back(SoPHelper<OpMax>(ts, ft->Children[i]));
+ mvSubArguments.push_back(SoPHelper<OpMax>(ts,
+ ft->Children[i]));
break;
case ocCount:
- mvSubArguments.push_back(SoPHelper<OpCount>(ts, ft->Children[i]));
+ mvSubArguments.push_back(SoPHelper<OpCount>(ts,
+ ft->Children[i]));
break;
case ocSumProduct:
mvSubArguments.push_back(SoPHelper<OpSumProduct>(ts,
@@ -499,13 +506,20 @@ DynamicKernelSoPArguments<Op>::DynamicKernelSoPArguments(const std::string &s,
ft->Children[i]));
break;
case ocZGZ:
- mvSubArguments.push_back(SoPHelper<OpRRI>(ts, ft->Children[i]));
+ mvSubArguments.push_back(SoPHelper<OpRRI>(ts,
+ ft->Children[i]));
break;
case ocKapz:
- mvSubArguments.push_back(SoPHelper<OpPPMT>(ts, ft->Children[i]));
+ mvSubArguments.push_back(SoPHelper<OpPPMT>(ts,
+ ft->Children[i]));
break;
case ocFisher:
- mvSubArguments.push_back(SoPHelper<OpFisher>(ts, ft->Children[i]));
+ mvSubArguments.push_back(SoPHelper<OpFisher>(ts,
+ ft->Children[i]));
+ break;
+ case ocFisherInv:
+ mvSubArguments.push_back(SoPHelper<OpFisherInv>(ts,
+ ft->Children[i]));
break;
case ocExternal:
if ( !(pChild->GetExternal().compareTo(OUString(