本文整理汇总了C++中Double::setImg方法的典型用法代码示例。如果您正苦于以下问题:C++ Double::setImg方法的具体用法?C++ Double::setImg怎么用?C++ Double::setImg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Double
的用法示例。
在下文中一共展示了Double::setImg方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateHyperMatrixVariable
int CreateHyperMatrixVariable(void *pvApiCtx, int iVar, int type, int *iscomplex, int * rank, int *dims, matvar_t *matVariable, int * parent, int item_position)
{
GatewayStruct* pStr = (GatewayStruct*)pvApiCtx;
typed_list in = *pStr->m_pIn;
InternalType** out = pStr->m_pOut;
int rhs = iVar - *getNbInputArgument(pvApiCtx);
switch (type)
{
case MAT_C_DOUBLE: /* 6 */
case MAT_C_SINGLE: /* 7 */
{
Double* pDbl = new Double(rank[0], dims, (bool)(iscomplex[0] != 0));
if (iscomplex[0])
{
mat_complex_split_t *mat5ComplexData = NULL;
mat5ComplexData = (mat_complex_split_t*)matVariable->data;
pDbl->set((double*)mat5ComplexData->Re);
pDbl->setImg((double*)mat5ComplexData->Im);
}
else
{
pDbl->set((double*)matVariable->data);
}
out[rhs - 1] = pDbl;
}
break;
case MAT_C_INT8: /* 8 */
{
Int8* pInt8 = new Int8(rank[0], dims);
pInt8->set((char*)matVariable->data);
out[rhs - 1] = pInt8;
}
break;
case MAT_C_UINT8: /* 9 */
{
UInt8* pUInt8 = new UInt8(rank[0], dims);
pUInt8->set((unsigned char*)matVariable->data);
out[rhs - 1] = pUInt8;
}
break;
case MAT_C_INT16: /* 10 */
{
Int16* pInt16 = new Int16(rank[0], dims);
pInt16->set((short*)matVariable->data);
out[rhs - 1] = pInt16;
}
break;
case MAT_C_UINT16: /* 11 */
{
UInt16* pUInt16 = new UInt16(rank[0], dims);
pUInt16->set((unsigned short*)matVariable->data);
out[rhs - 1] = pUInt16;
}
break;
case MAT_C_INT32: /* 12 */
{
Int32* pInt32 = new Int32(rank[0], dims);
pInt32->set((int*)matVariable->data);
out[rhs - 1] = pInt32;
}
break;
case MAT_C_UINT32: /* 13 */
{
UInt32* pUInt32 = new UInt32(rank[0], dims);
pUInt32->set((unsigned int*)matVariable->data);
out[rhs - 1] = pUInt32;
}
break;
#ifdef __SCILAB_INT64__
case MAT_C_INT64: /* 14 */
{
Int64* pInt64 = new Int64(rank[0], dims);
pInt64->set((long long*)matVariable->data);
out[rhs - 1] = pInt64;
}
break;
case MAT_C_UINT64: /* 15 */
{
UInt64* pUInt64 = new UInt64(rank[0], dims);
pUInt64->set((unsigned long long*)matVariable->data);
//.........这里部分代码省略.........
示例2: 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];
//.........这里部分代码省略.........