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


C++ BlockMatrix::init方法代码示例

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


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

示例1: getBoundResiduum

returnValue Constraint::getBoundResiduum( BlockMatrix &lowerRes,
        BlockMatrix &upperRes ) {


    int run1;
    const int N = grid.getNumPoints();

    lowerRes.init( 4*N+1, 1 );
    upperRes.init( 4*N+1, 1 );

    for( run1 = 0; run1 < N; run1++ ) {

        lowerRes.setDense( run1, 0, residuumXL[run1] );
        upperRes.setDense( run1, 0, residuumXU[run1] );

        lowerRes.setDense( N+run1, 0, residuumXAL[run1] );
        upperRes.setDense( N+run1, 0, residuumXAU[run1] );

        lowerRes.setDense( 2*N+1+run1, 0, residuumUL[run1] );
        upperRes.setDense( 2*N+1+run1, 0, residuumUU[run1] );

        lowerRes.setDense( 3*N+1+run1, 0, residuumWL[run1] );
        upperRes.setDense( 3*N+1+run1, 0, residuumWU[run1] );
    }
    lowerRes.setDense( 2*N, 0, residuumPL[0] );
    upperRes.setDense( 2*N, 0, residuumPU[0] );

    return SUCCESSFUL_RETURN;
}
开发者ID:rtkg,项目名称:acado,代码行数:29,代码来源:constraint.cpp

示例2: getResiduum

returnValue DynamicDiscretization::getResiduum( BlockMatrix &residuum_ ) const{

    int  run1;
    uint run2;

    residuum_.init( N, 1 );

    for( run1 = 0; run1 < N; run1++ ){
        Matrix tmp( residuum.getNumValues(), 1 );
        for( run2 = 0; run2 < residuum.getNumValues(); run2++ )
                tmp( run2, 0 ) = residuum(run1,run2);
        residuum_.setDense(run1,0,tmp);
    }

    return SUCCESSFUL_RETURN;
}
开发者ID:ThomasBesselmann,项目名称:acado,代码行数:16,代码来源:dynamic_discretization.cpp

示例3: getAnySensitivities

returnValue SCPmethod::getAnySensitivities(	BlockMatrix& _sens,
											uint idx
											) const
{
	if ( idx > 4 )
		return ACADOERROR( RET_INVALID_ARGUMENTS );

	uint N = bandedCP.dynGradient.getNumRows();
	Matrix tmp;
	
	_sens.init( N,1 );
	
	for( uint i=0; i<N; ++i )
	{
		bandedCP.dynGradient.getSubBlock( i,idx,tmp );
		_sens.setDense( i,0,tmp );
	}
	
	return SUCCESSFUL_RETURN;
}
开发者ID:drewm1980,项目名称:acado,代码行数:20,代码来源:scp_method.cpp

示例4: getForwardSensitivities

