linear_solver_export.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ACADO Toolkit.
3  *
4  * ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
5  * Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
6  * Milan Vukov, Rien Quirynen, KU Leuven.
7  * Developed within the Optimization in Engineering Center (OPTEC)
8  * under supervision of Moritz Diehl. All rights reserved.
9  *
10  * ACADO Toolkit is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 3 of the License, or (at your option) any later version.
14  *
15  * ACADO Toolkit is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with ACADO Toolkit; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  *
24  */
25 
26 
27 
35 
36 using namespace std;
37 
39 
40 
41 //
42 // PUBLIC MEMBER FUNCTIONS:
43 //
44 
46  const std::string& _commonHeaderName
47  ) : ExportAlgorithm(_userInteraction, _commonHeaderName)
48 {
49  REUSE = true;
50  TRANSPOSE = false;
51  UNROLLING = false;
53 
54  determinant = ExportVariable("det", 1, 1, REAL, ACADO_LOCAL, true);
55 }
56 
57 
59 {}
60 
61 
63  const bool& reuse,
64  const bool& unrolling
65  )
66 {
67  return init(newDim, newDim, newDim, 0, reuse, unrolling, std::string( "dim" ) + toString( newDim ) + "_");
68 }
69 
70 returnValue ExportLinearSolver::init( const unsigned newDim,
71  const unsigned _nRightHandSides,
72  const bool& reuse,
73  const bool& unroll
74  )
75 {
76  return init(newDim, newDim, newDim, _nRightHandSides, reuse, unroll, std::string( "dim" ) + toString( newDim ) + "_");
77 }
78 
79 
81  const bool& reuse,
82  const bool& unrolling,
83  const std::string& newId
84  )
85 {
86  return init(newDim, newDim, newDim, 0, reuse, unrolling, newId);
87 }
88 
90  unsigned _nCols,
91  unsigned _nBacksolves,
92  bool _reuse,
93  bool _unroll,
94  const std::string& _id
95  )
96 {
97  return init(_nRows, _nCols, _nBacksolves, 0, _reuse, _unroll, _id);
98 }
99 
101  unsigned _nCols,
102  unsigned _nBacksolves,
103  unsigned _nRightHandSides,
104  bool _reuse,
105  bool _unroll,
106  const std::string& _id
107  )
108 {
109  ASSERT_RETURN(_nRows >= _nCols);
110  ASSERT_RETURN(_nBacksolves <= _nCols);
111  ASSERT_RETURN(_nRightHandSides >= 0);
112 
113  nRows = _nRows;
114  nCols = _nCols;
115  nBacksolves = _nBacksolves;
116  nRightHandSides = _nRightHandSides;
117  REUSE = _reuse;
118  UNROLLING = _unroll;
119  identifier = _id;
120 
121  // This is more for compatibility reasons and should be deprecated.
122  dim = _nRows;
123 
124  return setup();
125 }
126 
128 
129  return dim;
130 }
131 
132 
134 
135  return REUSE;
136 }
137 
138 
140 
141  REUSE = reuse;
142 
143  return SUCCESSFUL_RETURN;
144 }
145 
146 
148 
149  return TRANSPOSE;
150 }
151 
152 
154 
155  TRANSPOSE = transpose;
156 
157  return SUCCESSFUL_RETURN;
158 }
159 
160 
162 
163  return UNROLLING;
164 }
165 
166 
168 
169  UNROLLING = unrolling;
170 
171  return SUCCESSFUL_RETURN;
172 }
173 
174 
176 
177  return string( "solve_" ) + identifier + "system";
178 }
179 
180 
182 
183  return string( "solve_" ) + identifier + "system_reuse";
184 }
185 
186 
188 
189  return string( "solve_" ) + identifier + "transpose_reuse";
190 }
191 
193 {
194  ASSERT(1 == 0);
195  return ExportVariable();
196 }
197 
198 
199 //
200 // PROTECTED MEMBER FUNCTIONS:
201 //
202 
203 
204 
206 
207 // end of file.
returnValue setUnrolling(const bool &unrolling)
const std::string getNameSolveTransposeReuseFunction()
#define ASSERT_RETURN(x)
returnValue setTranspose(const bool &transpose)
virtual ExportVariable getGlobalExportVariable(const uint factor) const
Allows to pass back messages to the calling function.
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
Definition: acado_types.hpp:42
string toString(T const &value)
#define CLOSE_NAMESPACE_ACADO
Allows to export automatically generated algorithms for fast model predictive control.
const std::string getNameSolveReuseFunction()
ExportLinearSolver(UserInteraction *_userInteraction=0, const std::string &_commonHeaderName="")
Encapsulates all user interaction for setting options, logging data and plotting results.
returnValue setReuse(const bool &reuse)
#define ASSERT(x)
virtual returnValue setup()=0
const std::string getNameSolveFunction()
#define BEGIN_NAMESPACE_ACADO
returnValue init(const uint newDim, const bool &reuse=true, const bool &unrolling=false)
Defines a matrix-valued variable to be used for exporting code.


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