summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authormulei <mulei@multicorewareinc.com>2013-12-20 13:09:08 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-12-23 16:51:30 -0600
commitee48498c5b5dcd5f597d89f03d9b2db995b10f54 (patch)
tree3f2dc9784583d8d19dc85fbe59809be0a37bb9cc /sc
parentd6e0b6fc4982af7877c34980b0419efa1c90bc65 (diff)
GPU Calc: Optimized PRICEDISC
AMLOEXT-283 Change-Id: I10541f33f65a68d87931d92f520653d7751ae507 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>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/opencl/op_financial.cxx43
-rw-r--r--sc/source/core/opencl/opinlinefun_finacial.cxx3
2 files changed, 2 insertions, 44 deletions
diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx
index 71ea85837c1b..5c6da7893ff4 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -3205,57 +3205,18 @@ void OpPriceDisc::GenSlidingWindowFunction(std::stringstream &ss,
ss<<" double tmp2=0;\n";
ss<<" double tmp3=0;\n";
ss<<" double tmp4=0;\n";
- size_t nItems = 0;
ss <<" \n";
for (size_t i = 0; i < vSubArguments.size(); i++)
{
FormulaToken *pCur = vSubArguments[i]->GetFormulaToken();
assert(pCur);
- if (pCur->GetType() == formula::svDoubleVectorRef)
- {
- const formula::DoubleVectorRefToken* pDVR =
- dynamic_cast<const formula::DoubleVectorRefToken *>(pCur);
- size_t nCurWindowSize = pDVR->GetRefRowSize();
- ss << " for (int i = ";
- if (!pDVR->IsStartFixed() && pDVR->IsEndFixed()) {
-#ifdef ISNAN
- ss << "gid0; i < " << pDVR->GetArrayLength();
- ss << " && i < " << nCurWindowSize << "; i++){\n";
-#else
- ss << "gid0; i < "<< nCurWindowSize << "; i++)\n";
-#endif
- } else if (pDVR->IsStartFixed() && !pDVR->IsEndFixed()) {
-#ifdef ISNAN
- ss << "0; i < " << pDVR->GetArrayLength();
- ss << " && i < gid0+"<< nCurWindowSize << "; i++){\n";
-#else
- ss << "0; i < gid0+"<< nCurWindowSize << "; i++)\n";
-#endif
- } else if (!pDVR->IsStartFixed() && !pDVR->IsEndFixed()){
-#ifdef ISNAN
- ss << "0; i + gid0 < " << pDVR->GetArrayLength();
- ss << " && i < "<< nCurWindowSize << "; i++){\n";
-#else
- ss << "0; i < "<< nCurWindowSize << "; i++)\n";
-#endif
- }
- else {
-#ifdef ISNAN
- ss << "0; i < "<< nCurWindowSize << "; i++){\n";
-#else
- ss << "0; i < "<< nCurWindowSize << "; i++)\n";
-#endif
- }
- nItems += nCurWindowSize;
- }
- else if (pCur->GetType() == formula::svSingleVectorRef)
+ if (pCur->GetType() == formula::svSingleVectorRef)
{
#ifdef ISNAN
const formula::SingleVectorRefToken* pSVR =
dynamic_cast< const formula::SingleVectorRefToken* >(pCur);
ss << " if (gid0 < " << pSVR->GetArrayLength() << "){\n";
#else
- nItems += 1;
#endif
}
else if (pCur->GetType() == formula::svDouble)
@@ -3263,13 +3224,11 @@ void OpPriceDisc::GenSlidingWindowFunction(std::stringstream &ss,
#ifdef ISNAN
ss << "{\n";
#endif
- nItems += 1;
}
else
{
#ifdef ISNAN
#endif
- nItems += 1;
}
#ifdef ISNAN
if(ocPush==vSubArguments[i]->GetFormulaToken()->GetOpCode())
diff --git a/sc/source/core/opencl/opinlinefun_finacial.cxx b/sc/source/core/opencl/opinlinefun_finacial.cxx
index bb20802992dd..2b81df230ee2 100644
--- a/sc/source/core/opencl/opinlinefun_finacial.cxx
+++ b/sc/source/core/opencl/opinlinefun_finacial.cxx
@@ -1214,8 +1214,7 @@ std::string GetYearDiff=
" int nTotalDays = GetDiffDate( nNullDate, nStartDate, nEndDate,"
"nMode, &"
"nDays1stYear );\n"
-" double result=(double)(nTotalDays)/(nDays1stYear);\n"
-" return result;\n"
+" return (double)(nTotalDays)*pow((double)nDays1stYear,-1);\n"
"}\n";
std::string GetDiffDate360_Decl=