本文整理汇总了C++中ExportVariable::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ ExportVariable::getType方法的具体用法?C++ ExportVariable::getType怎么用?C++ ExportVariable::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExportVariable
的用法示例。
在下文中一共展示了ExportVariable::getType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupSolveReuseComplete
returnValue ExportGaussElim::setupSolveReuseComplete( ExportFunction& _solveReuse, ExportVariable& _bPerm ) {
ExportIndex run1( "i" );
ExportIndex run2( "j" );
ExportIndex tmp_index1( "index1" );
ExportIndex tmp_index2( "index2" );
ExportVariable tmp( "tmp_var", 1, 1, _bPerm.getType(), ACADO_LOCAL, true );
_solveReuse.addIndex( run1 );
_solveReuse.addIndex( run2 );
_solveReuse.addIndex( tmp_index1 );
_solveReuse.addIndex( tmp_index2 );
_solveReuse.addDeclaration(tmp);
uint run3;
if (nRightHandSides <= 0)
return ACADOERROR(RET_INVALID_OPTION);
ExportForLoop loop1( run1, 0, dim );
loop1 << run2.getName() << " = " << rk_perm.getFullName() << "[" << run1.getName() << "]*" << toString(nRightHandSides) << ";\n";
for( run3 = 0; run3 < nRightHandSides; run3++ ) {
loop1 << _bPerm.get( run1,run3 ) << " = b[" << run2.getName() << "+" << toString(run3) << "];\n";
}
_solveReuse.addStatement( loop1 );
ExportForLoop loop2( run2, 1, dim ); // row run2
loop2.addStatement( tmp_index1 == run2*nRightHandSides );
ExportForLoop loop3( run1, 0, run2 ); // column run1
loop3.addStatement( tmp_index2 == run1*nRightHandSides );
loop3.addStatement( tmp == A.getElement(run2,run1) );
for( run3 = 0; run3 < nRightHandSides; run3++ ) {
// loop3.addStatement( _bPerm.getElement( run2,run3 ) += tmp * _bPerm.getElement( run1,run3 ) );
loop3 << _bPerm.getFullName() << "[" << tmp_index1.getName() << "+" << toString(run3) << "] += " << tmp.getName() << "*" << _bPerm.getFullName() << "[" << tmp_index2.getName() << "+" << toString(run3) << "];\n";
}
loop2.addStatement( loop3 );
_solveReuse.addStatement( loop2 );
// Solve the upper triangular system of equations:
ExportForLoop loop4( run1, dim-1, -1, -1 );
loop4.addStatement( tmp_index1 == run1*nRightHandSides );
ExportForLoop loop5( run2, dim-1, run1, -1 );
loop5.addStatement( tmp_index2 == run2*nRightHandSides );
loop5.addStatement( tmp == A.getElement( run1,run2 ) );
for( run3 = 0; run3 < nRightHandSides; run3++ ) {
// loop5.addStatement( _bPerm.getElement( run1,run3 ) -= tmp * _bPerm.getElement( run2,run3 ) );
loop5 << _bPerm.getFullName() << "[" << tmp_index1.getName() << "+" << toString(run3) << "] -= " << tmp.getName() << "*" << _bPerm.getFullName() << "[" << tmp_index2.getName() << "+" << toString(run3) << "];\n";
}
loop4.addStatement( loop5 );
loop4 << tmp.getName() << " = 1.0/A[" << run1.getName() << "*" << toString(dim+1) << "];\n";
for( run3 = 0; run3 < nRightHandSides; run3++ ) {
// loop4 << _bPerm.get( run1,run3 ) << " = " << _bPerm.get( run1,run3 ) << "*" << tmp.getName() << ";\n";
loop4 << _bPerm.getFullName() << "[" << tmp_index1.getName() << "+" << toString(run3) << "] = " << tmp.getName() << "*" << _bPerm.getFullName() << "[" << tmp_index1.getName() << "+" << toString(run3) << "];\n";
}
_solveReuse.addStatement( loop4 );
_solveReuse.addStatement( b == _bPerm );
return SUCCESSFUL_RETURN;
}
示例2: setupSolveReuseTranspose
returnValue ExportGaussElim::setupSolveReuseTranspose( ExportFunction& _solveReuse, ExportVariable& _bPerm ) {
ExportIndex run1( "i" );
ExportIndex run2( "j" );
ExportVariable tmp( "tmp_var", 1, 1, _bPerm.getType(), ACADO_LOCAL, true );
_solveReuse.addIndex( run1 );
_solveReuse.addIndex( run2 );
_solveReuse.addDeclaration(tmp);
_solveReuse.addStatement( _bPerm == b_trans );
ExportForLoop loop2( run2, 0, dim ); // row run2
ExportForLoop loop3( run1, 0, run2 ); // column run1
loop3.addStatement( _bPerm.getRow(run2) -= A.getElement(run1,run2)*_bPerm.getRow(run1) );
loop2.addStatement( loop3 );
loop2 << tmp.getName() << " = 1.0/A[" << run2.getName() << "*" << toString(dim+1) << "];\n";
loop2.addStatement( _bPerm.getRow(run2) == _bPerm.getRow(run2)*tmp );
_solveReuse.addStatement( loop2 );
// Solve the upper triangular system of equations:
ExportForLoop loop4( run1, dim-1, -1, -1 );
ExportForLoop loop5( run2, dim-1, run1, -1 );
loop5.addStatement( _bPerm.getRow(run1) += A.getElement(run2,run1)*_bPerm.getRow(run2) );
loop4.addStatement( loop5 );
_solveReuse.addStatement( loop4 );
// The permutation now happens HERE!
ExportForLoop loop1( run1, 0, dim );
loop1 << run2.getName() << " = " << rk_perm.getFullName() << "[" << run1.getName() << "];\n";
loop1.addStatement( b_trans.getRow(run2) == _bPerm.getRow(run1) );
_solveReuse.addStatement( loop1 );
return SUCCESSFUL_RETURN;
}