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


C++ DVector::getDim方法代码示例

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


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

示例1: setForwardSeed

returnValue Integrator::setForwardSeed(	const int    &order,
										const DVector &xSeed,
										const DVector &pSeed,
										const DVector &uSeed,
										const DVector &wSeed  ){


    int run1;
    if( rhs == 0 ) return ACADOERROR( RET_TRIVIAL_RHS );

    DVector tmpX;
    DVector components = rhs->getDifferentialStateComponents();

    dP = pSeed;
    dU = uSeed;
    dW = wSeed;

    if( xSeed.getDim() != 0 ){

        tmpX.init( components.getDim() );
        for( run1 = 0; run1 < (int) components.getDim(); run1++ )
             tmpX(run1) = xSeed((int) components(run1));
    }

    return setProtectedForwardSeed( tmpX, pSeed, uSeed, wSeed, order );
}
开发者ID:OspreyX,项目名称:acado,代码行数:26,代码来源:integrator.cpp

示例2: subjectTo

returnValue OCP::subjectTo( const DVector& _lb, const Expression& _expr, const DVector& _ub )
{
	ASSERT(_lb.getDim() == _expr.getDim() && _lb.getDim() == _ub.getDim());
	constraint->add(_lb, _expr, _ub);

	return SUCCESSFUL_RETURN;
}
开发者ID:OspreyX,项目名称:acado,代码行数:7,代码来源:ocp.cpp

示例3: checkSymmetry

BooleanType RungeKuttaExport::checkSymmetry( const DVector& _cc ) {

	if( _cc.getDim() <= 1 ) return BT_FALSE;
	BooleanType symmetry = BT_TRUE;
	uint i;
	for( i = 0; i < _cc.getDim(); i++ ) {
		int tmp = acadoRoundAway(1.0 - _cc(i) - _cc(_cc.getDim()-1-i));
		if( symmetry ) symmetry = (tmp == 0);
	}
	return symmetry;
}
开发者ID:OspreyX,项目名称:acado,代码行数:11,代码来源:rk_export.cpp

示例4: initializeButcherTableau

returnValue RungeKuttaExport::initializeButcherTableau( const DMatrix& _AA, const DVector& _bb, const DVector& _cc ) {

	if( _cc.isEmpty() || !_AA.isSquare() || _AA.getNumRows() != _bb.getDim() || _bb.getDim() != _cc.getDim() ) return RET_INVALID_OPTION;

	numStages = _cc.getDim();
	is_symmetric = checkSymmetry( _cc );
//	std::cout << "Symmetry of the chosen method: " << is_symmetric << "\n";
	AA = _AA;
	bb = _bb;
	cc = _cc;

	return SUCCESSFUL_RETURN;
}
开发者ID:OspreyX,项目名称:acado,代码行数:13,代码来源:rk_export.cpp

示例5: evaluateTransition

returnValue Integrator::evaluateTransition( const double time, DVector &xd, const DVector &xa,
                                            const DVector &p, const DVector &u, const DVector &w ){

    ASSERT( transition != 0 );
    EvaluationPoint z( *transition, xd.getDim(), xa.getDim(), p.getDim(), u.getDim(), w.getDim() );
    z.setT ( time );
    z.setX ( xd   );
    z.setXA( xa   );
    z.setP ( p    );
    z.setU ( u    );
    z.setW ( w    );
    xd = transition->evaluate( z );
    return SUCCESSFUL_RETURN;
}
开发者ID:OspreyX,项目名称:acado,代码行数:14,代码来源:integrator.cpp

示例6: integrate

returnValue Integrator::integrate(	const Grid   &t_  ,
									const DVector &x0  ,
									const DVector &xa  ,
									const DVector &p   ,
									const DVector &u   ,
									const DVector &w    ){

    int run1;
    returnValue returnvalue;
    if( rhs == 0 ) return ACADOERROR( RET_TRIVIAL_RHS );

    DVector tmpX;

    DVector components = rhs->getDifferentialStateComponents();

    const int N = components.getDim();

    if( x0.getDim() != 0 ){
        tmpX.init( components.getDim() );
        for( run1 = 0; run1 < (int) components.getDim(); run1++ )
            tmpX(run1) = x0((int) components(run1));
    }


// 	tmpX.print( "integrator x0" );
// 	u.print( "integrator u0" );
// 	p.print( "integrator p0" );
    returnvalue = evaluate( tmpX, xa, p, u, w, t_ );

    if( returnvalue != SUCCESSFUL_RETURN )
        return returnvalue;

    xE.init(rhs->getDim());
    xE.setZero();

    DVector tmp(rhs->getDim());
    getProtectedX(&tmp);

    for( run1 = 0; run1 < N; run1++ )
        xE((int) components(run1)) = tmp(run1);

    for( run1 = N; run1 < N + ma; run1++ )
        xE(run1) = tmp(run1);

    if( transition != 0 )
        returnvalue = evaluateTransition( t_.getLastTime(), xE, xa, p, u, w );

    return returnvalue;
}
开发者ID:OspreyX,项目名称:acado,代码行数:49,代码来源:integrator.cpp

