Public Member Functions | Protected Member Functions | Protected Attributes

Defines a matrix-valued variable to be used for exporting code. More...

#include <export_variable_internal.hpp>

Inheritance diagram for ExportVariableInternal:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ExportVariableInternalclone () const
 ExportVariableInternal ()
 ExportVariableInternal (const std::string &_name, const DMatrixPtr &_data, ExportType _type=REAL, ExportStruct _dataStruct=ACADO_LOCAL, bool _callItByValue=false, const std::string &_prefix=std::string())
const std::string get (const ExportIndex &rowIdx, const ExportIndex &colIdx) const
ExportVariable getCol (const ExportIndex &idx) const
ExportVariable getCols (const ExportIndex &idx1, const ExportIndex &idx2) const
virtual uint getDim () const
const DMatrixgetGivenMatrix () const
virtual uint getNumCols () const
virtual uint getNumRows () const
ExportVariable getRow (const ExportIndex &idx) const
ExportVariable getRows (const ExportIndex &idx1, const ExportIndex &idx2) const
ExportVariable getSubMatrix (const ExportIndex &_rowIdx1, const ExportIndex &_rowIdx2, const ExportIndex &_colIdx1, const ExportIndex &_colIdx2) const
ExportVariable getTranspose () const
bool isDiagonal () const
bool isGiven (const ExportIndex &rowIdx, const ExportIndex &colIdx) const
virtual bool isGiven () const
bool isOne (const ExportIndex &rowIdx, const ExportIndex &colIdx) const
bool isSubMatrix () const
bool isVector () const
bool isZero (const ExportIndex &rowIdx, const ExportIndex &colIdx) const
ExportVariable makeColVector () const
ExportVariable makeRowVector () const
returnValue print () const
virtual ~ExportVariableInternal ()

Protected Member Functions

virtual uint getColDim () const
virtual ExportIndex getTotalIdx (const ExportIndex &rowIdx, const ExportIndex &colIdx) const
bool hasValue (const ExportIndex &_rowIdx, const ExportIndex &_colIdx, double _value) const
returnValue setSubmatrixOffsets (const ExportIndex &_rowOffset, const ExportIndex &_colOffset, unsigned _rowDim=0, unsigned _colDim=0, unsigned _nRows=0, unsigned _nCols=0)

Protected Attributes

unsigned colDim
ExportIndex colOffset
bool doAccessTransposed
unsigned nCols
unsigned nRows
unsigned rowDim
ExportIndex rowOffset

Detailed Description

Defines a matrix-valued variable to be used for exporting code.

The class ExportVariableInternal defines a matrix-valued variable to be used for exporting code. Instances of this class can be used similar to usual DMatrix objects but offer additional functionality, e.g. they allow to export arithmetic expressions and they can be passed as argument to exported functions. By default, all entries of a ExportVariableInternal are undefined, but each of its component can be set to a fixed value if known beforehand.

Author:
Hans Joachim Ferreau, Boris Houska, Milan Vukov

Definition at line 63 of file export_variable_internal.hpp.


Constructor & Destructor Documentation

Default constructor.

Definition at line 48 of file export_variable_internal.cpp.

ExportVariableInternal::ExportVariableInternal ( const std::string &  _name,
const DMatrixPtr _data,
ExportType  _type = REAL,
ExportStruct  _dataStruct = ACADO_LOCAL,
bool  _callItByValue = false,
const std::string &  _prefix = std::string() 
)

Constructor which takes the name and type string of the variable. Moreover, it initializes the variable with the dimensions and the values of the given matrix.

Parameters:
[in]_nameName of the argument.
[in]_dataDMatrix used for initialization.
[in]_typeData type of the argument.
[in]_dataStructGlobal data struct to which the argument belongs to (if any).
[in]_callByValueFlag indicating whether argument it to be called by value.

Definition at line 61 of file export_variable_internal.cpp.

Destructor.

Definition at line 82 of file export_variable_internal.cpp.


Member Function Documentation

Clone constructor (deep copy).

Returns:
Pointer to cloned object.

Reimplemented from ExportArgumentInternal.

Definition at line 86 of file export_variable_internal.cpp.

const std::string ExportVariableInternal::get ( const ExportIndex rowIdx,
const ExportIndex colIdx 
) const

