qpOASES 3.2.1
An Implementation of the Online Active Set Strategy
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 * Copyright (C) 2007-2017 by Hans Joachim Ferreau, Andreas Potschka,
6 * Christian Kirches et al. 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
53{
54 /*
55 * PUBLIC MEMBER FUNCTIONS
56 */
57 public:
59 SparseSolver( );
60
62 SparseSolver( const SparseSolver& rhs
63 );
64
66 virtual ~SparseSolver( );
67
69 virtual SparseSolver& operator=( const SparseSolver& rhs
70 );
71
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
96
98 virtual int_t getRank( );
99
101 virtual returnValue getZeroPivots( int_t *&zeroPivots );
102
103 /*
104 * PROTECTED MEMBER FUNCTIONS
105 */
106 protected:
110
113 returnValue copy( const SparseSolver& rhs
114 );
115
116 /*
117 * PROTECTED MEMBER VARIABLES
118 */
119 protected:
120};
121
122
123#ifdef SOLVER_MA27
124
132class 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_t dim;
203 fint_t numNonzeros;
205 fint_t la_ma27;
207 double* a_ma27;
209 fint_t* irn_ma27;
211 fint_t* jcn_ma27;
213 fint_t icntl_ma27[30];
215 double cntl_ma27[5];
217 fint_t liw_ma27;
219 fint_t* iw_ma27;
221 fint_t* ikeep_ma27;
223 fint_t nsteps_ma27;
225 fint_t maxfrt_ma27;
227 bool have_factorization;
229 fint_t neig;
231 fint_t rank;
232};
233
234#endif /* SOLVER_MA27 */
235
236
237#ifdef SOLVER_MA57
238
246class 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 /*
298 * PROTECTED MEMBER FUNCTIONS
299 */
300 protected:
303 returnValue clear( );
304
307 returnValue copy( const Ma57SparseSolver& rhs
308 );
309
310 /*
311 * PRIVATE MEMBER FUNCTIONS
312 */
313 private:
314 /*
315 * PRIVATE MEMBER VARIABLES
316 */
317 private:
318 fint_t dim;
320 fint_t numNonzeros;
322 double* a_ma57;
324 fint_t* irn_ma57;
326 fint_t* jcn_ma57;
328 fint_t icntl_ma57[30];
330 double cntl_ma57[5];
332 double* fact_ma57;
334 fint_t lfact_ma57;
336 fint_t* ifact_ma57;
338 fint_t lifact_ma57;
340 bool have_factorization;
342 fint_t neig;
344 fint_t rank;
346 fint_t* pivots;
347};
348
349#endif /* SOLVER_MA57 */
350
351
352#ifdef SOLVER_NONE
353
361class DummySparseSolver: public SparseSolver
362{
363 /*
364 * PUBLIC MEMBER FUNCTIONS
365 */
366 public:
370 virtual returnValue setMatrixData( int_t dim,
371 int_t numNonzeros,
372 const int_t* const airn,
373 const int_t* const acjn,
374 const real_t* const avals
375 );
376
378 virtual returnValue factorize( );
379
381 virtual returnValue solve( int_t dim,
382 const real_t* const rhs,
383 real_t* const sol
384 );
385};
386
387#endif /* SOLVER_NONE */
388
389
391
392#endif /* QPOASES_SPARSESOLVER_HPP */
393
394/*
395 * end of file
396 */
returnValue
Defines all symbols for global return values.
Definition: MessageHandling.hpp:65
int int_t
Definition: Types.hpp:180
BEGIN_NAMESPACE_QPOASES typedef double real_t
Definition: Types.hpp:171
#define END_NAMESPACE_QPOASES
Definition: Types.hpp:110
int fint_t
Definition: Types.hpp:189
#define BEGIN_NAMESPACE_QPOASES
Definition: Types.hpp:107
Base class for linear solvers that are used in a Schur-complement implementation in qpOASES.
Definition: SparseSolver.hpp:53
virtual returnValue getZeroPivots(int_t *&zeroPivots)
Definition: SparseSolver.cpp:119
returnValue copy(const SparseSolver &rhs)
Definition: SparseSolver.cpp:143
virtual SparseSolver & operator=(const SparseSolver &rhs)
Definition: SparseSolver.cpp:81
SparseSolver()
Definition: SparseSolver.cpp:55
returnValue clear()
Definition: SparseSolver.cpp:134
virtual ~SparseSolver()
Definition: SparseSolver.cpp:72
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 returnValue factorize()=0
virtual returnValue reset()
Definition: SparseSolver.cpp:95
virtual int_t getRank()
Definition: SparseSolver.cpp:111
virtual returnValue solve(int_t dim, const real_t *const rhs, real_t *const sol)=0
virtual int_t getNegativeEigenvalues()
Definition: SparseSolver.cpp:103