Kaydet (Commit) 15cf2c51 authored tarafından zhenyu yuan's avatar zhenyu yuan Kaydeden (comit) I-Jui (Ray) Sung

GPU Calc: implemented LOG

AMLOEXT-170 FIX

Change-Id: If31f03025a085ad09ab73c9b5fd76b069e115d96
Signed-off-by: 's avatarhaochen <haochen@multicorewareinc.com>
Signed-off-by: 's avatarI-Jui (Ray) Sung <ray@multicorewareinc.com>
üst 5b78a953
......@@ -1289,6 +1289,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i], new OpEven));
break;
case ocLog:
mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i], new OpLog));
break;
case ocExternal:
if ( !(pChild->GetExternal().compareTo(OUString(
"com.sun.star.sheet.addin.Analysis.getEffect"))))
......
......@@ -243,6 +243,56 @@ void OpEven::GenSlidingWindowFunction(std::stringstream &ss,
ss << " return tmp;\n";
ss << "}";
}
void OpLog::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 << " double tem;\n";
ss << " double arg0,arg1;\n";
for (unsigned int i = 0; i < vSubArguments.size(); i++)
{
FormulaToken *pCur = vSubArguments[i]->GetFormulaToken();
assert(pCur);
ss << " arg"<<i<<" = "<<vSubArguments[i]->GenSlidingWindowDeclRef();
ss << ";\n";
if(pCur->GetType() == formula::svSingleVectorRef)
{
#ifdef ISNAN
const formula::SingleVectorRefToken* pSVR =
dynamic_cast< const formula::SingleVectorRefToken* >(pCur);
ss << " if(isNan(arg" << i <<")||(gid0 >= ";
ss << pSVR->GetArrayLength();
ss << "))\n";
if( i == 0)
ss << " arg0 = 0;\n";
else if ( i == 1)
ss << " arg1 = 10;\n";
}
else if (pCur->GetType() == formula::svDouble)
{
ss << " if(isNan(arg" << i <<"))\n";
if( i == 0)
ss << " arg0 = 0;\n";
else if ( i == 1)
ss << " arg1 = 10;\n";
}
#endif
}
if (vSubArguments.size() < 2)
ss << " arg1 = 10;\n";
ss << " tem = log10(arg0)/log10(arg1);;\n";
ss << " return tem;\n";
ss << "}";
}
void OpCsc::GenSlidingWindowFunction(
std::stringstream &ss, const std::string sSymName, SubArguments &vSubArguments)
{
......
......@@ -256,6 +256,14 @@ public:
virtual std::string BinFuncName(void) const { return "Combina"; }
virtual void BinInlineFun(std::set<std::string>& ,std::set<std::string>& );
};
class OpLog: public Normal
{
public:
virtual void GenSlidingWindowFunction(std::stringstream &ss,
const std::string sSymName, SubArguments &vSubArguments);
virtual std::string BinFuncName(void) const { return "Log"; }
};
}}
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment