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 () |
bool | getReuse () const |
bool | getUnrolling () const |
returnValue | init (const uint newDim, 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 | setReuse (const bool &reuse) |
returnValue | setUnrolling (const bool &unrolling) |
virtual returnValue | setup ()=0 |
virtual | ~ExportLinearSolver () |
Protected Attributes | |
ExportVariable | A |
ExportVariable | b |
ExportVariable | determinant |
uint | dim |
std::string | identifier |
unsigned | nBacksolves |
unsigned | nCols |
unsigned | nRows |
bool | REUSE |
ExportFunction | solve |
ExportFunction | solveReuse |
ExportFunction | solveTriangular |
bool | UNROLLING |
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.
[in] | _userInteraction | Pointer to corresponding user interface. |
[in] | _commonHeaderName | Name of common header file to be included. |
Definition at line 45 of file linear_solver_export.cpp.
ExportLinearSolver::~ExportLinearSolver | ( | ) | [virtual] |
Destructor.
Definition at line 57 of file linear_solver_export.cpp.
virtual returnValue ExportLinearSolver::appendVariableNames | ( | std::stringstream & | string | ) | [pure virtual] |
Appends the names of the used variables to a given stringstream.
[in] | string | The string to which the names of the used variables are appended. |
Implemented in ExportCholeskySolver, ExportGaussElim, and ExportHouseholderQR.
virtual returnValue ExportLinearSolver::getCode | ( | ExportStatementBlock & | code | ) | [pure virtual] |
Exports source code of the auto-generated algorithm into the given directory.
[in] | code | Code block containing the auto-generated algorithm. |
Implements ExportAlgorithm.
Implemented in ExportCholeskySolver, ExportGaussElim, and ExportHouseholderQR.
virtual returnValue ExportLinearSolver::getDataDeclarations | ( | ExportStatementBlock & | declarations, |
ExportStruct | dataStruct = ACADO_ANY |
||
) | const [pure virtual] |
Adds all data declarations of the auto-generated algorithm to given list of declarations.
[in] | declarations | List of declarations. |
Implements ExportAlgorithm.
Implemented in ExportCholeskySolver, ExportGaussElim, and ExportHouseholderQR.
uint ExportLinearSolver::getDim | ( | ) | const |
Returns the dimensions of the linear system.
Definition at line 103 of file linear_solver_export.cpp.
virtual returnValue ExportLinearSolver::getFunctionDeclarations | ( | ExportStatementBlock & | declarations | ) | const [pure virtual] |
Adds all function (forward) declarations of the auto-generated algorithm to given list of declarations.
[in] | declarations | List of declarations. |
Implements ExportAlgorithm.
Implemented in ExportCholeskySolver, ExportGaussElim, and ExportHouseholderQR.
ExportVariable ExportLinearSolver::getGlobalExportVariable | ( | const uint | factor | ) | const [virtual] |
Returns the dimension of the auxiliary variables for the linear solver.
Reimplemented in ExportGaussElim, and ExportHouseholderQR.
Definition at line 148 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 137 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 143 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 109 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 123 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.
[in] | newDim | The dimensions of the linear system. |
[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. |
[in] | unrolling | A boolean that is true when the exported code for the linear solver needs to be unrolled completely. |
Definition at line 61 of file linear_solver_export.cpp.
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.
[in] | newDim | The dimensions of the linear system. |
[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. |
[in] | unrolling | A boolean that is true when the exported code for the linear solver needs to be unrolled completely. |
[in] | newId | The new identifier for this linear solver to be exported. |
Definition at line 70 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 79 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.
[in] | reuse | The new value of this boolean. |
Definition at line 115 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 129 of file linear_solver_export.cpp.
virtual returnValue ExportLinearSolver::setup | ( | ) | [pure virtual] |
Initializes code export into given file.
Reimplemented from ExportAlgorithm.
Implemented in ExportCholeskySolver, ExportGaussElim, and ExportHouseholderQR.
ExportVariable ExportLinearSolver::A [protected] |
Variable containing the matrix of the linear system.
Definition at line 256 of file linear_solver_export.hpp.
ExportVariable ExportLinearSolver::b [protected] |
Variable containing the right-hand side of the linear system and it will also contain the solution.
Definition at line 257 of file linear_solver_export.hpp.
ExportVariable ExportLinearSolver::determinant [protected] |
Variable containing the matrix determinant.
Definition at line 263 of file linear_solver_export.hpp.
uint ExportLinearSolver::dim [protected] |
The dimensions of the linear system.
Definition at line 249 of file linear_solver_export.hpp.
std::string ExportLinearSolver::identifier [protected] |
This identifier allows the use of more than one exported linear solver.
Definition at line 245 of file linear_solver_export.hpp.
unsigned ExportLinearSolver::nBacksolves [protected] |
Number of back-solves.
Definition at line 253 of file linear_solver_export.hpp.
unsigned ExportLinearSolver::nCols [protected] |
Number of columns of matrix A.
Definition at line 252 of file linear_solver_export.hpp.
unsigned ExportLinearSolver::nRows [protected] |
Number of rows of matrix A.
Definition at line 251 of file linear_solver_export.hpp.
bool ExportLinearSolver::REUSE [protected] |
The boolean that defines the reuse.
Definition at line 248 of file linear_solver_export.hpp.
ExportFunction ExportLinearSolver::solve [protected] |
Function that solves the linear system.
Definition at line 259 of file linear_solver_export.hpp.
ExportFunction ExportLinearSolver::solveReuse [protected] |
Function that solves a linear system with the same matrix, reusing previous results.
Definition at line 261 of file linear_solver_export.hpp.
ExportFunction ExportLinearSolver::solveTriangular [protected] |
Function that solves the upper-triangular system.
Definition at line 260 of file linear_solver_export.hpp.
bool ExportLinearSolver::UNROLLING [protected] |
The boolean that defines the unrolling.
Definition at line 247 of file linear_solver_export.hpp.