linear_solver_export.cpp
Go to the documentation of this file.
00001 /*
00002  *    This file is part of ACADO Toolkit.
00003  *
00004  *    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
00005  *    Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
00006  *    Milan Vukov, Rien Quirynen, KU Leuven.
00007  *    Developed within the Optimization in Engineering Center (OPTEC)
00008  *    under supervision of Moritz Diehl. All rights reserved.
00009  *
00010  *    ACADO Toolkit is free software; you can redistribute it and/or
00011  *    modify it under the terms of the GNU Lesser General Public
00012  *    License as published by the Free Software Foundation; either
00013  *    version 3 of the License, or (at your option) any later version.
00014  *
00015  *    ACADO Toolkit is distributed in the hope that it will be useful,
00016  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  *    Lesser General Public License for more details.
00019  *
00020  *    You should have received a copy of the GNU Lesser General Public
00021  *    License along with ACADO Toolkit; if not, write to the Free Software
00022  *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
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 // PUBLIC MEMBER FUNCTIONS:
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         // This is more for compatibility reasons and should be deprecated.
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 // PROTECTED MEMBER FUNCTIONS:
00157 //
00158 
00159 
00160 
00161 CLOSE_NAMESPACE_ACADO
00162 
00163 // end of file.


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 11:59:02