returnValue Constraint::getForwardSensitivities( BlockMatrix &D, int order ) {

    const int N = grid.getNumPoints();

    returnValue returnvalue;
    BlockMatrix result;

    result.init( getNumberOfBlocks(), 5*N );

    int nc, run1, run2;
    nc = 0;

    // BOUNDARY CONSTRAINTS:
    // ---------------------

    if( boundary_constraint->getNC() != 0 ) {
        BlockMatrix res;
        returnvalue = boundary_constraint->getForwardSensitivities( &res, order );
        if( returnvalue != SUCCESSFUL_RETURN ) return ACADOERROR(returnvalue);
        Matrix res_;
        for( run2 = 0; run2 < 5*N; run2++ ) {
            res.getSubBlock( 0 , run2, res_ );
            if( res_.getDim() > 0 )
                result.setDense( nc, run2, res_ );
        }
        nc++;
    }

    // COUPLED PATH CONSTRAINTS:
    // -------------------------

    if( coupled_path_constraint->getNC() != 0 ) {
        BlockMatrix res;
        returnvalue = coupled_path_constraint->getForwardSensitivities( &res, order );
        if( returnvalue != SUCCESSFUL_RETURN ) return ACADOERROR(returnvalue);
        Matrix res_;
        for( run2 = 0; run2 < 5*N; run2++ ) {
            res.getSubBlock( 0 , run2, res_ );
            if( res_.getDim() > 0 )
                result.setDense( nc, run2, res_ );
        }
        nc++;
    }


    // PATH CONSTRAINTS:
    // -----------------

    if( path_constraint->getNC() != 0 ) {
        BlockMatrix res;
        returnvalue = path_constraint->getForwardSensitivities( &res, order );
        if( returnvalue != SUCCESSFUL_RETURN ) return ACADOERROR(returnvalue);
        Matrix res_;
        for( run1 = 0; run1 < N; run1++ ) {
            for( run2 = 0; run2 < 5*N; run2++ ) {
                res.getSubBlock( run1, run2, res_ );
                if( res_.getDim() > 0 )
                    result.setDense( nc  , run2, res_ );
            }
            nc++;
        }
    }


    // ALGEBRAIC CONSISTENCY CONSTRAINTS:
    // ----------------------------------

    if( algebraic_consistency_constraint->getNC() != 0 ) {
        BlockMatrix res;
        returnvalue = algebraic_consistency_constraint->getForwardSensitivities( &res, order );
        if( returnvalue != SUCCESSFUL_RETURN ) return ACADOERROR(returnvalue);
        Matrix res_;
        for( run1 = 0; run1 < N; run1++ ) {
            for( run2 = 0; run2 < 5*N; run2++ ) {
                res.getSubBlock( run1, run2, res_ );
                if( res_.getDim() > 0 )
                    result.setDense( nc  , run2, res_ );
            }
            nc++;
        }
    }



    // POINT CONSTRAINTS:
    // ------------------

    if( point_constraints != 0 ) {
        for( run1 = 0; run1 < (int) grid.getNumPoints(); run1++ ) {
            if( point_constraints[run1] != 0 ) {
                BlockMatrix res;
                returnvalue = point_constraints[run1]->getForwardSensitivities( &res, order );
                if( returnvalue != SUCCESSFUL_RETURN ) return ACADOERROR(returnvalue);
                Matrix res_;
                for( run2 = 0; run2 < 5*N; run2++ ) {
                    res.getSubBlock( 0 , run2, res_ );
                    if( res_.getDim() > 0 )
                        result.setDense( nc, run2, res_ );
                }
                nc++;
//.........这里部分代码省略.........
开发者ID:rtkg,项目名称:acado,代码行数:101,代码来源:constraint.cpp

示例5: getConstraintResiduum

returnValue Constraint::getConstraintResiduum( BlockMatrix &lowerRes, BlockMatrix &upperRes ) {

    const int N = grid.getNumPoints();

    returnValue returnvalue;

    BlockMatrix residuumL;
    BlockMatrix residuumU;

    residuumL.init( getNumberOfBlocks(), 1 );
    residuumU.init( getNumberOfBlocks(), 1 );

    int nc, run1;

    nc = 0;

    // BOUNDARY CONSTRAINTS:
    // ---------------------

    if( boundary_constraint->getNC() != 0 ) {
        BlockMatrix resL, resU;
        returnvalue = boundary_constraint->getResiduum( resL, resU );
        if( returnvalue != SUCCESSFUL_RETURN ) return ACADOERROR(returnvalue);
        Matrix resL_;
        Matrix resU_;
        resL.getSubBlock( 0, 0, resL_ );
        resU.getSubBlock( 0, 0, resU_ );
        residuumL.setDense( nc, 0, resL_ );
        residuumU.setDense( nc, 0, resU_ );
        nc++;
    }


    // COUPLED PATH CONSTRAINTS:
    // -------------------------

    if( coupled_path_constraint->getNC() != 0 ) {
        BlockMatrix resL, resU;
        returnvalue = coupled_path_constraint->getResiduum( resL, resU );
        if( returnvalue != SUCCESSFUL_RETURN ) return ACADOERROR(returnvalue);
        Matrix resL_;
        Matrix resU_;
        resL.getSubBlock( 0, 0, resL_ );
        resU.getSubBlock( 0, 0, resU_ );
        residuumL.setDense( nc, 0, resL_ );
        residuumU.setDense( nc, 0, resU_ );
        nc++;
    }


    // PATH CONSTRAINTS:
    // -----------------

    if( path_constraint->getNC() != 0 ) {
        BlockMatrix resL, resU;
        returnvalue = path_constraint->getResiduum( resL, resU );
        if( returnvalue != SUCCESSFUL_RETURN ) return ACADOERROR(returnvalue);
        Matrix resL_;
        Matrix resU_;
        for( run1 = 0; run1 < N; run1++ ) {
            resL.getSubBlock( run1, 0, resL_ );
            resU.getSubBlock( run1, 0, resU_ );
            residuumL.setDense( nc, 0, resL_ );
            residuumU.setDense( nc, 0, resU_ );
            nc++;
        }
    }

    // ALGEBRAIC CONSISTENCY CONSTRAINTS:
    // ----------------------------------

    if( algebraic_consistency_constraint->getNC() != 0 ) {
        BlockMatrix resL, resU;
        returnvalue = algebraic_consistency_constraint->getResiduum( resL, resU );
        if( returnvalue != SUCCESSFUL_RETURN ) return ACADOERROR(returnvalue);
        Matrix resL_;
        Matrix resU_;
        for( run1 = 0; run1 < N; run1++ ) {
            resL.getSubBlock( run1, 0, resL_ );
            resU.getSubBlock( run1, 0, resU_ );
            residuumL.setDense( nc, 0, resL_ );
            residuumU.setDense( nc, 0, resU_ );
            nc++;
        }
    }

    // POINT CONSTRAINTS:
    // ------------------

    if( point_constraints != 0 ) {
        for( run1 = 0; run1 < (int) grid.getNumPoints(); run1++ ) {
            if( point_constraints[run1] != 0 ) {
                BlockMatrix resL, resU;
                returnvalue = point_constraints[run1]->getResiduum( resL, resU );
                if( returnvalue != SUCCESSFUL_RETURN ) return ACADOERROR(returnvalue);
                Matrix resL_;
                Matrix resU_;
                resL.getSubBlock( 0, 0, resL_ );
                resU.getSubBlock( 0, 0, resU_ );
                residuumL.setDense( nc, 0, resL_ );
//.........这里部分代码省略.........
开发者ID:rtkg,项目名称:acado,代码行数:101,代码来源:constraint.cpp


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