diff options
author | yangzhang <yangzhang@multicorewareinc.com> | 2013-11-07 13:01:31 +0800 |
---|---|---|
committer | I-Jui (Ray) Sung <ray@multicorewareinc.com> | 2013-11-13 17:44:11 -0600 |
commit | 44b2e2f6b6d2f11829b0d98de7606ee01ec17cac (patch) | |
tree | 7c1afdc12b48e461d2b0c5d48bf11b245587e99d /sc | |
parent | 84901d03c44da80ece47758e8af44178037d2aca (diff) |
GPU Calc: implemented ATAN
AMLOEXT-144 FIX
Change-Id: Ib94a4fbdcdf928c9a943d5b57449e7335d82b016
Refactoring: fix compile warnning in op_statistical.cxx
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 | 27 | ||||
-rw-r--r-- | sc/source/core/opencl/op_math.hxx | 7 | ||||
-rw-r--r-- | sc/source/core/opencl/op_statistical.cxx | 1 |
4 files changed, 39 insertions, 0 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 595b73308f23..07499ad2c791 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1168,6 +1168,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( mvSubArguments.push_back(SoPHelper(ts, ft->Children[i], new OpArcSinHyp)); break; + case ocArcTan: + mvSubArguments.push_back(SoPHelper(ts, + ft->Children[i], new OpArcTan)); + 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 43c659171fe6..54114e7c744b 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -514,6 +514,33 @@ void OpArcSinHyp::GenSlidingWindowFunction(std::stringstream &ss, ss << " return asinh(tmp);\n"; ss << "}"; } +void OpArcTan::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 = " << vSubArguments[0]->GenSlidingWindowDeclRef() << ";\n"; + ss << " return atan(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 9178415160e5..edbab10a57ac 100644 --- a/sc/source/core/opencl/op_math.hxx +++ b/sc/source/core/opencl/op_math.hxx @@ -132,6 +132,13 @@ public: virtual std::string GetBottom(void) { return "0.0"; } virtual std::string BinFuncName(void) const { return "ScASinH"; } }; +class OpArcTan: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 "ScATan"; } +}; }} #endif diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index 6bc1f21f80ac..5cf6854b06d8 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -939,6 +939,7 @@ void OpCritBinom::BinInlineFun(std::set<std::string>& decls, std::set<std::string>& funs) { decls.insert(MinDecl); + funs.insert(""); } void OpCritBinom::GenSlidingWindowFunction(std::stringstream& ss, |