Public Member Functions | Private Member Functions | Friends

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

#include <export_variable.hpp>

Inheritance diagram for ExportVariable:
Inheritance graph
[legend]

List of all members.

Public Member Functions

ExportVariable clone () const
 Deep copy.
 ExportVariable ()
 ExportVariable (const std::string &_name, uint _nRows, uint _nCols, ExportType _type=REAL, ExportStruct _dataStruct=ACADO_LOCAL, bool _callItByValue=false, const std::string &_prefix=std::string())
 ExportVariable (const std::string &_name, const DMatrix &_data, ExportType _type=REAL, ExportStruct _dataStruct=ACADO_LOCAL, bool _callItByValue=false, const std::string &_prefix=std::string(), bool _isGiven=true)
 ExportVariable (const std::string &_name, const DMatrixPtr &_data, ExportType _type=REAL, ExportStruct _dataStruct=ACADO_LOCAL, bool _callItByValue=false, const std::string &_prefix=std::string())
 ExportVariable (unsigned _nRows, unsigned _nCols, 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
ExportVariable getElement (const ExportIndex &rowIdx, const ExportIndex &colIdx) 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
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
double operator() (uint rowIdx, uint colIdx) const
double operator() (uint totalIdx) const
ExportArithmeticStatement operator+ (ExportArithmeticStatement arg) const
ExportArithmeticStatement operator+= (ExportArithmeticStatement arg) const
ExportArithmeticStatement operator- (ExportArithmeticStatement arg) const
ExportArithmeticStatement operator-= (ExportArithmeticStatement arg) const
ExportVariableInternaloperator-> ()
const ExportVariableInternaloperator-> () const
ExportArithmeticStatement operator== (ExportArithmeticStatement arg) const
returnValue print () const
ExportVariablesetup (const std::string &_name, uint _nRows=1, uint _nCols=1, ExportType _type=REAL, ExportStruct _dataStruct=ACADO_LOCAL, bool _callItByValue=false, const std::string &_prefix=std::string())
ExportVariablesetup (const std::string &_name, const DMatrix &_data, ExportType _type=REAL, ExportStruct _dataStruct=ACADO_LOCAL, bool _callItByValue=false, const std::string &_prefix=std::string(), bool _isGiven=true)
virtual ~ExportVariable ()
Constructor which converts a given matrix/vector/scalar into an ExportVariable.
template<typename Derived >
 ExportVariable (const Eigen::MatrixBase< Derived > &_data)
 ExportVariable (const double _data)

Private Member Functions

void simpleForward (const DMatrix &_value)

Friends

ExportArithmeticStatement operator* (const ExportVariable &arg1, const ExportVariable &arg2)
ExportArithmeticStatement operator+ (const ExportVariable &arg1, const ExportVariable &arg2)
ExportArithmeticStatement operator+= (const ExportVariable &arg1, const ExportVariable &arg2)
ExportArithmeticStatement operator- (const ExportVariable &arg1, const ExportVariable &arg2)
ExportArithmeticStatement operator-= (const ExportVariable &arg1, const ExportVariable &arg2)
ExportArithmeticStatement operator== (const ExportVariable &arg1, const ExportVariable &arg2)
ExportArithmeticStatement operator^ (const ExportVariable &arg1, const ExportVariable &arg2)

Detailed Description

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

The class ExportVariable 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 ExportVariable are undefined, but each of its component can be set to a fixed value if known beforehand.

Authors:
Hans Joachim Ferreau, Boris Houska, Milan Vukov

Definition at line 58 of file export_variable.hpp.


Constructor & Destructor Documentation

Default constructor.

Definition at line 52 of file export_variable.cpp.

ExportVariable::ExportVariable ( const std::string &  _name,
uint  _nRows,
uint  _nCols,
ExportType  _type = REAL,
ExportStruct  _dataStruct = ACADO_LOCAL,
bool  _callItByValue = false,
const std::string &  _prefix = std::string() 
)

Constructor which takes the name, type string and dimensions of the variable.

Parameters:
[in]_nameName of the argument.
[in]_nRowsNumber of rows of the argument.
[in]_nColsNumber of columns of the argument.
[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 57 of file export_variable.cpp.

ExportVariable::ExportVariable ( const std::string &  _name,
const DMatrix _data,
ExportType  _type = REAL,
ExportStruct  _dataStruct = ACADO_LOCAL,
bool  _callItByValue = false,
const std::string &  _prefix = std::string(),
bool  _isGiven = true 
)

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 73 of file export_variable.cpp.

ExportVariable::ExportVariable ( 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]_dataShared pointer to DMatrix 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 100 of file export_variable.cpp.

ExportVariable::ExportVariable ( unsigned  _nRows,
unsigned  _nCols,
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 of the matrix.

Parameters:
[in]_nRowsName of the argument.
[in]_nColsName of the argument.
[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 86 of file export_variable.cpp.

template<typename Derived >
ExportVariable::ExportVariable ( const Eigen::MatrixBase< Derived > &  _data) [inline]

Definition at line 145 of file export_variable.hpp.

ExportVariable::ExportVariable ( const double  _data)
Parameters:
_dataScalar used for initialization

Definition at line 117 of file export_variable.cpp.

Destructor.

Definition at line 123 of file export_variable.cpp.


Member Function Documentation

Deep copy.

Reimplemented from CasADi::SharedObject.

Definition at line 126 of file export_variable.cpp.

const std::string ExportVariable::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 227 of file export_variable.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 402 of file export_variable.cpp.

ExportVariable ExportVariable::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 417 of file export_variable.cpp.

uint ExportVariable::getDim ( ) const [virtual]

Returns total dimension of the variable.

Returns:
Total dimension of the variable

Reimplemented from ExportArgument.

Definition at line 245 of file export_variable.cpp.

ExportVariable ExportVariable::getElement ( const ExportIndex rowIdx,
const ExportIndex colIdx 
) const

Returns element at position (rowIdx, colIdx).

Parameters:
[in]rowIdxVariable row index of the component.
[in]colIdxVariable column index of the component.
Returns:
Element at position (rowIdx, colIdx)

Definition at line 434 of file export_variable.cpp.

Returns the internal data matrix.

Returns:
Internal data matrix

Definition at line 460 of file export_variable.cpp.

uint ExportVariable::getNumCols ( ) const [virtual]

Returns number of columns of the variable.

Returns:
Number of columns of the variable

Reimplemented from ExportArgument.

Definition at line 239 of file export_variable.cpp.

uint ExportVariable::getNumRows ( ) const [virtual]

Returns number of rows of the variable.

Returns:
Number of rows of the variable

Reimplemented from ExportArgument.

Definition at line 234 of file export_variable.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 395 of file export_variable.cpp.

ExportVariable ExportVariable::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 409 of file export_variable.cpp.

ExportVariable ExportVariable::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 425 of file export_variable.cpp.

Returns a copy of the variable with transposed components.

Returns:
Copy of the variable with transposed components

Definition at line 390 of file export_variable.cpp.

Check whether the matrix is diagonal.

Definition at line 476 of file export_variable.cpp.

bool ExportVariable::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 213 of file export_variable.cpp.

bool ExportVariable::isGiven ( ) const [virtual]

Returns whether all components of the variable are set to a given value.

Returns:
true iff all components of the variable are set to a given value,
false otherwise

Reimplemented from ExportArgument.

Definition at line 221 of file export_variable.cpp.

bool ExportVariable::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 205 of file export_variable.cpp.

Check whether the matrix is actually a submatrix.

Definition at line 471 of file export_variable.cpp.

bool ExportVariable::isVector ( ) const

Returns whether variable is a vector.

Returns:
true iff variable is a vector,
false otherwise

Definition at line 454 of file export_variable.cpp.

bool ExportVariable::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 197 of file export_variable.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 448 of file export_variable.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 442 of file export_variable.cpp.

double ExportVariable::operator() ( uint  rowIdx,
uint  colIdx 
) const

Returns value of given component.

Parameters:
[in]rowIdxRow index of the component to be returned.
[in]colIdxColumn index of the component to be returned.
Returns:
SUCCESSFUL_RETURN

Definition at line 182 of file export_variable.cpp.

double ExportVariable::operator() ( uint  totalIdx) const

Returns value of given component.

Parameters:
[in]totalIdxMemory location of the component to be returned.
Returns:
SUCCESSFUL_RETURN

Definition at line 190 of file export_variable.cpp.

ExportArithmeticStatement ExportVariable::operator+ ( ExportArithmeticStatement  arg) const

Operator for adding an arithmetic statement to an ExportVariable.

Parameters:
[in]argArithmetic statement to be added.
Returns:
Arithmetic statement containing the addition

Definition at line 336 of file export_variable.cpp.

ExportArithmeticStatement ExportVariable::operator+= ( ExportArithmeticStatement  arg) const

Operator for add-assigning an arithmetic statement to an ExportVariable.

Parameters:
[in]argArithmetic statement to be add-assigned.
Returns:
Arithmetic statement containing the add-assignment

Definition at line 360 of file export_variable.cpp.

ExportArithmeticStatement ExportVariable::operator- ( ExportArithmeticStatement  arg) const

Operator for subtraction an arithmetic statement from an ExportVariable.

Parameters:
[in]argArithmetic statement to be subtracted.
Returns:
Arithmetic statement containing the subtraction

Definition at line 348 of file export_variable.cpp.

ExportArithmeticStatement ExportVariable::operator-= ( ExportArithmeticStatement  arg) const

Operator for subtract-assigning an arithmetic statement from an ExportVariable.

Parameters:
[in]argArithmetic statement to be subtract-assigned.
Returns:
Arithmetic statement containing the subtract-assignment

Definition at line 375 of file export_variable.cpp.

ExportVariableInternal * ExportVariable::operator-> ( )

An operator for access to functions and members of the node

Reimplemented from ExportArgument.

Definition at line 136 of file export_variable.cpp.

const ExportVariableInternal * ExportVariable::operator-> ( ) const

An operator for const access to functions and members of the node

Reimplemented from ExportArgument.

Definition at line 142 of file export_variable.cpp.

ExportArithmeticStatement ExportVariable::operator== ( ExportArithmeticStatement  arg) const

Operator for assigning an arithmetic statement to an ExportVariable.

Parameters:
[in]argArithmetic statement to be assigned.
Returns:
Arithmetic statement containing the assignment

Definition at line 326 of file export_variable.cpp.

Prints contents of variable to screen.

Returns:
SUCCESSFUL_RETURN

Definition at line 466 of file export_variable.cpp.

ExportVariable & ExportVariable::setup ( const std::string &  _name,
uint  _nRows = 1,
uint  _nCols = 1,
ExportType  _type = REAL,
ExportStruct  _dataStruct = ACADO_LOCAL,
bool  _callItByValue = false,
const std::string &  _prefix = std::string() 
)

Initializes variable with given name, type string and dimensions of the variable.

Parameters:
[in]_nameName of the argument.
[in]_nRowsNumber of rows of the argument.
[in]_nColsNumber of columns of the argument.
[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.
Returns:
Reference to initialized object

Definition at line 148 of file export_variable.cpp.

ExportVariable & ExportVariable::setup ( const std::string &  _name,
const DMatrix _data,
ExportType  _type = REAL,
ExportStruct  _dataStruct = ACADO_LOCAL,
bool  _callItByValue = false,
const std::string &  _prefix = std::string(),
bool  _isGiven = true 
)

Initializes variable with given name and type string of the variable. Moreover, the variable is initialized 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.
Returns:
Reference to initialized object

Definition at line 166 of file export_variable.cpp.

void ExportVariable::simpleForward ( const DMatrix _value) [private]

Definition at line 111 of file export_variable.cpp.


Friends And Related Function Documentation

ExportArithmeticStatement operator* ( const ExportVariable arg1,
const ExportVariable arg2 
) [friend]

Operator for multiplying two ExportVariables.

Parameters:
[in]argVariable to be multiplied from the right.
Returns:
Arithmetic statement containing the multiplication

Definition at line 295 of file export_variable.cpp.

ExportArithmeticStatement operator+ ( const ExportVariable arg1,
const ExportVariable arg2 
) [friend]

Operator for adding two ExportVariables.

Parameters:
[in]argVariable to be added.
Returns:
Arithmetic statement containing the addition

Definition at line 251 of file export_variable.cpp.

ExportArithmeticStatement operator+= ( const ExportVariable arg1,
const ExportVariable arg2 
) [friend]

Operator for add-assigning an ExportVariable to another.

Parameters:
[in]argVariable to be add-assigned.
Returns:
Arithmetic statement containing the add-assignment

Definition at line 273 of file export_variable.cpp.

ExportArithmeticStatement operator- ( const ExportVariable arg1,
const ExportVariable arg2 
) [friend]

Operator for subtracting an ExportVariable from another.

Parameters:
[in]argVariable to be subtracted.
Returns:
Arithmetic statement containing the subtraction

Definition at line 262 of file export_variable.cpp.

ExportArithmeticStatement operator-= ( const ExportVariable arg1,
const ExportVariable arg2 
) [friend]

Operator for subtract-assigning an ExportVariables from another.

Parameters:
[in]argVariable to be subtract-assigned.
Returns:
Arithmetic statement containing the subtract-assignment

Definition at line 284 of file export_variable.cpp.

ExportArithmeticStatement operator== ( const ExportVariable arg1,
const ExportVariable arg2 
) [friend]

Operator for assigning an ExportVariable to another.

Parameters:
[in]argVariable to be assined.
Returns:
Arithmetic statement containing the assignment

Definition at line 315 of file export_variable.cpp.

ExportArithmeticStatement operator^ ( const ExportVariable arg1,
const ExportVariable arg2 
) [friend]

Operator for multiplying an ExportVariable to the transposed on another.

Parameters:
[in]argVariable to be multiplied from the right.
Returns:
Arithmetic statement containing the multiplication with left-hand side variable transposed

Definition at line 305 of file export_variable.cpp.


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


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 12:01:38