summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortianyao <tianyao@multicorewareinc.com>2013-11-09 12:59:19 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-14 14:09:50 -0600
commit3fa3072bfaeeae1145967432a7d809a0925dd064 (patch)
tree579fd60c98fced4021afa11fc6cda708aa7e6373
parent349d7cf756967abb5a29f2f891961cc0911f7666 (diff)
GPU Calc: implemented LOG10
AMLOEXT-180 FIX Change-Id: I5e3be337e5ebd44f0aa93ce26ab01cc158c2a758 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.cxx3
-rw-r--r--sc/source/core/opencl/op_math.cxx30
-rw-r--r--sc/source/core/opencl/op_math.hxx7
3 files changed, 40 insertions, 0 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 9eeafb7960dd..13f90500f567 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1264,6 +1264,9 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
case ocExp:
mvSubArguments.push_back(SoPHelper(ts, ft->Children[i], new OpExp));
break;
+ case ocLog10:
+ mvSubArguments.push_back(SoPHelper(ts, ft->Children[i], new OpLog10));
+ 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 9934014bdae2..9addfe3097bb 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -288,6 +288,36 @@ void OpExp::GenSlidingWindowFunction(std::stringstream &ss,
ss << "return tmp;\n";
ss << "}";
}
+
+void OpLog10::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{\n\t";
+ ss <<"int gid0=get_global_id(0);\n\t";
+ ss << "double arg0 = " << vSubArguments[0]->GenSlidingWindowDeclRef();
+ ss << ";\n\t";
+#ifdef ISNAN
+ ss<< "if(isNan(arg0)||(gid0>=";
+ ss<<tmpCurDVR->GetArrayLength();
+ ss<<"))\n\t\t";
+ ss<<"arg0 = 0;\n\t";
+#endif
+ ss << "double tmp=log10(arg0);\n\t";
+ ss << "return tmp;\n";
+ ss << "}";
+}
+
void OpSinh::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 247800e2fab1..ea96db8f74b4 100644
--- a/sc/source/core/opencl/op_math.hxx
+++ b/sc/source/core/opencl/op_math.hxx
@@ -218,6 +218,13 @@ public:
const std::string sSymName, SubArguments &vSubArguments);
virtual std::string BinFuncName(void) const { return "Exp"; }
};
+class OpLog10: public Normal
+{
+public:
+ virtual void GenSlidingWindowFunction(std::stringstream &ss,
+ const std::string sSymName, SubArguments &vSubArguments);
+ virtual std::string BinFuncName(void) const { return "Log10"; }
+};
}}
#endif