export_variable_internal.hpp
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 
34 #ifndef ACADO_TOOLKIT_EXPORT_VARIABLE_INTERNAL_HPP
35 #define ACADO_TOOLKIT_EXPORT_VARIABLE_INTERNAL_HPP
36 
40 
41 
43 
44 
46 
47 
64 {
65  //
66  // PUBLIC MEMBER FUNCTIONS:
67  //
68  public:
69 
73 
84  ExportVariableInternal( const std::string& _name,
85  const DMatrixPtr& _data,
86  ExportType _type = REAL,
87  ExportStruct _dataStruct = ACADO_LOCAL,
88  bool _callItByValue = false,
89  const std::string& _prefix = std::string()
90  );
91 
94  virtual ~ExportVariableInternal( );
95 
100  virtual ExportVariableInternal* clone() const;
101 
110  bool isZero( const ExportIndex& rowIdx,
111  const ExportIndex& colIdx
112  ) const;
113 
122  bool isOne( const ExportIndex& rowIdx,
123  const ExportIndex& colIdx
124  ) const;
125 
134  bool isGiven( const ExportIndex& rowIdx,
135  const ExportIndex& colIdx
136  ) const;
137 
138  virtual bool isGiven() const;
139 
140 
149  const std::string get( const ExportIndex& rowIdx,
150  const ExportIndex& colIdx
151  ) const;
152 
157  virtual uint getNumRows( ) const;
158 
163  virtual uint getNumCols( ) const;
164 
169  virtual uint getDim( ) const;
170 
175  ExportVariable getTranspose( ) const;
176 
183  ExportVariable getRow( const ExportIndex& idx
184  ) const;
185 
192  ExportVariable getCol( const ExportIndex& idx
193  ) const;
194 
202  ExportVariable getRows( const ExportIndex& idx1,
203  const ExportIndex& idx2
204  ) const;
205 
213  ExportVariable getCols( const ExportIndex& idx1,
214  const ExportIndex& idx2
215  ) const;
216 
226  ExportVariable getSubMatrix( const ExportIndex& _rowIdx1,
227  const ExportIndex& _rowIdx2,
228  const ExportIndex& _colIdx1,
229  const ExportIndex& _colIdx2
230  ) const;
231 
232 
237  ExportVariable makeRowVector( ) const;
238 
243  ExportVariable makeColVector( ) const;
244 
245 
251  bool isVector( ) const;
252 
253 
258  const DMatrix& getGivenMatrix( ) const;
259 
260 
265  returnValue print( ) const;
266 
268  bool isSubMatrix() const;
269 
271  bool isDiagonal() const;
272 
273  //
274  // PROTECTED MEMBER FUNCTIONS:
275  //
276  protected:
277 
282  virtual uint getColDim( ) const;
283 
291  virtual ExportIndex getTotalIdx( const ExportIndex& rowIdx,
292  const ExportIndex& colIdx
293  ) const;
294 
309  returnValue setSubmatrixOffsets( const ExportIndex& _rowOffset,
310  const ExportIndex& _colOffset,
311  unsigned _rowDim = 0,
312  unsigned _colDim = 0,
313  unsigned _nRows = 0,
314  unsigned _nCols = 0
315  );
316 
317 
327  bool hasValue( const ExportIndex& _rowIdx,
328  const ExportIndex& _colIdx,
329  double _value
330  ) const;
331 
332  protected:
333 
338  unsigned rowDim;
339  unsigned colDim;
340  unsigned nRows;
341  unsigned nCols;
342 };
343 
345 
346 
347 #endif // ACADO_TOOLKIT_EXPORT_VARIABLE_INTERNAL_HPP
348 
349 // end of file.
ExportVariable getRow(const ExportIndex &idx) const
bool isOne(const ExportIndex &rowIdx, const ExportIndex &colIdx) const
ExportVariable makeRowVector() const
returnValue setSubmatrixOffsets(const ExportIndex &_rowOffset, const ExportIndex &_colOffset, unsigned _rowDim=0, unsigned _colDim=0, unsigned _nRows=0, unsigned _nCols=0)
Allows to pass back messages to the calling function.
std::shared_ptr< GenericMatrix< double > > DMatrixPtr
Definition: matrix.hpp:463
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
Definition: acado_types.hpp:42
ExportVariable getRows(const ExportIndex &idx1, const ExportIndex &idx2) const
Defines a matrix-valued variable to be used for exporting code.
#define CLOSE_NAMESPACE_ACADO
virtual ExportIndex getTotalIdx(const ExportIndex &rowIdx, const ExportIndex &colIdx) const
Defines a scalar-valued index variable to be used for exporting code.
virtual uint getNumCols() const
Allows to export code of different arithmetic statements.
ExportStruct
bool isZero(const ExportIndex &rowIdx, const ExportIndex &colIdx) const
Defines a matrix-valued variable that can be passed as argument to exported functions.
virtual uint getNumRows() const
ExportVariable getTranspose() const
ExportType
const DMatrix & getGivenMatrix() const
bool hasValue(const ExportIndex &_rowIdx, const ExportIndex &_colIdx, double _value) const
ExportVariable getSubMatrix(const ExportIndex &_rowIdx1, const ExportIndex &_rowIdx2, const ExportIndex &_colIdx1, const ExportIndex &_colIdx2) const
#define BEGIN_NAMESPACE_ACADO
virtual ExportVariableInternal * clone() const
ExportVariable makeColVector() const
ExportVariable getCols(const ExportIndex &idx1, const ExportIndex &idx2) const
ExportVariable getCol(const ExportIndex &idx) const
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:34