diff options
author | tianyao <tianyao@multicorewareinc.com> | 2013-11-09 12:25:38 +0800 |
---|---|---|
committer | I-Jui (Ray) Sung <ray@multicorewareinc.com> | 2013-11-14 14:09:49 -0600 |
commit | 7ccd1f328b95a42f2b6d9ea43c6b8bf4aaa25233 (patch) | |
tree | 11a9f02107ec0df33ddfd65905b76a4cd907d148 /sc | |
parent | 2a3225899e8d98410d5f47c59aa4cd6fe911b9f6 (diff) |
GPU Calc: implemented EXP
AMLOEXT-165 FIX
Change-Id: I73693ecab752d48f620bc0cd53e29d9a8fe16c93
Signed-off-by: haochen <haochen@multicorewareinc.com>
Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/opencl/formulagroupcl.cxx | 3 | ||||
-rw-r--r-- | sc/source/core/opencl/op_math.cxx | 28 | ||||
-rw-r--r-- | sc/source/core/opencl/op_math.hxx | 7 |
3 files changed, 38 insertions, 0 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 5b5cd478b848..9eeafb7960dd 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1261,6 +1261,9 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( mvSubArguments.push_back(SoPHelper(ts, ft->Children[i], new OpCscH)); break; + case ocExp: + mvSubArguments.push_back(SoPHelper(ts, ft->Children[i], new OpExp)); + 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 5b6857b240af..9934014bdae2 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -260,6 +260,34 @@ void OpCscH::GenSlidingWindowFunction( ss << "return tmp;\n"; ss << "}"; } +void OpExp::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=exp(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 0772245bc075..247800e2fab1 100644 --- a/sc/source/core/opencl/op_math.hxx +++ b/sc/source/core/opencl/op_math.hxx @@ -211,6 +211,13 @@ public: const std::string sSymName, SubArguments &vSubArguments); virtual std::string BinFuncName(void) const { return "CscH"; } }; +class OpExp: public Normal +{ +public: + virtual void GenSlidingWindowFunction(std::stringstream &ss, + const std::string sSymName, SubArguments &vSubArguments); + virtual std::string BinFuncName(void) const { return "Exp"; } +}; }} #endif |