diff options
author | haochen <haochen@multicorewareinc.com> | 2013-10-24 14:57:47 +0800 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-10-29 17:00:10 -0400 |
commit | e409cd02e5956173aabb1374205526c85c8ca3a5 (patch) | |
tree | 21e91d418f284ca5331fb016491338fa56c8dba2 | |
parent | e2582e2a12901097666a2e2cb2c0b2609a3bca91 (diff) |
Implement GAUSS in GPU Calc
Change-Id: I5a33caf39fc0c21a7050f2180589bb67ba1ed08c
Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
-rw-r--r-- | sc/source/core/opencl/OP_Statistical.cxx | 32 | ||||
-rw-r--r-- | sc/source/core/opencl/formulagroupcl.cxx | 4 |
2 files changed, 36 insertions, 0 deletions
diff --git a/sc/source/core/opencl/OP_Statistical.cxx b/sc/source/core/opencl/OP_Statistical.cxx index 7a23250b0294..20c12aa2ab37 100644 --- a/sc/source/core/opencl/OP_Statistical.cxx +++ b/sc/source/core/opencl/OP_Statistical.cxx @@ -144,6 +144,38 @@ formula::SingleVectorRefToken *>(tmpCur); virtual std::string BinFuncName(void) const { return "GammaLn"; } }; +class OpGauss: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=0.5 *erfc(-arg0 * 0.7071067811865475)-0.5;\n\t"; + ss << "return tmp;\n"; + ss << "}\n"; + } + virtual std::string BinFuncName(void) const { return "Gauss"; } +}; }} #endif diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 335435290b48..7afc4ebece39 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -561,7 +561,11 @@ DynamicKernelSoPArguments<Op>::DynamicKernelSoPArguments(const std::string &s, mvSubArguments.push_back(SoPHelper<OpGammaLn>(ts, ft->Children[i])); break; + case ocGauss: + mvSubArguments.push_back(SoPHelper<OpGauss>(ts, + ft->Children[i])); break; + case ocExternal: if ( !(pChild->GetExternal().compareTo(OUString( "com.sun.star.sheet.addin.Analysis.getEffect")))) |