当前位置: 首页>>代码示例>>C++>>正文


C++ Double::getSize方法代码示例

本文整理汇总了C++中Double::getSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Double::getSize方法的具体用法?C++ Double::getSize怎么用?C++ Double::getSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Double的用法示例。


在下文中一共展示了Double::getSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mxIsEmpty

int mxIsEmpty(const mxArray *ptr)
{
    InternalType * pIT = (InternalType *)ptr;
    if (pIT == NULL)
    {
        //true or false, whatever ;)
        return 1;
    }

    switch (pIT->getType())
    {
        case InternalType::ScilabDouble:
        {
            Double *pD = pIT->getAs<Double>();
            return pD->getSize() == 0;
        }
        case InternalType::ScilabCell:
        {
            Cell *pC = pIT->getAs<Cell>();
            return pC->getSize() == 0;
        }
        case InternalType::ScilabContainer:
        case InternalType::ScilabList:
        case InternalType::ScilabMList:
        case InternalType::ScilabTList:
        {
            Container *pC = pIT->getAs<Container>();
            return pC->getSize() == 0;
        }
        default:
        {
            //other type can not be empty
            return 0;
        }
    }
}
开发者ID:scitao,项目名称:scilab,代码行数:36,代码来源:mexlib.cpp

示例2: DotRDividePolyByDouble

int DotRDividePolyByDouble(Polynom* _pPoly1, Double* _pDouble2, Polynom** _pPolyOut)
{
    int iErr        = 0;
    bool bComplex1  = _pPoly1->isComplex();
    bool bComplex2  = _pDouble2->isComplex();

    //X ./ Y
    //check dimension compatibilities ( same number of dimension and same size for each dimension
    int iDims1      = _pPoly1->getDims();
    int* piDims1    = _pPoly1->getDimsArray();
    int iMaxSize    = _pPoly1->getMaxRank() + 1;
    int iSizePoly   = _pPoly1->getSize();
    int iDims2      = _pDouble2->getDims();
    int* piDims2    = _pDouble2->getDimsArray();

    if (iDims1 != iDims2)
    {
        return 1;
    }

    for (int i = 0 ; i < iDims1 ; i++)
    {
        if (piDims1[i] != piDims2[i])
        {
            return 1;
        }
    }

    // compute output ranks
    int* piRanks = new int[iSizePoly];
    for (int i = 0; i < iSizePoly; i++)
    {
        piRanks[i] = iMaxSize - 1;
    }

    // create output and working table
    (*_pPolyOut) = new Polynom(_pPoly1->getVariableName(), iDims2, piDims2, piRanks);
    delete[] piRanks;
    Double* pDblCoefOut = new Double(_pPoly1->getRows(), _pPoly1->getCols() * iMaxSize, bComplex1 || bComplex2);
    double* pdblCoef2   = new double[_pPoly1->getRows() * _pPoly1->getCols() * iMaxSize];
    Double* pDblCoef1   = _pPoly1->getCoef();

    int iZero = 0;
    double* pdbl = _pDouble2->get();
    for (int i = 0; i < iSizePoly; i++)
    {
        C2F(dcopy)(&iMaxSize, pdbl + i, &iZero, pdblCoef2 + i, &iSizePoly);
    }

    int iInc1       = 1;
    int iInc2       = 1;
    int iIncOut     = 1;
    int iSizeResult = pDblCoefOut->getSize();

    if (bComplex1 == false && bComplex2 == false)
    {
        // r ./ R
        iErr = iRightDivisionRealMatrixByRealMatrix(
                   pDblCoef1->getReal(), iInc1,
                   pdblCoef2, iInc2,
                   pDblCoefOut->getReal(), iIncOut, iSizeResult);
    }
    else if (bComplex1 == false && bComplex2 == true)
    {
        // r ./ C
        //        iErr = iRightDivisionRealMatrixByComplexMatrix(
        //                   _pDouble1->getReal(), iInc1,
        //                   _pDouble2->getReal(), _pDouble2->getImg(), iInc2,
        //                   (*_pDoubleOut)->getReal(), (*_pDoubleOut)->getImg(), iIncOut, iSizeResult);

        // waiting for polynom rewrite about complex
        iErr = 10;
    }
    else if (bComplex1 == true && bComplex2 == false)
    {
        // c ./ R
        //        iErr = iRightDivisionComplexMatrixByRealMatrix(
        //                   _pDouble1->getReal(), _pDouble1->getImg(), iInc1,
        //                   _pDouble2->getReal(), iInc2,
        //                   (*_pDoubleOut)->getReal(), (*_pDoubleOut)->getImg(), iIncOut, iSizeResult);

        // waiting for polynom rewrite about complex
        iErr = 10;
    }
    else if (bComplex1 == true && bComplex2 == true)
    {
        // c ./ C
        //        iErr = iRightDivisionComplexMatrixByComplexMatrix(
        //                   _pDouble1->getReal(), _pDouble1->getImg(), iInc1,
        //                   _pDouble2->getReal(), _pDouble2->getImg(), iInc2,
        //                   (*_pDoubleOut)->getReal(), (*_pDoubleOut)->getImg(), iIncOut, iSizeResult);

        // waiting for polynom rewrite about complex
        iErr = 10;
    }

    (*_pPolyOut)->setCoef(pDblCoefOut);
    (*_pPolyOut)->updateRank();

    delete pDblCoefOut;
//.........这里部分代码省略.........
开发者ID:scitao,项目名称:scilab,代码行数:101,代码来源:types_divide.cpp


注:本文中的Double::getSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。