SparseSolver.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of qpOASES.
3  *
4  * qpOASES -- An Implementation of the Online Active Set Strategy.
5  *
6  * Copyright (C) 2012 by Andreas Waechter. All rights reserved.
7  *
8  * qpOASES is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * qpOASES is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with qpOASES; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  */
23 
24 
35 #ifndef QPOASES_SPARSESOLVER_HPP
36 #define QPOASES_SPARSESOLVER_HPP
37 
38 #include <qpOASES/Utils.hpp>
39 
40 
42 
43 
52 class SparseSolver
53 {
54  /*
55  * PUBLIC MEMBER FUNCTIONS
56  */
57  public:
59  SparseSolver( );
60 
63  );
64 
66  virtual ~SparseSolver( );
67 
69  virtual SparseSolver& operator=( const SparseSolver& rhs
70  );
71 
75  virtual returnValue setMatrixData( int_t dim,
76  int_t numNonzeros,
77  const int_t* const airn,
78  const int_t* const acjn,
79  const real_t* const avals
80  ) = 0;
81 
83  virtual returnValue factorize( ) = 0;
84 
86  virtual returnValue solve( int_t dim,
87  const real_t* const rhs,
88  real_t* const sol
89  ) = 0;
90 
92  virtual returnValue reset( );
93 
95  virtual int_t getNegativeEigenvalues( );
96 
98  virtual int_t getRank( );
99 
101  virtual returnValue getZeroPivots( int_t *&zeroPivots );
102 
103  /*
104  * PROTECTED MEMBER FUNCTIONS
105  */
106  protected:
109  returnValue clear( );
110 
114  );
115 
116  /*
117  * PROTECTED MEMBER VARIABLES
118  */
119  protected:
120 };
121 
122 
123 #ifdef SOLVER_MA27
124 
132 class Ma27SparseSolver: public SparseSolver
133 {
134  /*
135  * PUBLIC MEMBER FUNCTIONS
136  */
137  public:
139  Ma27SparseSolver( );
140 
142  Ma27SparseSolver( const Ma27SparseSolver& rhs
143  );
144 
146  virtual ~Ma27SparseSolver( );
147 
149  virtual Ma27SparseSolver& operator=( const SparseSolver& rhs
150  );
151 
155  virtual returnValue setMatrixData( int_t dim,
156  int_t numNonzeros,
157  const int_t* const airn,
158  const int_t* const acjn,
159  const real_t* const avals
160  );
161 
163  virtual returnValue factorize( );
164 
166  virtual returnValue solve( int_t dim,
167  const real_t* const rhs,
168  real_t* const sol
169  );
170 
172  virtual returnValue reset( );
173 
175  virtual int_t getNegativeEigenvalues( );
176 
178  virtual int getRank( );
179 
180  /*
181  * PROTECTED MEMBER FUNCTIONS
182  */
183  protected:
186  returnValue clear( );
187 
190  returnValue copy( const Ma27SparseSolver& rhs
191  );
192 
193  /*
194  * PRIVATE MEMBER FUNCTIONS
195  */
196  private:
197  /*
198  * PRIVATE MEMBER VARIABLES
199  */
200  private:
201  fint dim;
203  fint numNonzeros;
205  fint la_ma27;
207  double* a_ma27;
209  fint* irn_ma27;
211  fint* jcn_ma27;
213  fint icntl_ma27[30];
215  double cntl_ma27[5];
217  fint liw_ma27;
219  fint* iw_ma27;
221  fint* ikeep_ma27;
223  fint nsteps_ma27;
225  fint maxfrt_ma27;
227  bool have_factorization;
229  fint neig;
231  fint rank;
232 };
233 
234 #endif // SOLVER_MA27
235 
236 
237 #ifdef SOLVER_MA57
238 
246 class Ma57SparseSolver: public SparseSolver
247 {
248  /*
249  * PUBLIC MEMBER FUNCTIONS
250  */
251  public:
253  Ma57SparseSolver( );
254 
256  Ma57SparseSolver( const Ma57SparseSolver& rhs
257  );
258 
260  virtual ~Ma57SparseSolver( );
261 
263  virtual Ma57SparseSolver& operator=( const SparseSolver& rhs
264  );
265 
269  virtual returnValue setMatrixData( int_t dim,
270  int_t numNonzeros,
271  const int_t* const airn,
272  const int_t* const acjn,
273  const real_t* const avals
274  );
275 
277  virtual returnValue factorize( );
278 
280  virtual returnValue solve( int_t dim,
281  const real_t* const rhs,
282  real_t* const sol
283  );
284 
286  virtual returnValue reset( );
287 
289  virtual int_t getNegativeEigenvalues( );
290 
292  virtual int_t getRank( );
293 
295  virtual returnValue getZeroPivots( int_t *&zeroPivots );
296  /*
297  * PROTECTED MEMBER FUNCTIONS
298  */
299  protected:
302  returnValue clear( );
303 
306  returnValue copy( const Ma57SparseSolver& rhs
307  );
308 
309  /*
310  * PRIVATE MEMBER FUNCTIONS
311  */
312  private:
313  /*
314  * PRIVATE MEMBER VARIABLES
315  */
316  private:
317  fint dim;
319  fint numNonzeros;
321  double* a_ma57;
323  fint* irn_ma57;
325  fint* jcn_ma57;
327  fint icntl_ma57[30];
329  double cntl_ma57[5];
331  double* fact_ma57;
333  fint lfact_ma57;
335  fint* ifact_ma57;
337  fint lifact_ma57;
339  bool have_factorization;
341  fint neig;
343  fint rank;
345  fint* pivots;
346 };
347 
348 #endif // SOLVER_MA57
349 
350 
351 #ifdef SOLVER_NONE
352 
360 class DummySparseSolver: public SparseSolver
361 {
362  /*
363  * PUBLIC MEMBER FUNCTIONS
364  */
365  public:
369  virtual returnValue setMatrixData( int_t dim,
370  int_t numNonzeros,
371  const int_t* const airn,
372  const int_t* const acjn,
373  const real_t* const avals
374  );
375 
377  virtual returnValue factorize( );
378 
380  virtual returnValue solve( int_t dim,
381  const real_t* const rhs,
382  real_t* const sol
383  );
384 };
385 
386 #endif // SOLVER_NONE
387 
388 
390 
391 #endif /* QPOASES_SPARSESOLVER_HPP */
392 
393 /*
394  * end of file
395  */
virtual returnValue factorize()=0
virtual returnValue setMatrixData(int_t dim, int_t numNonzeros, const int_t *const airn, const int_t *const acjn, const real_t *const avals)=0
virtual SparseSolver & operator=(const SparseSolver &rhs)
Allows to pass back messages to the calling function.
virtual int_t getRank()
virtual ~SparseSolver()
virtual int_t getNegativeEigenvalues()
void rhs(const real_t *x, real_t *f)
Generic interface for sparse solvers to be coupled with ACADO Toolkit.
virtual returnValue reset()
returnValue clear()
double real_t
Definition: AD_test.c:10
virtual returnValue solve(double *b)=0
returnValue copy(const SparseSolver &rhs)
virtual returnValue getZeroPivots(int_t *&zeroPivots)


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:35:10