diff options
author | fengzeng <fengzeng@multicorewareinc.com> | 2013-11-04 16:36:26 +0800 |
---|---|---|
committer | I-Jui (Ray) Sung <ray@multicorewareinc.com> | 2013-11-05 14:48:09 -0600 |
commit | ecda5dc6203cfefdb075984fb9826d33fc214c43 (patch) | |
tree | ca2f81b29a600217505f7accd7d3bfc611a1a165 /sc | |
parent | e7ff395a3f70573c0dbb4093e86ffe57e935fece (diff) |
GPU Calc: implemented TAN
AMLOEXT-60 FIX
Change-Id: Ibdbc0f22e152f5b73191f3a16e9e5489c0007fc3
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 | 30 | ||||
-rw-r--r-- | sc/source/core/opencl/op_math.hxx | 8 |
3 files changed, 41 insertions, 1 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index a0a2d3a57bbb..a710f2203e0d 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1036,6 +1036,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( mvSubArguments.push_back(SoPHelper(ts, ft->Children[i], new OpSin)); break; + case ocTan: + mvSubArguments.push_back(SoPHelper(ts, + ft->Children[i], new OpTan)); + 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 3d7d4c94801c..c5c213cb3722 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -170,7 +170,35 @@ void OpAbs::GenSlidingWindowFunction(std::stringstream &ss, ss << " return fabs(tmp);\n"; ss << "}"; } - +void OpTan::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"; + ss << "{\n"; + ss << " int gid0=get_global_id(0);\n"; + ss << " double arg0 = "<< vSubArguments[0]->GenSlidingWindowDeclRef(); + ss << ";\n"; +#ifdef ISNAN + ss << " if(isNan(arg0)||(gid0>="; + ss << tmpCurDVR->GetArrayLength(); + ss << "))\n"; + ss << " arg0 = 0;\n"; +#endif + ss << " double tmp=tan(arg0);\n"; + ss << " return tmp;\n"; + ss << "}"; +} }} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/opencl/op_math.hxx b/sc/source/core/opencl/op_math.hxx index 1dbfec9fa5d1..ed5a4e9a225d 100644 --- a/sc/source/core/opencl/op_math.hxx +++ b/sc/source/core/opencl/op_math.hxx @@ -52,6 +52,14 @@ public: virtual std::string GetBottom(void) { return "0.0"; } virtual std::string BinFuncName(void) const { return "ScAbs"; } }; +class OpTan: public Normal +{ +public: + virtual void GenSlidingWindowFunction(std::stringstream &ss, + const std::string sSymName, SubArguments &vSubArguments); + + virtual std::string BinFuncName(void) const { return "Tan"; } +}; }} #endif |