示例7: getBackwardSensitivities

returnValue Integrator::getBackwardSensitivities(	DVector &DX,
													DVector &DP ,
													DVector &DU ,
													DVector &DW ,
													int    order   ) const{

    int run2;
    returnValue returnvalue;

    DVector tmpX ( rhs->getDim() );

    DX.setZero();
    DP.setZero();
    DU.setZero();
    DW.setZero();

    returnvalue = getProtectedBackwardSensitivities( tmpX, DP, DU, DW, order );
    DVector components = rhs->getDifferentialStateComponents();

    for( run2 = 0; run2 < (int) components.getDim(); run2++ )
        DX((int) components(run2)) = tmpX(run2);

    for( run2 = 0; run2 < (int) dPb.getDim(); run2++ )
        DP(run2) += dPb(run2);

    for( run2 = 0; run2 < (int) dUb.getDim(); run2++ )
        DU(run2) += dUb(run2);

    for( run2 = 0; run2 < (int) dWb.getDim(); run2++ )
        DW(run2) += dWb(run2);

    return returnvalue;
}
开发者ID:OspreyX,项目名称:acado,代码行数:33,代码来源:integrator.cpp

示例8: setBackwardSeed

returnValue Integrator::setBackwardSeed(	const int    &order,
											const DVector &seed   ){

    dXb = seed;

    uint run1;
    DVector tmp( seed.getDim() );
    DVector components = rhs->getDifferentialStateComponents();

    if( seed.getDim() != 0 ){
        tmp.init( components.getDim() );
        for( run1 = 0; run1 < components.getDim(); run1++ )
             tmp(run1) = seed((int) components(run1));
    }
    return setProtectedBackwardSeed( tmp, order );
}
开发者ID:OspreyX,项目名称:acado,代码行数:16,代码来源:integrator.cpp

示例9: diffTransitionForward

returnValue Integrator::diffTransitionForward(       DVector &DX,
                                               const DVector &DP,
                                               const DVector &DU,
                                               const DVector &DW,
                                               const int    &order ){

    ASSERT( transition != 0 );
    EvaluationPoint z( *transition, DX.getDim(), 0, DP.getDim(), DU.getDim(), DW.getDim() );
    z.setX ( DX );
    z.setP ( DP );
    z.setU ( DU );
    z.setW ( DW );

    if( order == 1 ) DX = transition->AD_forward( z );

    if( order != 1 ) return ACADOERROR( RET_NOT_IMPLEMENTED_YET );

    return SUCCESSFUL_RETURN;
}
开发者ID:OspreyX,项目名称:acado,代码行数:19,代码来源:integrator.cpp

示例10: diffTransitionBackward

returnValue Integrator::diffTransitionBackward( DVector &DX,
                                                DVector &DP,
                                                DVector &DU,
                                                DVector &DW,
                                                int    &order ){

    ASSERT( transition != 0 );
    if( order != 1 ) return ACADOERROR( RET_NOT_IMPLEMENTED_YET );

    EvaluationPoint z( *transition, DX.getDim(), 0, DP.getDim(), DU.getDim(), DW.getDim() );

    transition->AD_backward( DX, z );

    DX = z.getX();
    DP = z.getP();
    DU = z.getU();
    DW = z.getW();

    return SUCCESSFUL_RETURN;
}
开发者ID:OspreyX,项目名称:acado,代码行数:20,代码来源:integrator.cpp

示例11: times

