Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00034 #include <acado/code_generation/linear_solvers/linear_solver_export.hpp>
00035 
00036 using namespace std;
00037 
00038 BEGIN_NAMESPACE_ACADO
00039 
00040 
00041 
00042 
00043 
00044 
00045 ExportLinearSolver::ExportLinearSolver( UserInteraction* _userInteraction,
00046                                                                                 const std::string& _commonHeaderName
00047                                                                                 ) : ExportAlgorithm(_userInteraction, _commonHeaderName)
00048 {
00049         REUSE = true;
00050         UNROLLING = false;
00051         dim = nRows = nCols = nBacksolves = 0;
00052 
00053         determinant = ExportVariable("det", 1, 1, REAL, ACADO_LOCAL, true);
00054 }
00055 
00056 
00057 ExportLinearSolver::~ExportLinearSolver( )
00058 {}
00059 
00060 
00061 returnValue ExportLinearSolver::init(   const uint newDim,
00062                                                                                 const bool& reuse,
00063                                                                                 const bool& unrolling
00064                                                                                 )
00065 {
00066         return init(newDim, newDim, newDim, reuse, unrolling, std::string( "dim" ) + toString( newDim ) + "_");
00067 }
00068 
00069 
00070 returnValue ExportLinearSolver::init(   const uint newDim,
00071                                                                                 const bool& reuse,
00072                                                                                 const bool& unrolling,
00073                                                                                 const std::string& newId
00074                                                                                 )
00075 {
00076         return init(newDim, newDim, newDim, reuse, unrolling, newId);
00077 }
00078 
00079 returnValue ExportLinearSolver::init(   unsigned _nRows,
00080                                                                                 unsigned _nCols,
00081                                                                                 unsigned _nBacksolves,
00082                                                                                 bool _reuse,
00083                                                                                 bool _unroll,
00084                                                                                 const std::string& _id
00085                                                                                 )
00086 {
00087         ASSERT_RETURN(_nRows >= _nCols);
00088         ASSERT_RETURN(_nBacksolves <= _nCols);
00089 
00090         nRows = _nRows;
00091         nCols = _nCols;
00092         nBacksolves = _nBacksolves;
00093         REUSE = _reuse;
00094         UNROLLING = _unroll;
00095         identifier = _id;
00096 
00097         
00098         dim = _nRows;
00099 
00100         return setup();
00101 }
00102 
00103 uint ExportLinearSolver::getDim() const {
00104         
00105         return dim;
00106 }
00107 
00108 
00109 bool ExportLinearSolver::getReuse() const {
00110         
00111         return REUSE;
00112 }
00113 
00114 
00115 returnValue ExportLinearSolver::setReuse( const bool& reuse ) {
00116         
00117         REUSE = reuse;
00118         
00119         return SUCCESSFUL_RETURN;
00120 } 
00121 
00122 
00123 bool ExportLinearSolver::getUnrolling() const {
00124         
00125         return UNROLLING;
00126 }
00127 
00128 
00129 returnValue ExportLinearSolver::setUnrolling( const bool& unrolling ) {
00130         
00131         UNROLLING = unrolling;
00132         
00133         return SUCCESSFUL_RETURN;
00134 } 
00135 
00136 
00137 const std::string ExportLinearSolver::getNameSolveFunction() {
00138         
00139         return string( "solve_" ) + identifier + "system";
00140 }
00141 
00142 
00143 const std::string ExportLinearSolver::getNameSolveReuseFunction() {
00144         
00145         return string( "solve_" ) + identifier + "system_reuse";
00146 }
00147 
00148 ExportVariable ExportLinearSolver::getGlobalExportVariable( const uint factor ) const
00149 {
00150         ASSERT(1 == 0);
00151         return ExportVariable();
00152 }
00153 
00154 
00155 
00156 
00157 
00158 
00159 
00160 
00161 CLOSE_NAMESPACE_ACADO
00162 
00163