diff options
author | yangzhang <yangzhang@multicorewareinc.com> | 2013-11-05 17:05:05 +0800 |
---|---|---|
committer | I-Jui (Ray) Sung <ray@multicorewareinc.com> | 2013-11-13 00:45:09 -0600 |
commit | f4552fcf81fc0bd4e42dc7756b371205b94589de (patch) | |
tree | e0b186560b7b3bc82cfc5d4b343ea8ddac97f383 | |
parent | 369b48a1b6945e52886a7ec447014891bfd7da2f (diff) |
GPU Calc: implemented for ARCCOSHYP
AMLOEXT-125 FIX
Change-Id: I93432a89ad7c60c4575999d9adecda30e5d58198
Signed-off-by: haochen <haochen@multicorewareinc.com>
Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
-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 87ea577854a9..1f53072588fb 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1092,6 +1092,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( mvSubArguments.push_back(SoPHelper(ts, ft->Children[i],new OpSqrt)); break; + case ocArcCosHyp: + mvSubArguments.push_back(SoPHelper(ts, + ft->Children[i], new OpArcCosHyp)); + 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 5e4f3dfd6564..8e84794feeb6 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -262,6 +262,34 @@ void OpArcCos::GenSlidingWindowFunction(std::stringstream &ss, ss << " return acos(tmp);\n"; ss << "}"; } +void OpArcCosHyp::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 acosh(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 0998b4f0123d..3731c31b4906 100644 --- a/sc/source/core/opencl/op_math.hxx +++ b/sc/source/core/opencl/op_math.hxx @@ -65,6 +65,13 @@ public: virtual std::string GetBottom(void) { return "0.0"; } virtual std::string BinFuncName(void) const { return "ScACos"; } }; +class OpArcCosHyp:public Normal{ +public: + virtual void GenSlidingWindowFunction(std::stringstream &ss, + const std::string sSymName, SubArguments &vSubArguments); + virtual std::string GetBottom(void) { return "1.0"; } + virtual std::string BinFuncName(void) const { return "ScACosH"; } +}; class OpTan: public Normal { public: |