OCP::OCP( const double &tStart_, const double &tEnd_, const DVector& _numSteps )
    : MultiObjectiveFunctionality(),
      grid(new Grid()), objective(new Objective()), constraint(new Constraint())
{
	if( _numSteps.getDim() <= 0 ) ACADOERROR( RET_INVALID_ARGUMENTS );
      
	DVector times( _numSteps.getDim()+1 );
	times(0) = tStart_;
	
	double totalSteps = 0;
	uint i;
	for( i = 0; i < _numSteps.getDim(); i++ ) {
		totalSteps += _numSteps(i);
	}
	double h = (tEnd_ - tStart_)/totalSteps;
	for( i = 0; i < _numSteps.getDim(); i++ ) {
		times(i+1) = times(i) + h*_numSteps(i);
	}
	
    setupGrid( times );
    modelData.setIntegrationGrid(*grid, totalSteps);
}
开发者ID:OspreyX,项目名称:acado,代码行数:22,代码来源:ocp.cpp

示例12: getMouseEvent

BooleanType GnuplotWindow::getMouseEvent( double &mouseX, double &mouseY )
{
    DVector tmp;
    if (tmp.read( "mouse.dat" ) != SUCCESSFUL_RETURN)
    	return BT_FALSE;

    mouseX = tmp( tmp.getDim()-2 );
    mouseY = tmp( tmp.getDim()-1 );

	if ( system("rm mouse.dat") )
		return BT_FALSE;

    return BT_TRUE;
}
开发者ID:borishouska,项目名称:acado,代码行数:14,代码来源:gnuplot_window.cpp

示例13: setVector

returnValue VariablesGrid::setVector(	uint pointIdx,
										const DVector& _values
										)
{
	if ( pointIdx >= getNumPoints( ) )
		return ACADOERROR( RET_INDEX_OUT_OF_BOUNDS );

	if ( _values.getDim( ) != getNumRows( pointIdx ) )
		return ACADOERROR( RET_VECTOR_DIMENSION_MISMATCH );
	
	for( uint j=0; j<getNumRows( ); ++j )
		operator()( pointIdx,j ) = _values( j );
	
	return SUCCESSFUL_RETURN;
}
开发者ID:OspreyX,项目名称:acado,代码行数:15,代码来源:variables_grid.cpp

示例14: integrateSensitivities

returnValue Integrator::integrateSensitivities( ){

    uint run1;
    returnValue returnvalue;


    if( ( nBDirs > 0 || nBDirs2 > 0 ) && transition != 0 ){

        int order;
        if( nBDirs2 > 0 ) order = 2;
        else              order = 1;

        returnvalue = diffTransitionBackward( dXb, dPb, dUb, dWb, order );

        setBackwardSeed( order, dXb );

        if( returnvalue != SUCCESSFUL_RETURN ) return ACADOERROR(returnvalue);
    }

    returnvalue = evaluateSensitivities();

    if( returnvalue != SUCCESSFUL_RETURN ) return ACADOERROR(returnvalue);


    if( nBDirs > 0 || nBDirs2 > 0 ) return SUCCESSFUL_RETURN;

    int order = 1;
    if( nFDirs2 > 0 ) order = 2;

    DMatrix tmp( rhs->getDim(), 1 );
    returnvalue = getProtectedForwardSensitivities(&tmp,order);

    DVector components = rhs->getDifferentialStateComponents();

    dX.init(rhs->getDim()-ma);
    dX.setZero();

    for( run1 = 0; run1 < components.getDim(); run1++ )
        dX((int) components(run1)) = tmp(run1,0);

    if( returnvalue != SUCCESSFUL_RETURN ) return ACADOERROR(returnvalue);

    if( transition != 0 )
        returnvalue = diffTransitionForward( dX, dP, dU, dW, order );

    return returnvalue;
}
开发者ID:OspreyX,项目名称:acado,代码行数:47,代码来源:integrator.cpp

示例15: setParameterDeadTimes

returnValue Actuator::setParameterDeadTimes(	const DVector& _deadTimes
                                           )
{
    if ( _deadTimes.getDim( ) != getNP( ) )
        return ACADOERROR( RET_INVALID_ARGUMENTS );

    if ( _deadTimes.getMin( ) < 0.0 )
        return ACADOERROR( RET_INVALID_ARGUMENTS );

    if ( deadTimes.getDim( ) == 0 )
        return ACADOERROR( RET_MEMBER_NOT_INITIALISED );

    for( uint i=0; i<getNP(); ++i )
        deadTimes( getNU()+i ) = _deadTimes( i );

    return SUCCESSFUL_RETURN;
}
开发者ID:helloxss,项目名称:acado,代码行数:17,代码来源:actuator.cpp


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