本文整理汇总了C++中Double::isComplex方法的典型用法代码示例。如果您正苦于以下问题:C++ Double::isComplex方法的具体用法?C++ Double::isComplex怎么用?C++ Double::isComplex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Double
的用法示例。
在下文中一共展示了Double::isComplex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RDividePolyByDouble
int RDividePolyByDouble(Polynom* _pPoly, Double* _pDouble, Polynom** _pPolyOut)
{
bool bComplex1 = _pPoly->isComplex();
bool bComplex2 = _pDouble->isComplex();
bool bScalar1 = _pPoly->getRows() == 1 && _pPoly->getCols() == 1;
bool bScalar2 = _pDouble->getRows() == 1 && _pDouble->getCols() == 1;
Polynom *pTemp = NULL; //use only if _pPoly is scalar and _pDouble not.
int iRowResult = 0;
int iColResult = 0;
int *piRank = NULL;
/* if(bScalar1 && bScalar2)
{
iRowResult = 1;
iColResult = 1;
piRank = new int[1];
piRank[0] = _pPoly->get(0)->getRank();
}
else */
if (bScalar1 == false && bScalar2 == false)
{
// call overload
return 0;
}
if (bScalar2)
{
double dblDivR = _pDouble->get(0);
double dblDivI = _pDouble->getImg(0);
(*_pPolyOut) = _pPoly->clone()->getAs<Polynom>();
if (_pDouble->isComplex())
{
(*_pPolyOut)->setComplex(true);
}
for (int i = 0 ; i < _pPoly->getSize() ; i++)
{
bool bComplex1 = _pPoly->isComplex();
bool bComplex2 = _pDouble->isComplex();
SinglePoly* pC = (*_pPolyOut)->get(i);
if (bComplex1 == false && bComplex2 == false)
{
iRightDivisionRealMatrixByRealMatrix(pC->get(), 1, &dblDivR, 0, pC->get(), 1, pC->getSize());
}
else if (bComplex1 == true && bComplex2 == false)
{
iRightDivisionComplexMatrixByRealMatrix(pC->get(), pC->getImg(), 1, &dblDivR, 0, pC->get(), pC->getImg(), 1, pC->getSize());
}
else if (bComplex1 == false && bComplex2 == true)
{
iRightDivisionRealMatrixByComplexMatrix(pC->get(), 1, &dblDivR, &dblDivI, 0, pC->get(), pC->getImg(), 1, pC->getSize());
}
else if (bComplex1 == true && bComplex2 == true)
{
iRightDivisionComplexMatrixByComplexMatrix(pC->get(), pC->getImg(), 1, &dblDivR, &dblDivI, 0, pC->get(), pC->getImg(), 1, pC->getSize());
}
}
return 0;
}
if (bScalar1)
{
//in this case, we have to create a temporary square polinomial matrix
iRowResult = _pDouble->getCols();
iColResult = _pDouble->getRows();
piRank = new int[iRowResult * iRowResult];
int iMaxRank = _pPoly->getMaxRank();
for (int i = 0 ; i < iRowResult * iRowResult ; i++)
{
piRank[i] = iMaxRank;
}
pTemp = new Polynom(_pPoly->getVariableName(), iRowResult, iRowResult, piRank);
if (bComplex1 || bComplex2)
{
pTemp->setComplex(true);
}
SinglePoly *pdblData = _pPoly->get(0);
for (int i = 0 ; i < iRowResult ; i++)
{
pTemp->set(i, i, pdblData);
}
}
(*_pPolyOut) = new Polynom(_pPoly->getVariableName(), iRowResult, iColResult, piRank);
delete[] piRank;
if (bComplex1 || bComplex2)
{
(*_pPolyOut)->setComplex(true);
}
//.........这里部分代码省略.........