Public Member Functions | Protected Member Functions | Protected Attributes | List of all members

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

#include <export_variable_internal.hpp>

Inheritance diagram for ExportVariableInternal:
Inheritance graph
[legend]

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 ()
 
- Public Member Functions inherited from ExportArgumentInternal
returnValue callByValue ()
 
virtual void deepCopyMembers (std::map< CasADi::SharedObjectNode *, CasADi::SharedObject > &already_copied)
 
 ExportArgumentInternal ()
 
 ExportArgumentInternal (const std::string &_name, const DMatrixPtr &_data, ExportType _type, ExportStruct _dataStruct, bool _callByValue, const ExportIndex &_addressIdx, const std::string &_prefix)
 
virtual returnValue exportDataDeclaration (std::ostream &stream, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16) const
 
ExportArgument getAddress (const ExportIndex &rowIdx, const ExportIndex &colIdx=emptyConstExportIndex) const
 
const std::string getAddressString (bool withDataStruct=true) const
 
bool isCalledByValue () const
 
virtual ~ExportArgumentInternal ()
 
- Public Member Functions inherited from ExportDataInternal
 ExportDataInternal (const std::string &_name=std::string(), ExportType _type=REAL, ExportStruct _dataStruct=ACADO_LOCAL, const std::string &_prefix=std::string())
 
ExportStruct getDataStruct () const
 
std::string getDataStructString () const
 
virtual std::string getDoc () const
 
std::string getFullName () const
 
std::string getName () const
 
std::string getPrefix () const
 
ExportType getType () const
 
std::string getTypeString (const std::string &_realString="real_t", const std::string &_intString="int") const
 
returnValue setDataStruct (ExportStruct _dataStruct)
 
virtual returnValue setDoc (const std::string &_doc)
 
returnValue setName (const std::string &_name)
 
returnValue setPrefix (const std::string &_prefix)
 
returnValue setType (ExportType _type)
 
virtual ~ExportDataInternal ()
 
- Public Member Functions inherited from CasADi::SharedObjectNode
void assertInit () const
 Assert that the object has been initialized. More...
 
int getCount () const
 Get the reference count. More...
 
virtual void init ()
 Initialize the object. More...
 
bool isInit () const
 Check if the object has been initialized. More...
 
SharedObjectNodeoperator= (const SharedObjectNode &node)
 Assignment operator. More...
 
virtual void print (std::ostream &stream) const
 Print a destription of the object. More...
 
virtual void repr (std::ostream &stream) const
 Print a representation of the object. More...
 
 SharedObjectNode ()
 Default constructor. More...
 
 SharedObjectNode (const SharedObjectNode &node)
 Copy constructor. More...
 
virtual ~SharedObjectNode ()=0
 Destructor. More...
 

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 Member Functions inherited from ExportDataInternal
returnValue setFullName (void)
 
- Protected Member Functions inherited from CasADi::SharedObjectNode
template<class B >
shared_from_this ()
 Get a shared object from the current internal object. More...
 
template<class B >
const B shared_from_this () const
 Get a shared object from the current internal object. More...
 

Protected Attributes

unsigned colDim
 
ExportIndex colOffset
 
bool doAccessTransposed
 
unsigned nCols
 
unsigned nRows
 
unsigned rowDim
 
ExportIndex rowOffset
 
- Protected Attributes inherited from ExportArgumentInternal
ExportIndex addressIdx
 
bool callItByValue
 
DMatrixPtr data
 
- Protected Attributes inherited from ExportDataInternal
ExportStruct dataStruct
 
std::string description
 
std::string fullName
 
std::string name
 
std::string prefix
 
ExportType type
 
- Protected Attributes inherited from CasADi::SharedObjectNode
bool is_init_
 Has the function been initialized? More...
 

Additional Inherited Members

- Static Public Attributes inherited from ExportDataInternal
static std::string fcnPrefix = "acado"
 

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

ExportVariableInternal::ExportVariableInternal ( )

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.

ExportVariableInternal::~ExportVariableInternal ( )
virtual

Destructor.

Definition at line 82 of file export_variable_internal.cpp.

Member Function Documentation

ExportVariableInternal * ExportVariableInternal::clone ( ) const
virtual

Clone constructor (deep copy).

\return 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.