Returns string containing the value of a given component. If its value is undefined, the string contains the address of the component.

Parameters:
[in]rowIdxVariable row index of the component.
[in]colIdxVariable column index of the component.
Returns:
std::string containing the value of a given component

Definition at line 122 of file export_variable_internal.cpp.

Returns a new variable containing only the given column of the variable.

Parameters:
[in]idxVariable column index.
Returns:
New variable containing only the given column of the variable

Definition at line 216 of file export_variable_internal.cpp.

uint ExportVariableInternal::getColDim ( ) const [protected, virtual]

Returns column dimension of the variable.

Returns:
Column dimension of the variable

Reimplemented from ExportArgumentInternal.

Definition at line 409 of file export_variable_internal.cpp.

ExportVariable ExportVariableInternal::getCols ( const ExportIndex idx1,
const ExportIndex idx2 
) const

Returns a new variable containing only the given columns of the variable.

Parameters:
[in]idx1Variable index of first column of new variable.
[in]idx2Variable index following last column of new variable.
Returns:
New variable containing only the given columns of the variable

Definition at line 269 of file export_variable_internal.cpp.

uint ExportVariableInternal::getDim ( ) const [virtual]

Returns total dimension of the variable.

Returns:
Total dimension of the variable

Reimplemented from ExportArgumentInternal.

Definition at line 176 of file export_variable_internal.cpp.

Returns the internal data matrix.

Returns:
Internal data matrix

Definition at line 389 of file export_variable_internal.cpp.

Returns number of columns of the variable.

Returns:
Number of columns of the variable

Reimplemented from ExportArgumentInternal.

Definition at line 167 of file export_variable_internal.cpp.

Returns number of rows of the variable.

Returns:
Number of rows of the variable

Reimplemented from ExportArgumentInternal.

Definition at line 158 of file export_variable_internal.cpp.

Returns a new variable containing only the given row of the variable.

Parameters:
[in]idxVariable row index.
Returns:
New variable containing only the given row of the variable

Definition at line 194 of file export_variable_internal.cpp.

ExportVariable ExportVariableInternal::getRows ( const ExportIndex idx1,
const ExportIndex idx2 
) const

Returns a new variable containing only the given rows of the variable.

Parameters:
[in]idx1Variable index of first row of new variable.
[in]idx2Variable index following last row of new variable.
Returns:
New variable containing only the given rows of the variable

Definition at line 238 of file export_variable_internal.cpp.

ExportVariable ExportVariableInternal::getSubMatrix ( const ExportIndex _rowIdx1,
const ExportIndex _rowIdx2,
const ExportIndex _colIdx1,
const ExportIndex _colIdx2 
) const

Returns a new variable containing only the given rows and columns of the variable.

Parameters:
[in]rowIdx1Variable index of first row of new variable.
[in]rowIdx2Variable index following last row of new variable.
[in]colIdx1Variable index of first column of new variable.
[in]colIdx2Variable index following last column of new variable.
Returns:
New variable containing only the given sub-matrix of the variable

Definition at line 300 of file export_variable_internal.cpp.

ExportIndex ExportVariableInternal::getTotalIdx ( const ExportIndex rowIdx,
const ExportIndex colIdx 
) const [protected, virtual]

Returns total index of given component within memory.

Parameters:
[in]rowIdxRow index of the component.
[in]colIdxColumn index of the component.
Returns:
Total index of given component

Reimplemented from ExportArgumentInternal.

Definition at line 418 of file export_variable_internal.cpp.

Returns a copy of the variable with transposed components.

Returns:
Copy of the variable with transposed components

Definition at line 182 of file export_variable_internal.cpp.

bool ExportVariableInternal::hasValue ( const ExportIndex _rowIdx,
const ExportIndex _colIdx,
double  _value 
) const [protected]

Returns whether given component is set to given value.

Parameters:
[in]rowIdxVariable row index of the component.
[in]colIdxVariable column index of the component.
[in]_valueValue used for comparison.
Returns:
true iff given component is set to given value,
false otherwise

Definition at line 462 of file export_variable_internal.cpp.

Check whether the matrix is diagonal.

Definition at line 487 of file export_variable_internal.cpp.

