本文整理汇总了C++中Double::setZeros方法的典型用法代码示例。如果您正苦于以下问题:C++ Double::setZeros方法的具体用法?C++ Double::setZeros怎么用?C++ Double::setZeros使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Double
的用法示例。
在下文中一共展示了Double::setZeros方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RDivideDoubleByDouble
int RDivideDoubleByDouble(Double *_pDouble1, Double *_pDouble2, Double **_pDoubleOut)
{
int iErr = 0;
//check finite values of _pDouble1 and _pDouble2
if (isDoubleFinite(_pDouble1) == false || isDoubleFinite(_pDouble2) == false)
{
if (_pDouble2->isScalar() == false)
{
return 2;
}
}
if (_pDouble2->isScalar())
{
//Y / x
int iInc1 = 1;
int iInc2 = 0;
bool bComplex1 = _pDouble1->isComplex();
bool bComplex2 = _pDouble2->isComplex();
*_pDoubleOut = new Double(_pDouble1->getDims(), _pDouble1->getDimsArray(), bComplex1 || bComplex2);
if (bComplex1 == false && bComplex2 == false)
{
// Real1 \ Real2 -> Real2 / Real1
iErr = iRightDivisionRealMatrixByRealMatrix(
_pDouble1->get(), iInc1,
_pDouble2->get(), iInc2,
(*_pDoubleOut)->get(), 1, _pDouble1->getSize());
}
else if (bComplex1 == false && bComplex2 == true)
{
// Real \ Complex -> Complex / Real
iErr = iRightDivisionRealMatrixByComplexMatrix(
_pDouble1->get(), iInc1,
_pDouble2->get(), _pDouble2->getImg(), iInc2,
(*_pDoubleOut)->get(), (*_pDoubleOut)->getImg(), 1, _pDouble1->getSize());
}
else if (bComplex1 == true && bComplex2 == false)
{
// Complex \ Real -> Real / Complex
iErr = iRightDivisionComplexMatrixByRealMatrix(
_pDouble1->get(), _pDouble1->getImg(), iInc1,
_pDouble2->get(), iInc2,
(*_pDoubleOut)->get(), (*_pDoubleOut)->getImg(), 1, _pDouble1->getSize());
}
else if (bComplex1 == true && bComplex2 == true)
{
// Complex \ Complex
iErr = iRightDivisionComplexMatrixByComplexMatrix(
_pDouble1->get(), _pDouble1->getImg(), iInc1,
_pDouble2->get(), _pDouble2->getImg(), iInc2,
(*_pDoubleOut)->get(), (*_pDoubleOut)->getImg(), 1, _pDouble1->getSize());
}
return iErr;
}
if (_pDouble1->isScalar())
{
if (_pDouble2->getDims() > 2)
{
//not managed, call overload
return 0;
}
// x / eye() = x
if (_pDouble2->isIdentity() )
{
*_pDoubleOut = new Double(*_pDouble1);
return 0;
}
double dblSavedR = 0;
double dblSavedI = 0;
Double *pdblTemp = NULL;
int iRowResult = _pDouble2->getCols();
int iColResult = _pDouble2->getRows();
//in this case, we have to create a temporary square matrix
pdblTemp = new Double(iRowResult, iRowResult, _pDouble1->isComplex());
pdblTemp->setZeros();
if (_pDouble1->isComplex())
{
dblSavedR = _pDouble1->getReal()[0];
dblSavedI = _pDouble1->getImg()[0];
for (int i = 0 ; i < iRowResult ; i++)
{
pdblTemp->set(i, i, dblSavedR);
pdblTemp->setImg(i, i, dblSavedI);
}
}
else
{
dblSavedR = _pDouble1->getReal()[0];
//.........这里部分代码省略.........