本文整理汇总了C++中Double::getCols方法的典型用法代码示例。如果您正苦于以下问题:C++ Double::getCols方法的具体用法?C++ Double::getCols怎么用?C++ Double::getCols使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Double
的用法示例。
在下文中一共展示了Double::getCols方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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];
//.........这里部分代码省略.........
示例2: getOptionals
int getOptionals(void* _pvCtx, char* pstFuncName, rhs_opts opts[])
{
GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
types::optional_list opt = *pStr->m_pOpt;
int i = 0;
/* reset first field since opts is declared static in calling function */
while (opts[i].pstName != NULL)
{
opts[i].iPos = -1;
i++;
}
for (i = 0 ; i < opt.size() ; i++)
{
int typeOfOpt = -1;
char* pstOpts = wide_string_to_UTF8(opt[i].first.c_str());
int index = findOptional(_pvCtx, pstOpts, opts);
FREE(pstOpts);
if (index < 0)
{
sciprint(_("%ls: Unrecognized optional arguments %ls.\n"), pStr->m_pstName, opt[i].first.c_str());
printOptionalNames(_pvCtx, opts);
return 0;
}
opts[index].iPos = i + 1;
GenericType* pGT = (GenericType*)opt[i].second;
getVarType(_pvCtx, (int*)pGT, &typeOfOpt);
opts[index].iType = typeOfOpt;
if (typeOfOpt == sci_implicit_poly)
{
InternalType* pIT = NULL;
ImplicitList* pIL = pGT->getAs<ImplicitList>();
pIT = pIL->extractFullMatrix();
Double* impResult = (Double*)pIT;
opts[index].iRows = impResult->getRows();
opts[index].iCols = impResult->getCols();
opts[index].piAddr = (int*)impResult;
opts[index].iType = sci_matrix;
}
else
{
opts[index].iRows = pGT->getRows();
opts[index].iCols = pGT->getCols();
opts[index].piAddr = (int*)pGT;
}
}
// int index = -1;
//GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
// wchar_t* pwstProperty = to_wide_string(pstProperty);
// for(int i = 0 ; i < pStr->m_pOpt->size() ; i++)
// {
// std::pair<std::wstring, InternalType*> current = (*pStr->m_pOpt)[i];
// if(wcscmp(current.first.c_str(), pwstProperty) == 0)
// {
// index = i;
// break;
// }
// }
// FREE(pwstProperty);
return 1;
}