ExportVariable ExportVariableInternal::getCol ( const ExportIndex idx) const

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

@param[in] idx                      Variable column index.

\return New variable containing only the given column of the variable

Definition at line 216 of file export_variable_internal.cpp.

uint ExportVariableInternal::getColDim ( ) const
protectedvirtual

Returns column dimension of the variable.

\return 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.

@param[in] idx1                     Variable index of first column of new variable.
@param[in] idx2                     Variable index following last column of new variable.

\return 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.

\return Total dimension of the variable

Reimplemented from ExportArgumentInternal.

Definition at line 176 of file export_variable_internal.cpp.

const DMatrix & ExportVariableInternal::getGivenMatrix ( ) const

Returns the internal data matrix.

\return Internal data matrix

Definition at line 389 of file export_variable_internal.cpp.

uint ExportVariableInternal::getNumCols ( ) const
virtual

Returns number of columns of the variable.

\return Number of columns of the variable

Reimplemented from ExportArgumentInternal.

Definition at line 167 of file export_variable_internal.cpp.

uint ExportVariableInternal::getNumRows ( ) const
virtual

Returns number of rows of the variable.

\return Number of rows of the variable

Reimplemented from ExportArgumentInternal.

Definition at line 158 of file export_variable_internal.cpp.

ExportVariable ExportVariableInternal::getRow ( const ExportIndex idx) const

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

@param[in] idx                      Variable row index.

\return 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.

@param[in] idx1                     Variable index of first row of new variable.
@param[in] idx2                     Variable index following last row of new variable.

\return 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.

@param[in] rowIdx1          Variable index of first row of new variable.
@param[in] rowIdx2          Variable index following last row of new variable.
@param[in] colIdx1          Variable index of first column of new variable.
@param[in] colIdx2          Variable index following last column of new variable.

\return 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
protectedvirtual

Returns total index of given component within memory.

@param[in] rowIdx           Row index of the component.
@param[in] colIdx           Column index of the component.

\return Total index of given component

Reimplemented from ExportArgumentInternal.

Definition at line 418 of file export_variable_internal.cpp.

ExportVariable ExportVariableInternal::getTranspose ( ) const

Returns a copy of the variable with transposed components.

\return 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.

@param[in] rowIdx           Variable row index of the component.
@param[in] colIdx           Variable column index of the component.
@param[in] _value           Value used for comparison.

\return true  iff given component is set to given value, \n
        false otherwise

Definition at line 462 of file export_variable_internal.cpp.

bool ExportVariableInternal::isDiagonal ( ) const

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.

@param[in] rowIdx           Variable row index of the component.
@param[in] colIdx           Variable column index of the component.

\return true  iff given component is set to a given value, \n
        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.

\return true  iff all components of the argument have given values, \n
        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.

@param[in] rowIdx           Variable row index of the component.
@param[in] colIdx           Variable column index of the component.

\return true  iff given component is set to one, \n
        false otherwise

Definition at line 98 of file export_variable_internal.cpp.

bool ExportVariableInternal::isSubMatrix ( ) const

Check whether the matrix is actually a submatrix.

Definition at line 479 of file export_variable_internal.cpp.

bool ExportVariableInternal::isVector ( ) const

Returns whether variable is a vector.

\return true  iff variable is a vector, \n
        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.

@param[in] rowIdx           Variable row index of the component.
@param[in] colIdx           Variable column index of the component.

\return true  iff given component is set to zero, \n
        false otherwise

Definition at line 91 of file export_variable_internal.cpp.

ExportVariable ExportVariableInternal::makeColVector ( ) const

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

\return Copy of the variable that is transformed to a column vector

Definition at line 367 of file export_variable_internal.cpp.

ExportVariable ExportVariableInternal::makeRowVector ( ) const

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

\return Copy of the variable that is transformed to a row vector

Definition at line 354 of file export_variable_internal.cpp.

returnValue ExportVariableInternal::print ( ) const

Prints contents of variable to screen.

\return 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.

ExportIndex ExportVariableInternal::colOffset
protected

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

Definition at line 337 of file export_variable_internal.hpp.

bool ExportVariableInternal::doAccessTransposed
protected

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.

ExportIndex ExportVariableInternal::rowOffset
protected

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 Mon Jun 10 2019 12:35:24