本文整理汇总了C++中BlockMatrix::setDense方法的典型用法代码示例。如果您正苦于以下问题:C++ BlockMatrix::setDense方法的具体用法?C++ BlockMatrix::setDense怎么用?C++ BlockMatrix::setDense使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockMatrix
的用法示例。
在下文中一共展示了BlockMatrix::setDense方法的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;
}
示例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;
}
示例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;
}
示例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++;
//.........这里部分代码省略.........
示例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_ );
//.........这里部分代码省略.........