bool ExportVariableInternal::isGiven ( const ExportIndex rowIdx,
const ExportIndex colIdx 
) const

Returns whether given component is set to a given value.

Parameters:
[in]rowIdxVariable row index of the component.
[in]colIdxVariable column index of the component.
Returns:
true iff given component is set to a given value,
false otherwise

Definition at line 106 of file export_variable_internal.cpp.

bool ExportVariableInternal::isGiven ( ) const [virtual]

Returns whether all components of the argument are given.

Returns:
true iff all components of the argument have given values,
false otherwise

Reimplemented from ExportArgumentInternal.

Definition at line 116 of file export_variable_internal.cpp.

bool ExportVariableInternal::isOne ( const ExportIndex rowIdx,
const ExportIndex colIdx 
) const

Returns whether given component is set to one.

Parameters:
[in]rowIdxVariable row index of the component.
[in]colIdxVariable column index of the component.
Returns:
true iff given component is set to one,
false otherwise

Definition at line 98 of file export_variable_internal.cpp.

Check whether the matrix is actually a submatrix.

Definition at line 479 of file export_variable_internal.cpp.

Returns whether variable is a vector.

Returns:
true iff variable is a vector,
false otherwise

Definition at line 380 of file export_variable_internal.cpp.

bool ExportVariableInternal::isZero ( const ExportIndex rowIdx,
const ExportIndex colIdx 
) const

Returns whether given component is set to zero.

Parameters:
[in]rowIdxVariable row index of the component.
[in]colIdxVariable column index of the component.
Returns:
true iff given component is set to zero,
false otherwise

Definition at line 91 of file export_variable_internal.cpp.

Returns a copy of the variable that is transformed to a column vector.

Returns:
Copy of the variable that is transformed to a column vector

Definition at line 367 of file export_variable_internal.cpp.

Returns a copy of the variable that is transformed to a row vector.

Returns:
Copy of the variable that is transformed to a row vector

Definition at line 354 of file export_variable_internal.cpp.

Prints contents of variable to screen.

Returns:
SUCCESSFUL_RETURN

Definition at line 398 of file export_variable_internal.cpp.

returnValue ExportVariableInternal::setSubmatrixOffsets ( const ExportIndex _rowOffset,
const ExportIndex _colOffset,
unsigned  _rowDim = 0,
unsigned  _colDim = 0,
unsigned  _nRows = 0,
unsigned  _nCols = 0 
) [protected]

Assigns offsets and dimensions of a sub-matrix. This function is used to access only a sub-matrix of the variable without copying its values to a new variable.

Parameters:
[in]_rowOffsetVariable index of first row of sub-matrix.
[in]_colOffsetVariable index of first column of sub-matrix.
[in]_rowDimRow dimension of variable (as only the submatrix data is stored).
[in]_colDimColumn dimension of variable (as only the submatrix data is stored).
[in]_nRowsNumber of rows of sub-matrix.
[in]_nColsNumber of columns of sub-matrix.
Returns:
SUCCESSFUL_RETURN,
RET_INVALID_ARGUMENTS

Definition at line 433 of file export_variable_internal.cpp.


Member Data Documentation

unsigned ExportVariableInternal::colDim [protected]

Column dimension of variable (as only the submatrix data is stored).

Definition at line 339 of file export_variable_internal.hpp.

Index of first column of a possible sub-matrix of the variable.

Definition at line 337 of file export_variable_internal.hpp.

Flag indicating whether variable is to be accessed in a transposed manner.

Definition at line 334 of file export_variable_internal.hpp.

unsigned ExportVariableInternal::nCols [protected]

Number of columns of a possible sub-matrix of the variable.

Definition at line 341 of file export_variable_internal.hpp.

unsigned ExportVariableInternal::nRows [protected]

Number of rows of a possible sub-matrix of the variable.

Definition at line 340 of file export_variable_internal.hpp.

unsigned ExportVariableInternal::rowDim [protected]

Row dimension of variable (as only the submatrix data is stored).

Definition at line 338 of file export_variable_internal.hpp.

Index of first row of a possible sub-matrix of the variable.

Definition at line 336 of file export_variable_internal.hpp.


The documentation for this class was generated from the following files:


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:40:24