summaryrefslogtreecommitdiff
path: root/sc/source/core/opencl/op_math.cxx
diff options
context:
space:
mode:
authorfengzeng <fengzeng@multicorewareinc.com>2013-11-04 16:36:26 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-05 14:48:09 -0600
commitecda5dc6203cfefdb075984fb9826d33fc214c43 (patch)
treeca2f81b29a600217505f7accd7d3bfc611a1a165 /sc/source/core/opencl/op_math.cxx
parente7ff395a3f70573c0dbb4093e86ffe57e935fece (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/source/core/opencl/op_math.cxx')
-rw-r--r--sc/source/core/opencl/op_math.cxx30
1 files changed, 29 insertions, 1 deletions
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: */