diff options
author | yangzhang <yangzhang@multicorewareinc.com> | 2013-11-05 16:43:33 +0800 |
---|---|---|
committer | I-Jui (Ray) Sung <ray@multicorewareinc.com> | 2013-11-13 00:45:06 -0600 |
commit | f9d9a411bd308773379e6a5a9048ed23615ef5e8 (patch) | |
tree | 4c9e8f75683423774539c170a5a2db3753c96d94 /sc | |
parent | 5ef8c443c594e3b6a4553e6c9e18fde2c6381f0f (diff) |
GPU Calc: implemented for ARCCOS
AMLOEXT-113 FIX
Change-Id: I321f50c9c57af1ae68228ed62ce2981ced4846d4
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 | 4 | ||||
-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, 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: |