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 00034 #ifndef ACADO_TOOLKIT_ACADO_CSPARSE_HPP 00035 #define ACADO_TOOLKIT_ACADO_CSPARSE_HPP 00036 00037 00038 #include <acado/utils/acado_utils.hpp> 00039 #include <acado/sparse_solver/sparse_solver.hpp> 00040 00041 00042 00043 00044 // FORWARD DECLARATIONS: 00045 // --------------------- 00046 struct cs_numeric ; 00047 struct cs_symbolic; 00048 00049 00050 00051 BEGIN_NAMESPACE_ACADO 00052 00053 00066 class ACADOcsparse : public SparseSolver{ 00067 00068 00069 // 00070 // PUBLIC MEMBER FUNCTIONS: 00071 // 00072 public: 00073 00075 ACADOcsparse( ); 00076 00078 ACADOcsparse( const ACADOcsparse &arg ); 00079 00081 virtual ~ACADOcsparse( ); 00082 00084 virtual ACADOcsparse* clone() const; 00085 00086 00091 virtual returnValue setDimension( const int &n ); 00092 00093 00099 virtual returnValue setNumberOfEntries( const int &nDense_ ); 00100 00101 00102 00106 virtual returnValue setIndices( const int *rowIdx_, 00107 const int *colIdx_ ); 00108 00109 00110 00115 virtual returnValue setMatrix( double *A_ ); 00116 00117 00118 00124 virtual returnValue solve( double *b ); 00125 00126 00127 00133 virtual returnValue solveTranspose( double *b ); 00134 00135 00136 00141 virtual returnValue getX( double *x_ ); 00142 00143 00144 00155 virtual returnValue setTolerance( double TOL_ ); 00156 00157 00162 virtual returnValue setPrintLevel( PrintLevel printLevel_ ); 00163 00164 00165 00166 // 00167 // PROTECTED MEMBER FUNCTIONS: 00168 // 00169 protected: 00170 00171 00172 00173 // 00174 // DATA MEMBERS: 00175 // 00176 protected: 00177 00178 00179 // DIMENSIONS: 00180 // -------------------- 00181 int dim; // dimension of the matrix A 00182 int nDense; // number of non-zero entries in A 00183 int *index1, *index2; // and the associated indices 00184 00185 00186 00187 // DATA: 00188 // -------------------- 00189 double *x; // The result vector x 00190 00191 00192 // AUXILIARY VARIABLES: 00193 // -------------------- 00194 cs_symbolic *S; // pointer to a struct, which contains symbolic information about the matrix 00195 cs_numeric *N; // pointer to a struct, which contains numeric information about the matrix 00196 00197 00198 double TOL; // The required tolerance. (default 10^(-10)) 00199 PrintLevel printLevel; // The PrintLevel. 00200 }; 00201 00202 00203 CLOSE_NAMESPACE_ACADO 00204 00205 #endif 00206 00207 /* 00208 * end of file 00209 */ 00210