23 std::set<std::string>& funs)
33 const std::string &sSymName,
SubArguments &vSubArguments)
38 ss <<
" int gid0 = get_global_id(0);\n";
39 ss <<
" double fSum = 0.0;\n";
40 ss <<
" double fSumSqr = 0.0;\n";
41 ss <<
" double mue = 0.0;\n";
42 ss <<
" double fCount = 0.0;\n";
45 " fSumSqr += arg * arg;\n"
48 ss <<
" if(fCount <= 1.0)\n";
49 ss <<
" return CreateDoubleError(DivisionByZero);\n";
50 ss <<
" mue = fSum / fCount;\n";
52 if(vSubArguments.size() == 3)
55 ss <<
" if(sigma <= 0.0)\n";
56 ss <<
" return CreateDoubleError(IllegalArgument);\n";
57 ss <<
" return 0.5 - gauss((mue-mu)*sqrt(fCount)/sigma);\n";
61 ss <<
" double sigma = (fSumSqr-fSum*fSum/fCount)/(fCount-1.0);\n";
62 ss <<
" if(sigma == 0.0)\n";
63 ss <<
" return CreateDoubleError(DivisionByZero);\n";
64 ss <<
" return 0.5 - gauss((mue-mu)/sqrt(sigma/fCount));\n";
70 std::set<std::string>& funs)
93 const std::string &sSymName,
SubArguments &vSubArguments)
98 ss <<
" int gid0 = get_global_id(0);\n";
99 ss <<
" double fSum1 = 0.0;\n";
100 ss <<
" double fSum2 = 0.0;\n";
101 ss <<
" double fSumSqr1 = 0.0;\n";
102 ss <<
" double fSumSqr2 = 0.0;\n";
103 ss <<
" double fCount1 = 0.0;\n";
104 ss <<
" double fCount2 = 0.0;\n";
105 ss <<
" double fT = 0.0;\n";
106 ss <<
" double fF = 0.0;\n";
109 ss <<
" mode = floor(mode);\n";
110 ss <<
" type = floor(type);\n";
111 ss <<
" if(mode != 1.0 && mode != 2.0)\n";
112 ss <<
" return CreateDoubleError(IllegalArgument);\n";
113 ss <<
" if(type != 1.0 && type != 2.0 && type != 3.0)\n";
114 ss <<
" return CreateDoubleError(IllegalArgument);\n";
116 ss <<
" if(type == 1.0)\n";
121 " fSumSqr1 += (arg1 - arg2)*(arg1 - arg2);\n"
124 ss <<
" if(fCount1 < 1.0)\n";
125 ss <<
" return CreateDoubleError(NoValue);\n";
126 ss <<
" double divider = sqrt(fCount1 * fSumSqr1 - (fSum1-fSum2)*(fSum1-fSum2));\n";
127 ss <<
" if(divider == 0)\n";
128 ss <<
" return CreateDoubleError(DivisionByZero);\n";
129 ss <<
" fT = sqrt(fCount1-1.0) * fabs(fSum1 - fSum2) / divider;\n";
130 ss <<
" fF = fCount1 - 1.0;\n";
132 ss <<
" if(type == 2.0 || type == 3.0)\n";
136 " fSumSqr1 += arg * arg;\n"
141 " fSumSqr2 += arg * arg;\n"
144 ss <<
" if (fCount1 < 2.0 || fCount2 < 2.0)\n";
145 ss <<
" return CreateDoubleError(NoValue);\n";
147 ss <<
" if(type == 3.0)\n";
149 ss <<
" double fS1 = (fSumSqr1-fSum1*fSum1/fCount1)\n";
150 ss <<
" /(fCount1-1.0)/fCount1;\n";
151 ss <<
" double fS2 = (fSumSqr2-fSum2*fSum2/fCount2)\n";
152 ss <<
" /(fCount2-1.0)/fCount2;\n";
153 ss <<
" if (fS1 + fS2 == 0.0)\n";
154 ss <<
" return CreateDoubleError(NoValue);\n";
155 ss <<
" fT = fabs(fSum1/fCount1 - fSum2/fCount2)\n";
156 ss <<
" /sqrt(fS1+fS2);\n";
157 ss <<
" double c = fS1/(fS1+fS2);\n";
158 ss <<
" fF = 1.0/(c*c/(fCount1-1.0)+(1.0-c)*(1.0-c)\n";
159 ss <<
" /(fCount2-1.0));\n";
161 ss <<
" if(type == 2.0)\n";
163 ss <<
" double fS1 = (fSumSqr1 - fSum1*fSum1/fCount1)\n";
164 ss <<
" /(fCount1 - 1.0);\n";
165 ss <<
" double fS2 = (fSumSqr2 - fSum2*fSum2/fCount2)\n";
166 ss <<
" /(fCount2 - 1.0);\n";
167 ss <<
" fT = fabs( fSum1/fCount1 - fSum2/fCount2 )\n";
168 ss <<
" /sqrt( (fCount1-1.0)*fS1 + (fCount2-1.0)*fS2 )\n";
169 ss <<
" *sqrt( fCount1*fCount2*(fCount1+fCount2-2)\n";
170 ss <<
" /(fCount1+fCount2) );\n";
171 ss <<
" fF = fCount1 + fCount2 - 2;\n";
173 ss <<
" double tdist=GetTDist(fT, fF);\n";
174 ss <<
" if (mode==1)\n";
175 ss <<
" return tdist;\n";
177 ss <<
" return 2.0*tdist;\n";
182 std::set<std::string>& funs)
204 const std::string &sSymName,
SubArguments &vSubArguments)
209 ss <<
" int gid0 = get_global_id(0);\n";
213 ss <<
" fDF = floor( fDF );\n";
214 ss <<
" fFlag = floor( fFlag );\n";
215 ss <<
" if(fDF < 1.0 || x < 0.0 || (fFlag != 1.0 && fFlag != 2.0))\n";
216 ss <<
" return CreateDoubleError(IllegalArgument);\n";
217 ss <<
" double R = GetTDist(x, fDF);\n";
218 ss <<
" if (fFlag == 1.0)\n";
219 ss <<
" return R;\n";
221 ss <<
" return 2.0 * R;\n";
226 const std::string &sSymName,
SubArguments &vSubArguments)
231 ss <<
" double tmp = 0;\n";
232 ss <<
" int gid0 = get_global_id(0);\n";
236 ss <<
" if(rlambda <= 0.0)\n";
237 ss <<
" return CreateDoubleError(IllegalArgument);\n";
238 ss <<
" else if(rkum == 0)\n";
240 ss <<
" if(rx >= 0)\n";
241 ss <<
" tmp = rlambda*exp(-rlambda*rx);\n";
243 ss <<
" tmp = 0.0;\n";
247 ss <<
" if(rx > 0)\n";
248 ss <<
" tmp = 1.0 - exp(-rlambda*rx);\n";
250 ss <<
" tmp = 0.0;\n";
252 ss <<
" return tmp;\n";
256 std::set<std::string>& funs)
271 const std::string &sSymName,
SubArguments &vSubArguments)
276 ss <<
" double tmp = 0;\n";
277 ss <<
" int gid0 = get_global_id(0);\n";
281 ss <<
" rF1 = floor(rF1);\n";
282 ss <<
" rF2 = floor(rF2);\n";
283 ss <<
" if (rX < 0.0 || rF1 < 1.0 || rF2 < 1.0 || rF1 >= 1.0E10 ||";
284 ss <<
"rF2 >= 1.0E10)\n";
285 ss <<
" return CreateDoubleError(IllegalArgument);\n";
286 ss <<
" tmp = GetFDist(rX, rF1, rF2);\n";
287 ss <<
" return tmp;\n";
292 const std::string &sSymName,
SubArguments &vSubArguments)
297 ss <<
" int gid0 = get_global_id(0);\n";
301 ss <<
" if(sigma < 0.0)\n";
302 ss <<
" return CreateDoubleError(IllegalArgument);\n";
303 ss <<
" else if(sigma == 0.0)\n";
304 ss <<
" return CreateDoubleError(DivisionByZero);\n";
306 ss <<
" return (x - mu)/sigma;\n";
311 const std::string &sSymName,
SubArguments &vSubArguments)
316 ss <<
" int gid0 = get_global_id(0);\n";
321 ss <<
" if(alpha <= 0.0 || beta <=0.0 || x < 0.0)\n";
322 ss <<
" return CreateDoubleError(IllegalArgument);\n";
323 ss <<
" if (kum == 0.0)\n";
324 ss <<
" return alpha/pow(beta,alpha)*pow(x,alpha-1.0)*\n";
325 ss <<
" exp(-pow(x/beta,alpha));\n";
327 ss <<
" return 1.0 - exp(-pow(x/beta,alpha));\n";
332 std::set<std::string>& funs)
361 const std::string &sSymName,
SubArguments &vSubArguments)
366 ss <<
" int gid0 = get_global_id(0);\n";
369 ss <<
" fDF = floor(fDF);\n";
370 ss <<
" if (x > 1.0||fDF < 1.0 || fDF > 1.0E10 || x <= 0.0)\n";
371 ss <<
" return CreateDoubleError(IllegalArgument);\n";
372 ss <<
" bool bConvError;\n";
373 ss <<
" double fVal = lcl_IterateInverse(\n";
374 ss <<
" fDF*0.5, fDF, &bConvError,x,fDF );\n";
375 ss <<
" if (bConvError)\n";
376 ss <<
" return CreateDoubleError(IllegalArgument);\n";
377 ss <<
" return fVal;\n";
382 const std::string &sSymName,
SubArguments &vSubArguments)
387 ss <<
" int gid0=get_global_id(0);\n";
389 ss <<
" if (fabs(arg0) >= 1.0)\n";
390 ss <<
" return CreateDoubleError(IllegalArgument);\n";
391 ss <<
" double tmp=0.5*log((1+arg0)/(1-arg0));\n";
392 ss <<
" return tmp;\n";
402 ss <<
" int gid0=get_global_id(0);\n";
404 ss <<
" double tmp=tanh(arg0);\n";
405 ss <<
" return tmp;\n";
415 ss <<
" int gid0=get_global_id(0);\n";
417 ss <<
" double tmp=tgamma(arg0);\n";
418 ss <<
" return tmp;\n";
428 ss <<
" int gid0=get_global_id(0);\n";
432 ss <<
" f = floor( f );\n";
433 ss <<
" s = floor( s );\n";
434 ss <<
" if ((f + s) <= 1.0 || p < 0.0 || p > 1.0)\n";
435 ss <<
" return CreateDoubleError(IllegalArgument);\n";
436 ss <<
" double q = 1.0 - p;\n";
437 ss <<
" double fFactor = pow(p,s);\n";
438 ss <<
" for(int i=0; i<f; i++)\n";
439 ss <<
" fFactor *= (i+s)/(i+1.0)*q;\n";
440 ss <<
" return fFactor;\n";
450 ss <<
"int gid0=get_global_id(0);\n\t";
452 ss <<
"double tmp=lgamma(arg0);\n\t";
453 ss <<
"return tmp;\n";
457 std::set<std::string>& funs)
472 ss <<
" int gid0=get_global_id(0);\n";
474 ss <<
" double tmp=gauss(arg0);\n";
475 ss <<
" return tmp;\n";
486 ss <<
" int gid0 = get_global_id(0);\n";
487 ss <<
" double nVal=0.0;\n";
488 ss <<
" double tmp = 0;\n";
489 ss <<
" int length;\n";
490 ss <<
" int totallength=0;\n";
493 " return CreateDoubleError(IllegalArgument);\n"
496 " nVal += log(arg);\n"
499 ss <<
" return exp(nVal/totallength);\n";
510 ss <<
" int gid0 = get_global_id(0);\n";
511 ss <<
" double nVal=0.0;\n";
512 ss <<
" double tmp = 0;\n";
513 ss <<
" int length;\n";
514 ss <<
" int totallength=0;\n";
517 " return CreateDoubleError(IllegalArgument);\n"
518 " nVal += (1.0 / arg);\n"
521 ss <<
" return totallength/nVal;\n";
526 std::set<std::string>& funs)
533 const std::string &sSymName,
SubArguments& vSubArguments)
538 ss <<
" double tmp = " <<
GetBottom() <<
";\n";
539 ss <<
" int gid0 = get_global_id(0);\n";
543 ss <<
" double rn = floor(size);\n";
544 ss <<
" if(sigma <= 0.0 || alpha <= 0.0 || alpha >= 1.0";
545 ss <<
"|| rn < 1.0)\n";
546 ss <<
" return CreateDoubleError(IllegalArgument);\n";
548 ss <<
" tmp = gaussinv(1.0 - alpha / 2.0) * sigma / sqrt( rn );\n";
549 ss <<
" return tmp;\n";
554 std::set<std::string>& funs)
561 const std::string &sSymName,
SubArguments& vSubArguments)
566 ss <<
" double tmp = " <<
GetBottom() <<
";\n";
567 ss <<
" int gid0 = get_global_id(0);\n";
571 ss <<
" double rn = floor(n);\n";
572 ss <<
" if (rn < 0.0 || alpha < 0.0 || alpha > 1.0 || p < 0.0";
573 ss <<
" || p > 1.0)\n";
574 ss <<
" return CreateDoubleError(IllegalArgument);\n";
575 ss <<
" else if ( alpha == 0 )\n";
576 ss <<
" return 0;\n";
577 ss <<
" else if ( alpha == 1 )\n";
578 ss <<
" return p == 0 ? 0 : rn;\n";
581 ss <<
" double rq = (0.5 - p) + 0.5;\n";
582 ss <<
" double fFactor = pow(rq, rn);\n";
583 ss <<
" if (fFactor <= Min)\n";
585 ss <<
" fFactor = pow(p, rn);\n";
586 ss <<
" if (fFactor <= Min)\n";
587 ss <<
" return CreateDoubleError(NoValue);\n";
590 ss <<
" double fSum = 1.0 - fFactor;\n";
591 ss <<
" uint max =(uint)(rn), i;\n";
592 ss <<
" for (i = 0; i < max && fSum >= alpha; i++)\n";
594 ss <<
" fFactor *= (rn - i) / (double)(i + 1) * rq / p;\n";
595 ss <<
" fSum -= fFactor;\n";
597 ss <<
" tmp = (rn - i);\n";
602 ss <<
" double fSum = fFactor;\n";
603 ss <<
" uint max = (uint)(rn), i;\n";
604 ss <<
" for (i = 0; i < max && fSum < alpha; i++)\n";
606 ss <<
" fFactor *= (rn - i) / (double)(i + 1) *";
608 ss <<
" fSum += fFactor;\n";
610 ss <<
" tmp = (i);\n";
613 ss <<
" return tmp;\n";
618 std::set<std::string>& funs)
646 ss <<
" double tmp;\n";
647 ss <<
" int gid0=get_global_id(0);\n";
651 ss <<
" tmp1 = floor(tmp1);";
652 ss <<
" if (tmp1 < 1.0 || tmp0 <= 0.0 || tmp0 > 1.0 )\n";
654 ss <<
" return CreateDoubleError(IllegalArgument);\n";
656 ss <<
" bool bConvError;\n";
657 ss <<
" double fVal = lcl_IterateInverseChiInv";
658 ss <<
"(tmp0, tmp1, tmp1*0.5, tmp1, &bConvError);\n";
659 ss <<
" if(bConvError)\n";
660 ss <<
" return CreateDoubleError(NoConvergence);\n";
661 ss <<
" return fVal;\n";
671 ss <<
" int gid0=get_global_id(0);\n";
676 ss <<
"if(sigma <= 0)\n";
677 ss <<
" return CreateDoubleError(IllegalArgument);\n";
678 ss <<
"double mid,tmp;\n";
679 ss <<
"mid = (x - mue)/sigma;\n";
681 ss <<
" tmp = 0.5 *erfc(-mid * 0.7071067811865475);\n";
683 ss <<
" tmp=(0.39894228040143268*exp(-pow(mid,2)/2.0))/sigma;\n";
684 ss <<
"return tmp;\n";
694 ss <<
" int gid0=get_global_id(0);\n";
696 ss <<
" double tmp = 0.5 * erfc((-1)*x * 0.7071067811865475);\n";
697 ss <<
" return tmp;\n";
708 ss <<
" int gid0=get_global_id(0);\n";
709 ss <<
" double tmp = 1 ;\n";
712 ss <<
" inA = floor( inA );\n";
713 ss <<
" inB = floor( inB );\n";
714 ss <<
" if (inA < 0.0 || inB < 0.0 || inB > inA)\n";
715 ss <<
" return CreateDoubleError(IllegalArgument);\n";
716 ss <<
" for( int i = 0; i<inB; i++)\n";
718 ss <<
" tmp *= inA ;\n";
719 ss <<
" inA = inA - 1.0;\n";
721 ss <<
" return tmp;\n";
731 ss <<
" int gid0=get_global_id(0);\n";
732 ss <<
" double tmp = 1.0;\n";
735 ss <<
" inA = floor( inA );\n";
736 ss <<
" inB = floor( inB );\n";
737 ss <<
" if (inA < 0.0 || inB < 0.0)\n";
738 ss <<
" return CreateDoubleError(IllegalArgument);\n";
739 ss <<
" return pow(inA, inB);\n";
750 ss <<
" int gid0=get_global_id(0);\n";
752 ss <<
" double tmp = 0.39894228040143268 * exp((-1)*pow(x,2) / 2.0);\n";
753 ss <<
" return tmp;\n";
758 std::set<std::string>& funs)
771 ss <<
" int gid0=get_global_id(0);\n";
775 ss <<
" if (sigma <= 0.0 || x < 0.0 || x > 1.0)\n";
776 ss <<
" return CreateDoubleError(IllegalArgument);\n";
777 ss <<
" else if (x == 0.0 || x == 1.0)\n";
778 ss <<
" return CreateDoubleError(NoValue);\n";
779 ss <<
" return gaussinv(x)*sigma + mue;\n";
784 std::set<std::string>& funs)
797 ss <<
" int gid0=get_global_id(0);\n";
799 ss <<
" if (x < 0.0 || x > 1.0)\n";
800 ss <<
" return CreateDoubleError(IllegalArgument);\n";
801 ss <<
" else if (x == 0.0 || x == 1.0)\n";
802 ss <<
" return CreateDoubleError(NoValue);\n";
803 ss <<
" return gaussinv(x);\n";
808 std::set<std::string>& funs)
815 const std::string &sSymName,
SubArguments &vSubArguments)
820 ss <<
" int gid0=get_global_id(0);\n";
821 ss <<
" double tmp;\n";
825 ss <<
" if ( sigma <= 0.0 || x <= 0.0 || x >= 1.0 )\n";
826 ss <<
" return CreateDoubleError(IllegalArgument);\n";
827 ss <<
" return exp(mue+sigma*gaussinv(x));\n";
832 const std::string &sSymName,
SubArguments &vSubArguments)
837 ss <<
" int gid0=get_global_id(0);\n";
842 ss <<
" if (sigma <= 0.0)\n";
843 ss <<
" return CreateDoubleError(IllegalArgument);\n";
844 ss <<
" double tmp;\n";
845 ss <<
" double temp = (log(x)-mue)/sigma;\n";
846 ss <<
" if(fCumulative != 0)\n";
849 ss <<
" tmp = 0.0;\n";
851 ss <<
" tmp = 0.5 * erfc(-temp * 0.7071067811865475);\n";
855 ss <<
" return CreateDoubleError(IllegalArgument);\n";
857 ss <<
" tmp = (0.39894228040143268 * exp((-1)*pow(temp, 2)";
858 ss <<
" / 2.0))/(sigma*x);\n";
859 ss <<
" return tmp;\n";
864 std::set<std::string>& funs)
877 const std::string &sSymName,
SubArguments &vSubArguments)
882 ss <<
" int gid0=get_global_id(0);\n";
887 ss <<
" if(arg1 <= 0 || arg2 <= 0)\n";
888 ss <<
" return CreateDoubleError(IllegalArgument);\n";
889 ss <<
" double tmp;\n";
890 ss <<
" if (arg3)\n";
891 ss <<
" tmp=GetGammaDist( arg0, arg1, arg2);\n";
893 ss <<
" tmp=GetGammaDistPDF( arg0, arg1, arg2);\n";
894 ss <<
" return tmp;\n";
898 std::set<std::string>& funs)
920 ss <<
" double fx,fDF,tmp=0;\n";
921 ss <<
" int gid0=get_global_id(0);\n";
924 ss <<
" fx = tmp0;\n";
925 ss <<
" fDF = floor(tmp1);\n";
926 ss <<
" if(fDF < 1.0)\n";
928 ss <<
" return CreateDoubleError(IllegalArgument);\n";
930 ss <<
" tmp = GetChiDist( fx, fDF);\n";
931 ss <<
" return tmp;\n";
935 std::set<std::string>& funs)
967 ss <<
" int gid0=get_global_id(0);\n";
972 ss <<
" tmp0 = floor(tmp0);\n";
973 ss <<
" tmp1 = floor(tmp1);\n";
974 ss <<
" double rq = (0.5 - tmp2) + 0.5;\n";
975 ss <<
" if (tmp1 < 0.0 || tmp0 < 0.0 || tmp0 > tmp1 ||";
976 ss <<
"tmp2 < 0.0 || tmp2 > 1.0)\n";
978 ss <<
" return CreateDoubleError(IllegalArgument);\n";
980 ss <<
" if(tmp2 == 0.0)\n";
981 ss <<
" return ( (tmp0 == 0.0 || tmp3) ? 1.0 : 0.0 );\n";
982 ss <<
" if(tmp2 == 1.0)\n";
983 ss <<
" return ( (tmp0 == tmp1) ? 1.0 : 0.0);\n";
984 ss <<
" if(!tmp3)\n";
985 ss <<
" return ( GetBinomDistPMF(tmp0, tmp1, tmp2));\n";
988 ss <<
" if(tmp0 == tmp1)\n";
989 ss <<
" return 1.0;\n";
992 ss <<
" double fFactor = pow(rq,tmp1);\n";
993 ss <<
" if(tmp0 == 0.0)\n";
994 ss <<
" return (fFactor);\n";
995 ss <<
" else if(fFactor <= Min)\n";
997 ss <<
" fFactor = pow(tmp2,tmp1);\n";
998 ss <<
" if(fFactor <= Min)\n";
999 ss <<
" return GetBetaDist";
1000 ss <<
"(rq, tmp1 - tmp0, tmp0 + 1.0);\n";
1003 ss <<
" if(fFactor > fMachEps)\n";
1005 ss <<
" double fSum = 1.0 - fFactor;\n";
1006 ss <<
" unsigned int max = ";
1007 ss <<
"(unsigned int)((tmp1 - tmp0)-1);\n";
1008 ss <<
" for (uint i = 0; i < max && fFactor > 0.0;";
1011 ss <<
" fFactor *= (tmp1 - i)/(i + 1)*rq/tmp2;\n";
1012 ss <<
" fSum -= fFactor;\n";
1014 ss <<
" return ( (fSum < 0.0) ? 0.0 : fSum );\n";
1017 ss <<
" return (lcl_GetBinomDistRange";
1018 ss <<
"(tmp1, tmp1 - tmp0, tmp1, fFactor, rq, tmp2));\n";
1023 ss <<
" double rtmp = ( lcl_GetBinomDistRange";
1024 ss <<
"(tmp1, 0.0, tmp0, fFactor, tmp2, rq));\n";
1025 ss <<
" return rtmp;\n";
1033 std::set<std::string>& funs)
1053 ss <<
" int gid0 = get_global_id(0);\n";
1054 ss <<
" double result = 0;\n";
1058 ss <<
" tmp1 = floor(tmp1);\n";
1059 ss <<
" if(tmp1 < 1.0)\n";
1060 ss <<
" return CreateDoubleError(IllegalArgument);\n";
1063 ss <<
" if(tmp2)\n";
1064 ss <<
" result =GetChiSqDistCDF(tmp0,tmp1);\n";
1066 ss <<
" result =GetChiSqDistPDF(tmp0,tmp1);\n";
1068 ss <<
" return result;\n";
1073 std::set<std::string>& funs)
1094 ss <<
" int gid0 = get_global_id(0);\n";
1095 ss <<
" double result = 0;\n";
1098 ss <<
" tmp1 = floor(tmp1);\n";
1099 ss <<
" bool bConvError;\n";
1100 ss <<
" if(tmp1 < 1.0 || tmp0 < 0 || tmp0>=1.0)\n";
1101 ss <<
" return CreateDoubleError(IllegalArgument);\n";
1104 ss <<
" result =lcl_IterateInverseChiSQInv( tmp0, tmp1,";
1105 ss <<
"tmp1*0.5, tmp1, &bConvError );\n";
1107 ss <<
" if(bConvError)\n";
1108 ss <<
" return CreateDoubleError(NoConvergence);\n";
1109 ss <<
" return result;\n";
1114 std::set<std::string>& funs)
1124 const std::string &sSymName,
SubArguments &vSubArguments)
1129 ss <<
" int gid0=get_global_id(0);\n";
1130 ss <<
" double tmp;\n";
1134 ss <<
" if( arg0 < 0 || arg0 >= 1 || arg1 <= 0 || arg2 <= 0 )\n";
1135 ss <<
" return CreateDoubleError(IllegalArgument);\n";
1136 ss <<
" if (arg0 == 0.0)\n"
1143 " bool bConvError;\n"
1144 " double fStart = arg1 * arg2;\n"
1145 " double fAx=fStart*0.5;\n"
1146 " double fBx=fStart;\n"
1147 " bConvError = false;\n"
1148 " double fYEps = 1.0E-307;\n"
1149 " double fXEps = 2.22045e-016;\n"
1150 " double fAy = arg0-GetGammaInvValue(arg1,arg2,fAx);\n"
1151 " double fBy = arg0-GetGammaInvValue(arg1,arg2,fBx);\n"
1153 " unsigned short nCount;\n"
1154 " for (nCount = 0; nCount < 1000 && !((fAy < 0.0 && fBy > 0.0)"
1155 " || (fAy > 0.0 && fBy < 0.0)); nCount++)\n"
1157 " if (fabs(fAy) <= fabs(fBy))\n"
1160 " fAx += 2.0 * (fAx - fBx);\n"
1165 " fAy = arg0-GetGammaInvValue(arg1,arg2,fAx);\n"
1170 " fBx += 2.0 * (fBx - fAx);\n"
1173 " fBy = arg0-GetGammaInvValue(arg1,arg2,fBx);\n"
1176 " if (fAy == 0.0)\n"
1181 " if (fBy == 0.0)\n"
1186 " if (!((fAy < 0.0 && fBy > 0.0) || (fAy > 0.0 && fBy < 0.0)))\n"
1188 " bConvError = true;\n"
1192 " double fPx = fAx;\n"
1193 " double fPy = fAy;\n"
1194 " double fQx = fBx;\n"
1195 " double fQy = fBy;\n"
1196 " double fRx = fAx;\n"
1197 " double fRy = fAy;\n"
1198 " double fSx = 0.5 * (fAx + fBx);\n"
1199 " bool bHasToInterpolate = true;\n"
1201 " while ( nCount < 500 && fabs(fRy) > fYEps &&"
1202 "(fBx-fAx) > fmax( fabs(fAx), fabs(fBx)) * fXEps )\n"
1204 " if (bHasToInterpolate)\n"
1206 " if (fPy!=fQy && fQy!=fRy && fRy!=fPy)\n"
1208 " fSx = fPx * fRy * fQy / (fRy-fPy) / (fQy-fPy)"
1209 "+ fRx * fQy * fPy / (fQy-fRy) / (fPy-fRy)"
1210 "+ fQx * fPy * fRy / (fPy-fQy) / (fRy-fQy);\n"
1211 " bHasToInterpolate = (fAx < fSx) && (fSx < fBx);\n"
1214 " bHasToInterpolate = false;\n"
1216 " if(!bHasToInterpolate)\n"
1218 " fSx = 0.5 * (fAx + fBx);\n"
1219 " fPx = fAx; fPy = fAy;\n"
1220 " fQx = fBx; fQy = fBy;\n"
1221 " bHasToInterpolate = true;\n"
1223 " fPx = fQx; fQx = fRx; fRx = fSx;\n"
1224 " fPy = fQy; fQy = fRy;\n"
1225 " fRy = arg0-GetGammaInvValue(arg1,arg2,fSx);\n"
1226 " if ((fAy < 0.0 && fRy > 0.0) || (fAy > 0.0 && fRy < 0.0))\n"
1236 " bHasToInterpolate = bHasToInterpolate && (fabs(fRy)"
1237 " * 2.0 <= fabs(fQy));\n"
1246 std::set<std::string>& funs)
1258 const std::string &sSymName,
SubArguments &vSubArguments)
1263 ss <<
" int gid0=get_global_id(0);\n";
1264 ss <<
" double tmp;\n";
1268 ss <<
" double fF2=floor(arg2);\n"
1269 " double fF1=floor(arg1);\n"
1270 " if( arg0 <= 0 || arg1 < 1 || arg2 < 1 || arg1 >= 1.0e10 || arg2 >= 1.0e10 || arg0 > 1 )\n"
1271 " return CreateDoubleError(IllegalArgument);\n"
1272 " double fAx=fF1*0.5;\n"
1273 " double fBx=fF1;\n"
1274 " const double fYEps = 1.0E-307;\n"
1275 " const double fXEps = 2.22045e-016;\n"
1276 " double fAy = arg0-GetFInvValue(fF1,fF2,fAx);\n"
1277 " double fBy = arg0-GetFInvValue(fF1,fF2,fBx);\n"
1279 " unsigned short nCount;\n"
1280 " for (nCount = 0; nCount < 1000 && !((fAy < 0.0 && fBy > 0.0)"
1281 " || (fAy > 0.0 && fBy < 0.0)); nCount++)\n"
1283 " if (fabs(fAy) <= fabs(fBy))\n"
1286 " fAx += 2.0 * (fAx - fBx);\n"
1291 " fAy = arg0-GetFInvValue(fF1,fF2,fAx);\n"
1296 " fBx += 2.0 * (fBx - fAx);\n"
1299 " fBy = arg0-GetFInvValue(fF1,fF2,fBx);\n"
1302 " if (fAy == 0.0)\n"
1307 " if (fBy == 0.0)\n"
1312 " if (!((fAy < 0.0 && fBy > 0.0) || (fAy > 0.0 && fBy < 0.0)))\n"
1313 " return CreateDoubleError(NoConvergence);\n"
1314 " double fPx = fAx;\n"
1315 " double fPy = fAy;\n"
1316 " double fQx = fBx;\n"
1317 " double fQy = fBy;\n"
1318 " double fRx = fAx;\n"
1319 " double fRy = fAy;\n"
1320 " double fSx = 0.5 * (fAx + fBx);\n"
1321 " bool bHasToInterpolate = true;\n"
1323 " while ( nCount < 500 && fabs(fRy) > fYEps &&"
1324 "(fBx-fAx) > fmax( fabs(fAx), fabs(fBx)) * fXEps )\n"
1326 " if (bHasToInterpolate)\n"
1328 " if (fPy!=fQy && fQy!=fRy && fRy!=fPy)\n"
1330 " fSx = fPx * fRy * fQy / (fRy-fPy)"
1331 " / (fQy-fPy)+fRx * fQy * fPy / (fQy-fRy)"
1332 " / (fPy-fRy)+ fQx * fPy * fRy / (fPy-fQy)"
1334 " bHasToInterpolate = (fAx < fSx) && (fSx < fBx);\n"
1337 " bHasToInterpolate = false;\n"
1339 " if(!bHasToInterpolate)\n"
1341 " fSx = 0.5 * (fAx + fBx);\n"
1342 " fPx = fAx; fPy = fAy;\n"
1343 " fQx = fBx; fQy = fBy;\n"
1344 " bHasToInterpolate = true;\n"
1346 " fPx = fQx; fQx = fRx; fRx = fSx;\n"
1347 " fPy = fQy; fQy = fRy;\n"
1348 " fRy = arg0-GetFInvValue(fF1,fF2,fSx);\n"
1349 " if ((fAy < 0.0 && fRy > 0.0) || (fAy > 0.0 && fRy < 0.0))\n"
1351 " fBx = fRx; fBy = fRy;\n"
1355 " fAx = fRx; fAy = fRy;\n"
1357 " bHasToInterpolate = bHasToInterpolate && (fabs(fRy)"
1358 " * 2.0 <= fabs(fQy));\n"
1366 std::set<std::string>& funs)
1379 const std::string &sSymName,
SubArguments &vSubArguments)
1384 ss <<
" int gid0 = get_global_id(0);\n";
1385 ss <<
" double fSum1 = 0.0;\n";
1386 ss <<
" double fSumSqr1 = 0.0;\n";
1387 ss <<
" double fSum2 = 0.0;\n";
1388 ss <<
" double fSumSqr2 = 0.0;\n";
1389 ss <<
" double fLength1 = 0.0;\n";
1390 ss <<
" double fLength2 = 0.0;\n";
1391 ss <<
" double tmp = 0;\n";
1394 " fSumSqr1 += arg * arg;\n"
1399 " fSumSqr2 += arg * arg;\n"
1402 ss <<
" if(fLength1 < 2 || fLength2 < 2)\n"
1403 " return CreateDoubleError(NoValue);\n"
1404 " double fS1 = (fSumSqr1-fSum1*fSum1/fLength1)/(fLength1-1.0);\n"
1405 " double fS2 = (fSumSqr2-fSum2*fSum2/fLength2)/(fLength2-1.0);\n"
1406 " if(fS1 == 0 || fS2 == 0)\n"
1407 " return CreateDoubleError(NoValue);\n"
1408 " double fF, fF1, fF2;\n"
1412 " fF1 = fLength1-1.0;\n"
1413 " fF2 = fLength2-1.0;\n"
1418 " fF1 = fLength2-1.0;\n"
1419 " fF2 = fLength1-1.0;\n"
1421 " double fFcdf = GetFDist(fF, fF1, fF2);\n"
1422 " return 2.0*min(fFcdf, 1 - fFcdf);\n";
1426 std::set<std::string>& funs)
1441 const std::string &sSymName,
SubArguments &vSubArguments)
1446 ss <<
" int gid0=get_global_id(0);\n";
1447 ss <<
" double min = 2.22507e-308;\n";
1448 ss <<
" double tmp;\n";
1453 ss <<
" double rxs = floor(arg2);\n"
1454 " double rxe = floor(arg3);\n"
1455 " double rn = floor(arg0);\n"
1456 " double rq = (0.5 - arg1) + 0.5;\n"
1457 " bool bIsValidX = (0.0 <= rxs && rxs <= rxe && rxe <= rn);\n"
1458 " if (bIsValidX && 0.0 < arg1 && arg1 < 1.0)\n"
1460 " if (rxs == rxe)\n"
1461 " tmp = GetBinomDistPMF(rxs, rn, arg1);\n"
1464 " double fFactor = pow(rq, rn);\n"
1465 " if (fFactor > min)\n"
1467 " lcl_GetBinomDistRange(rn, rxs, rxe, fFactor, arg1, rq);\n"
1470 " fFactor = pow(arg1, rn);\n"
1471 " if (fFactor > min)\n"
1474 "lcl_GetBinomDistRange(rn, rn - rxe, rn - rxs, fFactor, rq, arg1);\n"
1478 "GetBetaDist(rq, rn - rxe, rxe + 1.0)"
1479 "- GetBetaDist(rq, rn - rxs + 1, rxs);\n"
1487 " if (arg1 == 0.0)\n"
1488 " tmp = (rxs == 0.0 ? 1.0 : 0.0);\n"
1489 " else if (arg1 == 1.0)\n"
1490 " tmp = (rxe == rn ? 1.0 : 0.0);\n"
1505 std::set<std::string>& funs)
1516 std::set<std::string>& funs)
1546 ss <<
" double tmp;\n";
1547 ss <<
" int gid0=get_global_id(0);\n";
1551 ss <<
" x = floor(x);\n";
1552 ss <<
" if (lambda <= 0.0 || x < 0.0)\n";
1553 ss <<
" return CreateDoubleError(IllegalArgument);\n";
1554 ss <<
" if (!bCumulative)\n";
1556 ss <<
" if(lambda == 0.0)\n";
1558 ss <<
" return 0;\n";
1562 ss <<
" if (lambda >712)\n";
1564 ss <<
" tmp = (exp(x*log(lambda)-lambda-GetLogGamma(x+1.0)));\n";
1565 ss <<
" return tmp;\n";
1569 ss <<
" double fPoissonVar = 1.0;\n";
1570 ss <<
" for ( int f = 0; f < x; ++f )\n";
1571 ss <<
" fPoissonVar *= lambda / ( (double)f + 1.0 );\n";
1572 ss <<
" tmp = ( fPoissonVar * exp( -lambda ) );\n";
1573 ss <<
" return tmp;\n";
1579 ss <<
" if (lambda == 0.0)\n";
1581 ss <<
" return 1;\n";
1585 ss <<
" if (lambda > 712 )\n";
1587 ss <<
" tmp = (GetUpRegIGamma(x+1.0,lambda));\n";
1588 ss <<
" return tmp;\n";
1592 ss <<
" if (x >= 936.0)\n";
1594 ss <<
" return 1;\n";
1598 ss <<
" double fSummand = exp(-lambda);\n";
1599 ss <<
" double fSum = fSummand;\n";
1600 ss <<
" int nEnd = (int) (x + 0.5);\n";
1601 ss <<
" for (int i = 1; i <= nEnd; i++)\n";
1603 ss <<
" fSummand = (fSummand*lambda)/((double)i);\n";
1604 ss <<
" fSum += fSummand;\n";
1606 ss <<
" tmp = fSum;\n";
1607 ss <<
" return tmp;\n";
1616 const std::string &sSymName,
SubArguments &vSubArguments)
1621 ss <<
" int gid0=get_global_id(0);\n";
1622 ss <<
" double tmp;\n";
1629 ss <<
" double fScale = arg4 - arg3;\n"
1630 " if (fScale <= 0.0 || arg1 <= 0.0 || arg2 <= 0.0)\n"
1631 " return CreateDoubleError(IllegalArgument);\n"
1634 " if (arg0< arg3)\n"
1639 " if (arg0 > arg4)\n"
1644 " arg0 = (arg0-arg3)/fScale;\n"
1645 " tmp = GetBetaDist(arg0, arg1, arg2);\n"
1649 " if (arg0 < arg3 || arg0 > arg4 )\n"
1654 " arg0 = (arg0 - arg3)/fScale;\n"
1655 " tmp = GetBetaDistPDF(arg0, arg1, arg2)/fScale;\n"
1657 ss <<
" return tmp;\n";
1661 std::set<std::string>& funs)
1695 ss <<
" int gid0=get_global_id(0);\n";
1701 ss <<
" if (tmp0 < 0.0 || tmp0 > 1.0 ||";
1702 ss <<
"tmp3 >= tmp4 || tmp1 <= 0.0 || tmp2 <= 0.0)\n";
1704 ss <<
" return CreateDoubleError(IllegalArgument);\n";
1706 ss <<
" bool bConvError;\n";
1707 ss <<
" double fVal = lcl_IterateInverseBetaInv";
1708 ss <<
"(tmp0, tmp1, tmp2, 0.0, 1.0, &bConvError);\n";
1709 ss <<
" if(bConvError)\n";
1710 ss <<
" return CreateDoubleError(NoConvergence);\n";
1711 ss <<
" return (tmp3 + fVal*(tmp4 - tmp3));\n";
1715 const std::string &sSymName,
SubArguments& vSubArguments)
1720 ss <<
" int gid0 = get_global_id(0);\n";
1721 ss <<
" double vSum = 0.0;\n";
1722 ss <<
" double vMean = 0.0;\n";
1723 ss <<
" int cnt = 0;\n";
1728 ss <<
" vMean = vSum / cnt;\n";
1729 ss <<
" vSum = 0.0;\n";
1731 " vSum += ( arg - vMean ) * ( arg - vMean );\n"
1733 ss <<
" return vSum;\n";
1738 const std::string &sSymName,
SubArguments &vSubArguments)
1743 ss <<
" int gid0=get_global_id(0);\n";
1755 " double tmp = 0;\n"
1756 " if( (x < 0.0) || (n < x) || (N < n) ||"
1757 "(N < M) || (M < 0.0) )\n"
1759 " return CreateDoubleError(IllegalArgument);\n"
1761 " for(int i = (fCumulative ? 0 : x); i <= x; ++i )\n"
1763 " if( (M < i) || (i < n - N + M) )\n"
1770 " num[5]=N-M-n+i;\n"
1774 " for(int i=0;i<9;i++)\n"
1781 " num[i]=log(tgamma(num[i])*num[i]);\n"
1784 " num[i]=0.5*log(2.0*M_PI)+(num[i]+0.5)*log(num[i])-num[i]+\n"
1785 " (1.0/(12.0*num[i])-1.0/(360*pow(num[i],3)));\n"
1787 " tmp+=pow(M_E,(num[0]+num[3]+num[7]+num[8]-num[1]-num[2]-num[4]-num[5]-num[6]));\n"
1794 const std::string &sSymName,
SubArguments &vSubArguments)
1799 ss <<
" int gid0 = get_global_id(0);\n";
1800 ss <<
" double sum=0.0;\n";
1801 ss <<
" double totallength=0;\n";
1806 ss <<
" double mean = sum / totallength;\n";
1807 ss <<
" sum = 0.0;\n";
1809 " sum += fabs(arg-mean);\n"
1811 ss <<
" return sum/totallength;\n";
1818 const std::string &sSymName,
SubArguments& vSubArguments)
1825 ss <<
" int gid0 = get_global_id(0);\n";
1826 ss <<
" double fSumX = 0.0;\n";
1827 ss <<
" double fSumY = 0.0;\n";
1828 ss <<
" double fMeanX = 0.0;\n";
1829 ss <<
" double fMeanY = 0.0;\n";
1830 ss <<
" double fSumDeltaXDeltaY = 0.0;\n";
1831 ss <<
" double fCount = 0.0;\n";
1837 ss <<
" if( fCount < 1 )\n";
1838 ss <<
" return CreateDoubleError(NoValue);\n";
1839 ss <<
" fMeanX = fSumX / fCount;\n";
1840 ss <<
" fMeanY = fSumY / fCount;\n";
1842 " fSumDeltaXDeltaY +=(arg1-fMeanX)*(arg2-fMeanY);\n"
1844 ss <<
" return fSumDeltaXDeltaY / fCount;\n";
1849 const std::string &sSymName,
SubArguments &vSubArguments)
1856 ss <<
" int gid0 = get_global_id(0);\n";
1857 ss <<
" double fSumX = 0.0;\n";
1858 ss <<
" double fSumY = 0.0;\n";
1859 ss <<
" double fMeanX = 0.0;\n";
1860 ss <<
" double fMeanY = 0.0;\n";
1861 ss <<
" double fSumDeltaXDeltaY = 0.0;\n";
1862 ss <<
" double fSumSqrDeltaX = 0.0;\n";
1863 ss <<
" double fCount = 0.0;\n";
1871 ss <<
" if( fCount < 1 )\n";
1872 ss <<
" return CreateDoubleError(NoValue);\n";
1873 ss <<
" fMeanX = fSumX / fCount;\n";
1874 ss <<
" fMeanY = fSumY / fCount;\n";
1876 " fSumDeltaXDeltaY +=(arg2-fMeanX)*(arg1-fMeanY);\n"
1877 " fSumSqrDeltaX += (arg2-fMeanX)*(arg2-fMeanX);\n"
1879 ss <<
" if(fSumSqrDeltaX == 0.0)\n";
1880 ss <<
" return CreateDoubleError(DivisionByZero);\n";
1881 ss <<
" return fMeanY + fSumDeltaXDeltaY / fSumSqrDeltaX * (arg0 - fMeanX);\n";
1886 SubArguments &vSubArguments,
const char* finalComputeCode )
1893 ss <<
" int gid0 = get_global_id(0);\n";
1894 ss <<
" double fSumX = 0.0;\n";
1895 ss <<
" double fSumY = 0.0;\n";
1896 ss <<
" double fMeanX = 0.0;\n";
1897 ss <<
" double fMeanY = 0.0;\n";
1898 ss <<
" double fSumDeltaXDeltaY = 0.0;\n";
1899 ss <<
" double fSumSqrDeltaX = 0.0;\n";
1900 ss <<
" double fCount = 0.0;\n";
1907 ss <<
" if( fCount < 1 )\n";
1908 ss <<
" return CreateDoubleError(NoValue);\n";
1909 ss <<
" fMeanX = fSumX / fCount;\n";
1910 ss <<
" fMeanY = fSumY / fCount;\n";
1912 " fSumDeltaXDeltaY +=(arg2-fMeanX)*(arg1-fMeanY);\n"
1913 " fSumSqrDeltaX += (arg2-fMeanX)*(arg2-fMeanX);\n"
1915 ss << finalComputeCode;
1920 const std::string &sSymName,
SubArguments &vSubArguments)
1923 " if(fSumSqrDeltaX == 0.0)\n"
1924 " return CreateDoubleError(DivisionByZero);\n"
1925 " return fMeanY - (fSumDeltaXDeltaY/fSumSqrDeltaX)*fMeanX;\n"
1930 const std::string &sSymName,
SubArguments &vSubArguments)
1933 " if(fSumSqrDeltaX == 0.0)\n"
1934 " return CreateDoubleError(DivisionByZero);\n"
1935 " return fSumDeltaXDeltaY / fSumSqrDeltaX;\n"
1940 SubArguments &vSubArguments,
double minimalCountValue,
const char* finalComputeCode )
1947 ss <<
" int gid0 = get_global_id(0);\n";
1948 ss <<
" double fSumX = 0.0;\n";
1949 ss <<
" double fSumY = 0.0;\n";
1950 ss <<
" double fMeanX = 0.0;\n";
1951 ss <<
" double fMeanY = 0.0;\n";
1952 ss <<
" double fSumDeltaXDeltaY = 0.0;\n";
1953 ss <<
" double fSumSqrDeltaX = 0.0;\n";
1954 ss <<
" double fSumSqrDeltaY = 0.0;\n";
1955 ss <<
" double fCount = 0.0;\n";
1962 ss <<
" if( fCount < " << minimalCountValue <<
" )\n";
1963 ss <<
" return CreateDoubleError(NoValue);\n";
1964 ss <<
" fMeanX = fSumX / fCount;\n";
1965 ss <<
" fMeanY = fSumY / fCount;\n";
1967 " fSumDeltaXDeltaY +=(arg2-fMeanX)*(arg1-fMeanY);\n"
1968 " fSumSqrDeltaX += (arg2-fMeanX)*(arg2-fMeanX);\n"
1969 " fSumSqrDeltaY += (arg1-fMeanY)*(arg1-fMeanY);\n"
1971 ss << finalComputeCode;
1979 " if (fSumSqrDeltaX == 0 || fSumSqrDeltaY == 0)\n"
1980 " return CreateDoubleError(DivisionByZero);\n"
1981 " return ( fSumDeltaXDeltaY / sqrt( fSumSqrDeltaX * fSumSqrDeltaY));\n"
1986 const std::string &sSymName,
SubArguments &vSubArguments)
1989 " if(fSumSqrDeltaX == 0.0)\n"
1990 " return CreateDoubleError(DivisionByZero);\n"
1991 " return sqrt((fSumSqrDeltaY - fSumDeltaXDeltaY * \n"
1992 " fSumDeltaXDeltaY / fSumSqrDeltaX)\n"
1993 " /(fCount - 2.0));\n"
2002 " if (fSumSqrDeltaX == 0 || fSumSqrDeltaY == 0)\n"
2003 " return CreateDoubleError(DivisionByZero);\n"
2004 " return ( fSumDeltaXDeltaY * fSumDeltaXDeltaY / (fSumSqrDeltaX * fSumSqrDeltaY));\n"
2023 ss <<
" int gid0 = get_global_id(0);\n";
2024 ss <<
" double fSum = 0.0;\n";
2025 ss <<
" double fCount = 0.0;\n";
2030 ss <<
" if (fCount == 0)\n";
2031 ss <<
" return CreateDoubleError(DivisionByZero);\n";
2032 ss <<
" double fMean = fSum / fCount;\n";
2033 ss <<
" double vSum = 0.0;\n";
2035 " vSum += pown( fsub_approx(arg, fMean), 2 );\n"
2040 const std::string &sSymName,
SubArguments &vSubArguments)
2043 ss <<
" if (fCount <= 1.0)\n";
2044 ss <<
" return CreateDoubleError(DivisionByZero);\n";
2046 ss <<
" return vSum / (fCount - 1.0);\n";
2051 const std::string &sSymName,
SubArguments &vSubArguments)
2054 ss <<
" if (fCount == 0.0)\n";
2055 ss <<
" return CreateDoubleError(DivisionByZero);\n";
2057 ss <<
" return vSum / fCount;\n";
2062 const std::string &sSymName,
SubArguments &vSubArguments)
2065 ss <<
" if (fCount <= 1.0)\n";
2066 ss <<
" return CreateDoubleError(DivisionByZero);\n";
2068 ss <<
" return sqrt(vSum / (fCount - 1.0));\n";
2073 const std::string &sSymName,
SubArguments &vSubArguments)
2076 ss <<
" if (fCount <= 0.0)\n";
2077 ss <<
" return CreateDoubleError(DivisionByZero);\n";
2079 ss <<
" return sqrt(vSum / fCount);\n";
2084 const std::string &sSymName,
SubArguments &vSubArguments)
2087 ss <<
" if(fCount <= 2.0)\n";
2088 ss <<
" return CreateDoubleError(DivisionByZero);\n";
2089 ss <<
" double fStdDev = sqrt(vSum / (fCount - 1.0));\n";
2090 ss <<
" double dx = 0.0;\n";
2091 ss <<
" double xcube = 0.0;\n";
2092 ss <<
" if(fStdDev == 0.0)\n";
2093 ss <<
" return CreateDoubleError(IllegalArgument);\n";
2095 " dx = fsub_approx(arg, fMean) / fStdDev;\n"
2096 " xcube = xcube + dx * dx * dx;\n"
2098 ss <<
" return ((xcube * fCount) / (fCount - 1.0)) / (fCount - 2.0);\n";
2103 const std::string &sSymName,
SubArguments &vSubArguments)
2106 ss <<
" if(fCount <= 2.0)\n";
2107 ss <<
" return CreateDoubleError(DivisionByZero);\n";
2108 ss <<
" double fStdDev = sqrt(vSum / fCount);\n";
2109 ss <<
" double dx = 0.0;\n";
2110 ss <<
" double xcube = 0.0;\n";
2111 ss <<
" if(fStdDev == 0.0)\n";
2112 ss <<
" return CreateDoubleError(IllegalArgument);\n";
2114 " dx = fsub_approx(arg, fMean) / fStdDev;\n"
2115 " xcube = xcube + dx * dx * dx;\n"
2117 ss <<
" return xcube / fCount;\n";
2122 const std::string &sSymName,
SubArguments &vSubArguments)
2125 ss <<
" if( fCount < 4 )\n";
2126 ss <<
" return CreateDoubleError(DivisionByZero);\n";
2127 ss <<
" double fStdDev = sqrt(vSum / (fCount - 1.0));\n";
2128 ss <<
" double dx = 0.0;\n";
2129 ss <<
" double xpower4 = 0.0;\n";
2131 " dx = (arg -fMean) / fStdDev;\n"
2132 " xpower4 = xpower4 + (dx * dx * dx * dx);\n"
2134 ss<<
" double k_d = (fCount - 2.0) * (fCount - 3.0);\n";
2135 ss<<
" double k_l = fCount * (fCount + 1.0) / ((fCount - 1.0) * k_d);\n";
2136 ss<<
" double k_t = 3.0 * (fCount - 1.0) * (fCount - 1.0) / k_d;\n";
2137 ss<<
" return xpower4 * k_l - k_t;\n";
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &decls, std::set< std::string > &funs) override
void BinInlineFun(std::set< std::string > &decls, std::set< std::string > &funs) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
void BinInlineFun(std::set< std::string > &decls, std::set< std::string > &funs) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &, std::set< std::string > &) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &, std::set< std::string > &) override
virtual void BinInlineFun(std::set< std::string > &, std::set< std::string > &) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &, std::set< std::string > &) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &, std::set< std::string > &) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &, std::set< std::string > &) override
virtual std::string GetBottom() override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &, std::set< std::string > &) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &, std::set< std::string > &) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual std::string GetBottom() override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
void BinInlineFun(std::set< std::string > &decls, std::set< std::string > &funs) override
void BinInlineFun(std::set< std::string > &decls, std::set< std::string > &funs) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &, std::set< std::string > &) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
void BinInlineFun(std::set< std::string > &decls, std::set< std::string > &funs) override
void BinInlineFun(std::set< std::string > &decls, std::set< std::string > &funs) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &, std::set< std::string > &) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
void GenerateCode(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments, const char *finalComputeCode)
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &, std::set< std::string > &) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &decls, std::set< std::string > &funs) override
virtual void BinInlineFun(std::set< std::string > &decls, std::set< std::string > &funs) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &, std::set< std::string > &) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &, std::set< std::string > &) override
void GenerateCode(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments, double minimalCountValue, const char *finalComputeCode)
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &, std::set< std::string > &) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &, std::set< std::string > &) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &, std::set< std::string > &) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &, std::set< std::string > &) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
void GenerateCode(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments)
virtual void BinInlineFun(std::set< std::string > &decls, std::set< std::string > &funs) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void GenSlidingWindowFunction(outputstream &ss, const std::string &sSymName, SubArguments &vSubArguments) override
virtual void BinInlineFun(std::set< std::string > &, std::set< std::string > &) override
void GenerateArg(const char *name, int arg, SubArguments &vSubArguments, outputstream &ss, EmptyArgType empty=EmptyIsZero, GenerateArgTypeType generateType=DoNotGenerateArgType)
static void GenerateRangeArg(int arg, SubArguments &vSubArguments, outputstream &ss, EmptyArgType empty, const char *code)
void GenerateArgWithDefault(const char *name, int arg, double def, SubArguments &vSubArguments, outputstream &ss, EmptyArgType empty=EmptyIsZero)
void GenerateFunctionDeclaration(const std::string &sSymName, SubArguments &vSubArguments, outputstream &ss)
static void GenerateRangeArgPair(int arg1, int arg2, SubArguments &vSubArguments, outputstream &ss, EmptyArgType empty, const char *code, const char *firstElementDiff=nullptr)
static void GenerateRangeArgs(int firstArg, int lastArg, SubArguments &vSubArguments, outputstream &ss, EmptyArgType empty, const char *code)
std::vector< DynamicKernelArgumentRef > SubArguments
const char is_representable_integerDecl[]
const char fsub_approxDecl[]
const char approx_equalDecl[]
const char approx_equal[]
const char is_representable_integer[]
const char lcl_GetGammaHelperDecl[]
const char GetGammaContFraction[]
const char GetFInvValue[]
const char lcl_GetLogGammaHelperDecl[]
const char GetGammaInvValueDecl[]
const char fMachEpsDecl[]
const char GetLogBetaDecl[]
const char lcl_IterateInverseBetaInv[]
const char GetChiSqDistPDF[]
const char lcl_IterateInverseDecl[]
const char lcl_IterateInverseBetaInvDecl[]
const char lcl_GetGammaHelper[]
const char GetBetaDistPDFDecl[]
const char GetUpRegIGamma[]
const char fMaxGammaArgumentDecl[]
const char gaussinvDecl[]
const char fsum_countDecl[]
const char GetFInvValueDecl[]
const char lcl_GetBetaHelperContFracDecl[]
const char GetBetaDistDecl[]
const char GetGammaInvValue[]
const char GetLogGammaDecl[]
const char GetBinomDistPMF[]
const char GetLowRegIGamma[]
const char lcl_IterateInverseChiInv[]
const char GetChiDistDecl[]
const char lcl_IterateInverseChiSQInvDecl[]
const char GetValueDecl[]
const char GetChiSqDistPDFDecl[]
const char lcl_IterateInverse[]
const char lcl_GetBinomDistRange[]
const char lcl_IterateInverseChiInvDecl[]
const char GetLowRegIGammaDecl[]
const char lcl_getLanczosSumDecl[]
const char GetGammaSeriesDecl[]
const char fmin_countDecl[]
const char GetGammaDistPDFDecl[]
const char lcl_HasChangeOfSignDecl[]
const char lcl_GetLogGammaHelper[]
const char GetFDistDecl[]
const char lcl_GetBinomDistRangeDecl[]
const char fHalfMachEpsDecl[]
const char lcl_HasChangeOfSign[]
const char GetChiSqDistCDFDecl[]
const char fLogDblMaxDecl[]
const char GetTDistDecl[]
const char GetGammaContFractionDecl[]
const char lcl_IterateInverseChiSQInv[]
const char lcl_getLanczosSum[]
const char GetGammaDistPDF[]
const char GetChiSqDistCDF[]
const char GetGammaSeries[]
const char GetGammaDistDecl[]
const char GetUpRegIGammaDecl[]
const char GetBinomDistPMFDecl[]
const char fmax_countDecl[]
const char GetGammaDist[]
const char GetBetaDistPDF[]
const char lcl_GetBetaHelperContFrac[]
#define CHECK_PARAMETER_DOUBLEVECTORREF(arg)
#define CHECK_PARAMETER_COUNT(min, max)