Allows to export automatically generated algorithms for solving linear systems of specific dimensions. More...
#include <linear_solver_export.hpp>
Public Member Functions | |
virtual returnValue | appendVariableNames (std::stringstream &string)=0 |
ExportLinearSolver (UserInteraction *_userInteraction=0, const std::string &_commonHeaderName="") | |
virtual returnValue | getCode (ExportStatementBlock &code)=0 |
virtual returnValue | getDataDeclarations (ExportStatementBlock &declarations, ExportStruct dataStruct=ACADO_ANY) const =0 |
uint | getDim () const |
virtual returnValue | getFunctionDeclarations (ExportStatementBlock &declarations) const =0 |
virtual ExportVariable | getGlobalExportVariable (const uint factor) const |
const std::string | getNameSolveFunction () |
const std::string | getNameSolveReuseFunction () |
const std::string | getNameSolveTransposeReuseFunction () |
bool | getReuse () const |
bool | getTranspose () const |
bool | getUnrolling () const |
returnValue | init (const uint newDim, const bool &reuse=true, const bool &unrolling=false) |
returnValue | init (const uint newDim, const uint _nRightHandSides, const bool &reuse=true, const bool &unrolling=false) |
returnValue | init (const uint newDim, const bool &reuse, const bool &unrolling, const std::string &newId) |
returnValue | init (unsigned _nRows, unsigned _nCols, unsigned _nBacksolves, bool _reuse, bool _unroll, const std::string &_id) |
returnValue | init (unsigned _nRows, unsigned _nCols, unsigned _nBacksolves, unsigned _nRightHandSides, bool _reuse, bool _unroll, const std::string &_id) |
returnValue | setReuse (const bool &reuse) |
returnValue | setTranspose (const bool &transpose) |
returnValue | setUnrolling (const bool &unrolling) |
virtual returnValue | setup ()=0 |
virtual | ~ExportLinearSolver () |
Public Member Functions inherited from ExportAlgorithm | |
ExportAlgorithm (UserInteraction *_userInteraction=0, const std::string &_commonHeaderName=std::string()) | |
uint | getN () const |
uint | getNDX () const |
uint | getNOD () const |
uint | getNP () const |
uint | getNU () const |
uint | getNX () const |
uint | getNXA () const |
uint | getNY () const |
uint | getNYN () const |
returnValue | setDimensions (uint _NX=0, uint _NU=0, uint _NP=0, uint _NI=0, uint _NOD=0) |
returnValue | setDimensions (uint _NX, uint _NDX, uint _NXA, uint _NU, uint _NP, uint _NI, uint _NOD) |
void | setNY (uint NY_) |
void | setNYN (uint NYN_) |
virtual | ~ExportAlgorithm () |
Public Member Functions inherited from AlgorithmicBase | |
int | addLogRecord (LogRecord &_record) |
returnValue | addOption (OptionsName name, int value) |
returnValue | addOption (OptionsName name, double value) |
returnValue | addOption (uint idx, OptionsName name, int value) |
returnValue | addOption (uint idx, OptionsName name, double value) |
returnValue | addOptionsList () |
AlgorithmicBase () | |
AlgorithmicBase (UserInteraction *_userInteraction) | |
AlgorithmicBase (const AlgorithmicBase &rhs) | |
returnValue | get (OptionsName name, int &value) const |
returnValue | get (OptionsName name, double &value) const |
returnValue | get (OptionsName name, std::string &value) const |
returnValue | get (uint idx, OptionsName name, int &value) const |
returnValue | get (uint idx, OptionsName name, double &value) const |
returnValue | getAll (LogName _name, MatrixVariablesGrid &values) const |
returnValue | getFirst (LogName _name, DMatrix &firstValue) const |
returnValue | getFirst (LogName _name, VariablesGrid &firstValue) const |
returnValue | getLast (LogName _name, DMatrix &lastValue) const |
returnValue | getLast (LogName _name, VariablesGrid &lastValue) const |
Options | getOptions (uint idx) const |
BooleanType | haveOptionsChanged () const |
BooleanType | haveOptionsChanged (uint idx) const |
AlgorithmicBase & | operator= (const AlgorithmicBase &rhs) |
returnValue | plot (PlotFrequency _frequency=PLOT_IN_ANY_CASE) |
returnValue | printLogRecord (std::ostream &_stream, int idx, LogPrintMode _mode=PRINT_ITEM_BY_ITEM) const |
returnValue | replot (PlotFrequency _frequency=PLOT_IN_ANY_CASE) |
returnValue | set (OptionsName name, int value) |
returnValue | set (OptionsName name, double value) |
returnValue | set (OptionsName name, const std::string &value) |
returnValue | set (uint idx, OptionsName name, int value) |
returnValue | set (uint idx, OptionsName name, double value) |
returnValue | setAll (LogName _name, const MatrixVariablesGrid &values) |
returnValue | setLast (LogName _name, int lastValue, double time=-INFTY) |
returnValue | setLast (LogName _name, double lastValue, double time=-INFTY) |
returnValue | setLast (LogName _name, const DVector &lastValue, double time=-INFTY) |
returnValue | setLast (LogName _name, const DMatrix &lastValue, double time=-INFTY) |
returnValue | setLast (LogName _name, const VariablesGrid &lastValue, double time=-INFTY) |
returnValue | setOptions (const Options &arg) |
returnValue | setOptions (uint idx, const Options &arg) |
virtual | ~AlgorithmicBase () |
Protected Attributes | |
ExportVariable | A |
ExportVariable | b |
ExportVariable | determinant |
uint | dim |
std::string | identifier |
unsigned | nBacksolves |
unsigned | nCols |
unsigned | nRightHandSides |
unsigned | nRows |
bool | REUSE |
ExportFunction | solve |
ExportFunction | solveReuse |
ExportFunction | solveReuseTranspose |
ExportFunction | solveTriangular |
bool | TRANSPOSE |
bool | UNROLLING |
Protected Attributes inherited from ExportAlgorithm | |
std::string | commonHeaderName |
uint | N |
uint | NDX |
uint | NOD |
uint | NP |
uint | NU |
uint | NX |
uint | NXA |
uint | NY |
uint | NYN |
Protected Attributes inherited from AlgorithmicBase | |
int | outputLoggingIdx |
BooleanType | useModuleStandalone |
UserInteraction * | userInteraction |
Allows to export automatically generated algorithms for solving linear systems of specific dimensions.
The class ExportLinearSolver allows to export automatically generated algorithms for solving linear systems of specific dimensions.
Definition at line 62 of file linear_solver_export.hpp.
BEGIN_NAMESPACE_ACADO ExportLinearSolver::ExportLinearSolver | ( | UserInteraction * | _userInteraction = 0 , |
const std::string & | _commonHeaderName = "" |
||
) |
Default constructor.
@param[in] _userInteraction Pointer to corresponding user interface. @param[in] _commonHeaderName Name of common header file to be included.
Definition at line 45 of file linear_solver_export.cpp.
|
virtual |
Destructor.
Definition at line 58 of file linear_solver_export.cpp.
|
pure virtual |
Appends the names of the used variables to a given stringstream.
@param[in] string The string to which the names of the used variables are appended. \return SUCCESSFUL_RETURN
Implemented in ExportIRK3StageSimplifiedNewton, ExportIRK4StageSimplifiedNewton, ExportCholeskySolver, ExportGaussElim, and ExportHouseholderQR.
|
pure virtual |
Exports source code of the auto-generated algorithm into the given directory.
@param[in] code Code block containing the auto-generated algorithm. \return SUCCESSFUL_RETURN
Implements ExportAlgorithm.
Implemented in ExportIRK3StageSimplifiedNewton, ExportIRK4StageSimplifiedNewton, ExportIRK3StageSingleNewton, ExportIRK4StageSingleNewton, ExportCholeskySolver, ExportGaussElim, and ExportHouseholderQR.
|
pure virtual |
Adds all data declarations of the auto-generated algorithm to given list of declarations.
@param[in] declarations List of declarations. \return SUCCESSFUL_RETURN
Implements ExportAlgorithm.
Implemented in ExportIRK3StageSimplifiedNewton, ExportIRK4StageSimplifiedNewton, ExportIRK3StageSingleNewton, ExportIRK4StageSingleNewton, ExportCholeskySolver, ExportGaussElim, and ExportHouseholderQR.
uint ExportLinearSolver::getDim | ( | ) | const |
Returns the dimensions of the linear system.
Definition at line 127 of file linear_solver_export.cpp.
|
pure virtual |
Adds all function (forward) declarations of the auto-generated algorithm to given list of declarations.
@param[in] declarations List of declarations. \return SUCCESSFUL_RETURN
Implements ExportAlgorithm.
Implemented in ExportIRK3StageSimplifiedNewton, ExportIRK4StageSimplifiedNewton, ExportIRK3StageSingleNewton, ExportIRK4StageSingleNewton, ExportCholeskySolver, ExportGaussElim, and ExportHouseholderQR.
|
virtual |
Returns the dimension of the auxiliary variables for the linear solver.
Reimplemented in ExportGaussElim, and ExportHouseholderQR.
Definition at line 192 of file linear_solver_export.cpp.
const std::string ExportLinearSolver::getNameSolveFunction | ( | ) |
Returns a string containing the name of the function which is exported to solve the linear system.
Definition at line 175 of file linear_solver_export.cpp.
const std::string ExportLinearSolver::getNameSolveReuseFunction | ( | ) |
Returns a string containing the name of the function which is exported to solve the linear system with the reuse of previous results.
Definition at line 181 of file linear_solver_export.cpp.
const std::string ExportLinearSolver::getNameSolveTransposeReuseFunction | ( | ) |
Definition at line 187 of file linear_solver_export.cpp.
bool ExportLinearSolver::getReuse | ( | ) | const |
Returns a boolean that is true when an extra algorithm will be exported for reuse.
Definition at line 133 of file linear_solver_export.cpp.
bool ExportLinearSolver::getTranspose | ( | ) | const |
Returns a boolean that is true when an extra algorithm will be exported for solving a transposed linear system based on reuse.
Definition at line 147 of file linear_solver_export.cpp.
bool ExportLinearSolver::getUnrolling | ( | ) | const |
Returns a boolean that is true when the exported code for the linear solver needs to be unrolled completely.
Definition at line 161 of file linear_solver_export.cpp.
returnValue ExportLinearSolver::init | ( | const uint | newDim, |
const bool & | reuse = true , |
||
const bool & | unrolling = false |
||
) |
Initializes the different parameters of the linear solver that will be exported.
@param[in] newDim The dimensions of the linear system. @param[in] reuse A boolean that is true when more than one system of linear equations with the same matrix needs to be solved. This means that an algorithm will be exported expecially for this case, with extra optimizations by reusing as many intermediate results as possible. @param[in] unrolling A boolean that is true when the exported code for the linear solver needs to be unrolled completely. \return SUCCESSFUL_RETURN
Definition at line 62 of file linear_solver_export.cpp.
returnValue ExportLinearSolver::init | ( | const uint | newDim, |
const uint | _nRightHandSides, | ||
const bool & | reuse = true , |
||
const bool & | unrolling = false |
||
) |
returnValue ExportLinearSolver::init | ( | const uint | newDim, |
const bool & | reuse, | ||
const bool & | unrolling, | ||
const std::string & | newId | ||
) |
Initializes the different parameters of the linear solver that will be exported.
@param[in] newDim The dimensions of the linear system. @param[in] reuse A boolean that is true when more than one system of linear equations with the same matrix needs to be solved. This means that an algorithm will be exported expecially for this case, with extra optimizations by reusing as many intermediate results as possible. @param[in] unrolling A boolean that is true when the exported code for the linear solver needs to be unrolled completely. @param[in] newId The new identifier for this linear solver to be exported. \return SUCCESSFUL_RETURN
Definition at line 80 of file linear_solver_export.cpp.
returnValue ExportLinearSolver::init | ( | unsigned | _nRows, |
unsigned | _nCols, | ||
unsigned | _nBacksolves, | ||
bool | _reuse, | ||
bool | _unroll, | ||
const std::string & | _id | ||
) |
Definition at line 89 of file linear_solver_export.cpp.
returnValue ExportLinearSolver::init | ( | unsigned | _nRows, |
unsigned | _nCols, | ||
unsigned | _nBacksolves, | ||
unsigned | _nRightHandSides, | ||
bool | _reuse, | ||
bool | _unroll, | ||
const std::string & | _id | ||
) |
Definition at line 100 of file linear_solver_export.cpp.
returnValue ExportLinearSolver::setReuse | ( | const bool & | reuse | ) |
Sets the boolean that is true when an extra algorithm will be exported for reuse.
@param[in] reuse The new value of this boolean.
Definition at line 139 of file linear_solver_export.cpp.
returnValue ExportLinearSolver::setTranspose | ( | const bool & | transpose | ) |
Sets the boolean that is true when an extra algorithm will be exported for solving a transposed linear system based on reuse.
@param[in] transpose The new value of this boolean.
Definition at line 153 of file linear_solver_export.cpp.
returnValue ExportLinearSolver::setUnrolling | ( | const bool & | unrolling | ) |
Sets the boolean that is true when the exported code for the linear solver needs to be unrolled completely.
[in] | unrolling | The new value of this boolean. |
Definition at line 167 of file linear_solver_export.cpp.
|
pure virtual |
Initializes code export into given file.
\return SUCCESSFUL_RETURN
Reimplemented from ExportAlgorithm.
Implemented in ExportCholeskySolver, ExportGaussElim, ExportHouseholderQR, ExportIRK3StageSimplifiedNewton, ExportIRK3StageSingleNewton, ExportIRK4StageSimplifiedNewton, and ExportIRK4StageSingleNewton.
|
protected |
Variable containing the matrix of the linear system.
Definition at line 290 of file linear_solver_export.hpp.
|
protected |
Variable containing the right-hand side of the linear system and it will also contain the solution.
Definition at line 291 of file linear_solver_export.hpp.
|
protected |
Variable containing the matrix determinant.
Definition at line 298 of file linear_solver_export.hpp.
|
protected |
The dimensions of the linear system.
Definition at line 282 of file linear_solver_export.hpp.
|
protected |
This identifier allows the use of more than one exported linear solver.
Definition at line 277 of file linear_solver_export.hpp.
|
protected |
Number of back-solves.
Definition at line 286 of file linear_solver_export.hpp.
|
protected |
Number of columns of matrix A.
Definition at line 285 of file linear_solver_export.hpp.
|
protected |
Number of back-solves.
Definition at line 287 of file linear_solver_export.hpp.
|
protected |
Number of rows of matrix A.
Definition at line 284 of file linear_solver_export.hpp.
|
protected |
The boolean that defines the reuse.
Definition at line 280 of file linear_solver_export.hpp.
|
protected |
Function that solves the linear system.
Definition at line 293 of file linear_solver_export.hpp.
|
protected |
Function that solves a linear system with the same matrix, reusing previous results.
Definition at line 295 of file linear_solver_export.hpp.
|
protected |
Function that solves a transposed linear system with the same matrix, reusing previous results.
Definition at line 296 of file linear_solver_export.hpp.
|
protected |
Function that solves the upper-triangular system.
Definition at line 294 of file linear_solver_export.hpp.
|
protected |
Definition at line 281 of file linear_solver_export.hpp.
|
protected |
The boolean that defines the unrolling.
Definition at line 279 of file linear_solver_export.hpp.