summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryiming ju <yiming@multicorewareinc.com>2013-12-13 14:50:06 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-12-19 17:53:56 -0600
commit1f8e758d96898d000901672c6c469111f8bb7625 (patch)
tree5f0682194e6016da2b5a5664da193edd65557957
parentccd96abb8c46c85d99cd1a9034374ea9a8a23049 (diff)
GPU Calc: implemented ISODD
AMLOEXT-361 FIX Change-Id: Iac92dfaa9e707323b31846f47b3745b9f785af3b Signed-off-by: haochen <haochen@multicorewareinc.com> Signed-off-by: Wei Wei <weiwei@multicorewareinc.com> Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx10
-rw-r--r--sc/source/core/opencl/op_math.cxx21
-rw-r--r--sc/source/core/opencl/op_math.hxx7
3 files changed, 38 insertions, 0 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 4ab16295d007..f649939cfa75 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -2448,6 +2448,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i],new OpIsEven));
break;
+ case ocIsOdd:
+ mvSubArguments.push_back(SoPHelper(ts,
+ ft->Children[i],new OpIsOdd));
+ break;
case ocExternal:
if ( !(pChild->GetExternal().compareTo(OUString(
"com.sun.star.sheet.addin.Analysis.getEffect"))))
@@ -2654,6 +2658,12 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
mvSubArguments.push_back(SoPHelper(ts, ft->Children[i],
new OpIsEven));
}
+ else if ( !(pChild->GetExternal().compareTo(OUString(
+ "com.sun.star.sheet.addin.Analysis.getIsodd"))))
+ {
+ mvSubArguments.push_back(SoPHelper(ts, ft->Children[i],
+ new OpIsOdd));
+ }
break;
default:
diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx
index f2d13dc5a8d6..f6796218addb 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -1591,6 +1591,27 @@ void OpIsEven::GenSlidingWindowFunction(std::stringstream &ss,
ss << " return tmp;\n";
ss << "}";
}
+void OpIsOdd::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{\n";
+ ss << " int gid0=get_global_id(0);\n";
+ ss << " int singleIndex = gid0;\n";
+ ss << " double tmp;\n";
+ GenTmpVariables(ss,vSubArguments);
+ CheckAllSubArgumentIsNan(ss,vSubArguments);
+ ss << " tmp = !(fmod(floor(fabs(tmp0)), 2.0)<0.5);\n";
+ ss << " return tmp;\n";
+ ss << "}";
+}
void OpOdd::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 d1a173808e05..37e649169be8 100644
--- a/sc/source/core/opencl/op_math.hxx
+++ b/sc/source/core/opencl/op_math.hxx
@@ -249,6 +249,13 @@ public:
const std::string sSymName, SubArguments &vSubArguments);
virtual std::string BinFuncName(void) const { return "IsEven"; }
};
+class OpIsOdd: public CheckVariables
+{
+public:
+ virtual void GenSlidingWindowFunction(std::stringstream &ss,
+ const std::string sSymName, SubArguments &vSubArguments);
+ virtual std::string BinFuncName(void) const { return "IsOdd"; }
+};
class OpCot: public Normal
{
public: