summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhongyu zhong <hongyu@multicorewareinc.com>2013-11-06 11:06:37 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-13 14:39:16 -0600
commitbbf1c1154ff9ea08972444086bc401896485b81b (patch)
tree92c64c0526b71fc07b713b73208753f0b8006f2f
parent14458e708d0cad11778c64dd5353ae210060c558 (diff)
GPU Calc: implemented for NORMSINV
AMLOEXT-123 FIX Change-Id: I894725fa657c2b8dc14961fe4c5771083f4eca9c 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.cxx4
-rw-r--r--sc/source/core/opencl/op_statistical.cxx191
-rw-r--r--sc/source/core/opencl/op_statistical.hxx6
3 files changed, 201 insertions, 0 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index e0072638b42d..e3df0986035c 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1108,6 +1108,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i],new OpNorminv));
break;
+ case ocSNormInv:
+ mvSubArguments.push_back(SoPHelper(ts,
+ ft->Children[i],new OpNormsinv));
+ break;
case ocExternal:
if ( !(pChild->GetExternal().compareTo(OUString(
"com.sun.star.sheet.addin.Analysis.getEffect"))))
diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx
index d72d65ca8d80..878e01c96978 100644
--- a/sc/source/core/opencl/op_statistical.cxx
+++ b/sc/source/core/opencl/op_statistical.cxx
@@ -1279,6 +1279,197 @@ void OpNorminv::GenSlidingWindowFunction(
ss<<"return tmp;\n";
ss<<"}\n";
}
+void OpNormsinv:: 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 << "{\n";
+ ss << " double q,t,z,x;\n";
+ ss << " int gid0=get_global_id(0);\n";
+#ifdef ISNAN
+ FormulaToken *tmpCur0 = vSubArguments[0]->GetFormulaToken();
+ const formula::SingleVectorRefToken*tmpCurDVR0= dynamic_cast<const
+ formula::SingleVectorRefToken *>(tmpCur0);
+ ss << " int buffer_x_len = ";
+ ss << tmpCurDVR0->GetArrayLength();
+ ss << ";\n";
+#endif
+#ifdef ISNAN
+ ss <<" if((gid0)>=buffer_x_len || isNan(";
+ ss << vSubArguments[0]->GenSlidingWindowDeclRef();
+ ss <<"))\n";
+ ss <<" x = 0;\n";
+ ss <<" else \n";
+#endif
+ ss <<" x ="<<vSubArguments[0]->GenSlidingWindowDeclRef();
+ ss << ";\n";
+ ss <<" q = x -0.5;\n";
+ ss <<" if(fabs(q)<=.425)\n";
+ ss <<" {\n";
+ ss <<" t=0.180625-q*q;\n";
+ ss <<" z=\n"
+ "q*\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "t*2509.0809287301226727";
+ ss <<"+33430.575583588128105\n"
+ ")\n"
+ "*t+67265.770927008700853\n"
+ ")\n"
+ "*t+45921.953931549871457\n"
+ ")\n"
+ "*t+13731.693765509461125\n"
+ ")\n"
+ "*t+1971.5909503065514427\n"
+ ")\n"
+ "*t+133.14166789178437745\n"
+ ")\n"
+ "*t+3.387132872796366608\n"
+ ")\n"
+ "/\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "t*5226.495278852854561";
+ ss <<"+28729.085735721942674\n"
+ ")\n"
+ "*t+39307.89580009271061\n"
+ ")\n"
+ "*t+21213.794301586595867\n"
+ ")\n"
+ "*t+5394.1960214247511077\n"
+ ")\n"
+ "*t+687.1870074920579083\n"
+ ")\n"
+ "*t+42.313330701600911252\n"
+ ")\n"
+ "*t+1.0\n"
+ ");\n";
+ ss <<"}\nelse\n{\n";
+ ss <<" if(q>0)\nt=1-x;\n";
+ ss <<"else\nt=x;\n";
+ ss <<"t=sqrt(-log(t));\n";
+ ss <<"if(t<=5.0)\n{\n";
+ ss <<"t+=-1.6;\n";
+ ss <<"z=\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "t*7.7454501427834140764e-4";
+ ss <<"+0.0227238449892691845833\n"
+ ")\n"
+ "*t+0.24178072517745061177\n"
+ ")\n"
+ "*t+1.27045825245236838258\n"
+ ")\n"
+ "*t+3.64784832476320460504\n"
+ ")\n"
+ "*t+5.7694972214606914055\n"
+ ")\n"
+ "*t+4.6303378461565452959\n"
+ ")\n"
+ "*t+1.42343711074968357734\n"
+ ")\n"
+ "/\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "t*1.05075007164441684324e-9";
+ ss <<"+5.475938084995344946e-4\n"
+ ")\n"
+ "*t+0.0151986665636164571966\n"
+ ")\n"
+ "*t+0.14810397642748007459\n"
+ ")\n"
+ "*t+0.68976733498510000455\n"
+ ")\n"
+ "*t+1.6763848301838038494\n"
+ ")\n"
+ "*t+2.05319162663775882187\n"
+ ")\n"
+ "*t+1.0\n"
+ ");\n}\n";
+ ss <<"else\n{\n";
+ ss <<"t+=-5.0;\n";
+ ss <<"z=\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "t*2.01033439929228813265e-7";
+ ss <<"+2.71155556874348757815e-5\n"
+ ")\n"
+ "*t+0.0012426609473880784386\n"
+ ")\n"
+ "*t+0.026532189526576123093\n"
+ ")\n"
+ "*t+0.29656057182850489123\n"
+ ")\n"
+ "*t+1.7848265399172913358\n"
+ ")\n"
+ "*t+5.4637849111641143699\n"
+ ")\n"
+ "*t+6.6579046435011037772\n"
+ ")\n"
+ "/\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "(\n"
+ "t*2.04426310338993978564e-15"
+ "+1.4215117583164458887e-7\n"
+ ")\n"
+ "*t+1.8463183175100546818e-5\n"
+ ")\n"
+ "*t+7.868691311456132591e-4\n"
+ ")\n"
+ "*t+0.0148753612908506148525\n"
+ ")\n"
+ "*t+0.13692988092273580531\n"
+ ")\n"
+ "*t+0.59983220655588793769\n"
+ ")\n"
+ "*t+1.0\n"
+ ");\n";
+ ss <<"}\n";
+ ss <<"if(q<0.0) z=-z;\n";
+ ss <<"}\n";
+ ss <<"double tmp = z;\n";
+ ss <<"return tmp;\n";
+ ss <<"}\n";
+}
void OpMedian::GenSlidingWindowFunction(
std::stringstream &ss, const std::string sSymName,
SubArguments &vSubArguments)
diff --git a/sc/source/core/opencl/op_statistical.hxx b/sc/source/core/opencl/op_statistical.hxx
index a042ea42d973..817e41369fa7 100644
--- a/sc/source/core/opencl/op_statistical.hxx
+++ b/sc/source/core/opencl/op_statistical.hxx
@@ -141,6 +141,12 @@ class OpNorminv:public Normal{
const std::string sSymName, SubArguments &vSubArguments);
virtual std::string BinFuncName(void) const { return "OpNorminv"; }
};
+class OpNormsinv:public Normal{
+ public:
+ virtual void GenSlidingWindowFunction(std::stringstream &ss,
+ const std::string sSymName, SubArguments &vSubArguments);
+ virtual std::string BinFuncName(void) const { return "OpNormsinv"; }
+};
class OpKurt: public Normal
{
public: