Provides a time grid consisting of matrix-valued optimization variables at each grid point. More...
#include <matrix_variables_grid.hpp>
Public Member Functions | |
returnValue | addMatrix (const DMatrix &newMatrix, double newTime=-INFTY) |
returnValue | appendTimes (const MatrixVariablesGrid &arg, MergeMethod _mergeMethod=MM_DUPLICATE) |
returnValue | appendValues (const MatrixVariablesGrid &arg) |
returnValue | coarsenGrid (const Grid &arg) |
returnValue | disableAutoInit () |
returnValue | enableAutoInit () |
BooleanType | getAutoInit (uint pointIdx) const |
MatrixVariablesGrid | getCoarsenedGrid (const Grid &arg) const |
uint | getDim () const |
DMatrix | getFirstMatrix () const |
returnValue | getGrid (Grid &_grid) const |
DMatrix | getLastMatrix () const |
double | getLowerBound (uint pointIdx, uint valueIdx) const |
DVector | getLowerBounds (uint pointIdx) const |
DMatrix | getMatrix (uint pointIdx) const |
double | getMax () const |
double | getMean () const |
double | getMin () const |
returnValue | getName (uint pointIdx, uint idx, char *const _name) const |
uint | getNumCols () const |
uint | getNumCols (uint pointIdx) const |
uint | getNumRows () const |
uint | getNumRows (uint pointIdx) const |
uint | getNumValues () const |
uint | getNumValues (uint pointIdx) const |
MatrixVariablesGrid | getRefinedGrid (const Grid &arg, InterpolationMode mode=IM_CONSTANT) const |
DVector | getScaling (uint pointIdx) const |
double | getScaling (uint pointIdx, uint valueIdx) const |
Grid | getTimePoints () const |
MatrixVariablesGrid | getTimeSubGrid (uint startIdx, uint endIdx) const |
VariableType | getType () const |
VariableType | getType (uint pointIdx) const |
returnValue | getUnit (uint pointIdx, uint idx, char *const _unit) const |
double | getUpperBound (uint pointIdx, uint valueIdx) const |
DVector | getUpperBounds (uint pointIdx) const |
MatrixVariablesGrid | getValuesSubGrid (uint startIdx, uint endIdx) const |
BooleanType | hasLowerBounds () const |
BooleanType | hasNames () const |
BooleanType | hasScaling () const |
BooleanType | hasUnits () const |
BooleanType | hasUpperBounds () const |
returnValue | init () |
returnValue | init (uint _nRows, uint _nCols, const Grid &_grid, VariableType _type=VT_UNKNOWN, const char **const _names=0, const char **const _units=0, const DVector *const _scaling=0, const DVector *const _lb=0, const DVector *const _ub=0, const BooleanType *const _autoInit=0) |
returnValue | init (uint _nRows, uint _nCols, uint _nPoints, VariableType _type=VT_UNKNOWN, const char **const _names=0, const char **const _units=0, const DVector *const _scaling=0, const DVector *const _lb=0, const DVector *const _ub=0, const BooleanType *const _autoInit=0) |
returnValue | init (uint _nRows, uint _nCols, double _firstTime, double _lastTime, uint _nPoints, VariableType _type=VT_UNKNOWN, const char **const _names=0, const char **const _units=0, const DVector *const _scaling=0, const DVector *const _lb=0, const DVector *const _ub=0, const BooleanType *const _autoInit=0) |
returnValue | init (const DMatrix &arg, const Grid &_grid=trivialGrid, VariableType _type=VT_UNKNOWN) |
DVector | linearInterpolation (double time) const |
MatrixVariablesGrid () | |
MatrixVariablesGrid (uint _nRows, uint _nCols, const Grid &_grid, VariableType _type=VT_UNKNOWN, const char **const _names=0, const char **const _units=0, const DVector *const _scaling=0, const DVector *const _lb=0, const DVector *const _ub=0, const BooleanType *const _autoInit=0) | |
MatrixVariablesGrid (uint _nRows, uint _nCols, uint _nPoints, VariableType _type=VT_UNKNOWN, const char **const _names=0, const char **const _units=0, const DVector *const _scaling=0, const DVector *const _lb=0, const DVector *const _ub=0, const BooleanType *const _autoInit=0) | |
MatrixVariablesGrid (uint _nRows, uint _nCols, double _firstTime, double _lastTime, uint _nPoints, VariableType _type=VT_UNKNOWN, const char **const _names=0, const char **const _units=0, const DVector *const _scaling=0, const DVector *const _lb=0, const DVector *const _ub=0, const BooleanType *const _autoInit=0) | |
MatrixVariablesGrid (const DMatrix &arg, const Grid &_grid=trivialGrid, VariableType _type=VT_UNKNOWN) | |
MatrixVariablesGrid (const MatrixVariablesGrid &rhs) | |
returnValue | merge (const MatrixVariablesGrid &arg, MergeMethod _mergeMethod=MM_DUPLICATE, BooleanType keepOverlap=BT_TRUE) |
double & | operator() (uint pointIdx, uint rowIdx, uint colIdx) |
double | operator() (uint pointIdx, uint rowIdx, uint colIdx) const |
MatrixVariablesGrid | operator() (const uint rowIdx) const |
MatrixVariablesGrid | operator+ (const MatrixVariablesGrid &arg) const |
MatrixVariablesGrid & | operator+= (const MatrixVariablesGrid &arg) |
MatrixVariablesGrid | operator- (const MatrixVariablesGrid &arg) const |
MatrixVariablesGrid & | operator-= (const MatrixVariablesGrid &arg) |
MatrixVariablesGrid & | operator= (const MatrixVariablesGrid &rhs) |
MatrixVariablesGrid & | operator= (const DMatrix &rhs) |
MatrixVariablesGrid | operator[] (const uint pointIdx) const |
returnValue | print (std::ostream &stream=std::cout, const char *const name=DEFAULT_LABEL, const char *const startString=DEFAULT_START_STRING, const char *const endString=DEFAULT_END_STRING, uint width=DEFAULT_WIDTH, uint precision=DEFAULT_PRECISION, const char *const colSeparator=DEFAULT_COL_SEPARATOR, const char *const rowSeparator=DEFAULT_ROW_SEPARATOR) const |
returnValue | print (const char *const filename, const char *const name=DEFAULT_LABEL, const char *const startString=DEFAULT_START_STRING, const char *const endString=DEFAULT_END_STRING, uint width=DEFAULT_WIDTH, uint precision=DEFAULT_PRECISION, const char *const colSeparator=DEFAULT_COL_SEPARATOR, const char *const rowSeparator=DEFAULT_ROW_SEPARATOR) const |
returnValue | print (const char *const filename, const char *const name, PrintScheme printScheme) const |
returnValue | print (std::ostream &stream, const char *const name, PrintScheme printScheme) const |
returnValue | read (std::istream &stream) |
returnValue | read (const char *const filename) |
returnValue | refineGrid (const Grid &arg, InterpolationMode mode=IM_CONSTANT) |
returnValue | setAll (double _value) |
returnValue | setAllMatrices (const DMatrix &_values) |
returnValue | setAutoInit (uint pointIdx, BooleanType _autoInit) |
returnValue | setLowerBound (uint pointIdx, uint valueIdx, double _lb) |
returnValue | setLowerBounds (uint pointIdx, const DVector &_lb) |
returnValue | setMatrix (uint pointIdx, const DMatrix &_value) const |
returnValue | setName (uint pointIdx, uint idx, const char *const _name) |
returnValue | setScaling (uint pointIdx, const DVector &_scaling) |
returnValue | setScaling (uint pointIdx, uint valueIdx, double _scaling) |
returnValue | setType (VariableType _type) |
returnValue | setType (uint pointIdx, VariableType _type) |
returnValue | setUnit (uint pointIdx, uint idx, const char *const _unit) |
returnValue | setUpperBound (uint pointIdx, uint valueIdx, double _ub) |
returnValue | setUpperBounds (uint pointIdx, const DVector &_ub) |
returnValue | setZero () |
MatrixVariablesGrid & | shiftBackwards (DMatrix lastValue=emptyMatrix) |
MatrixVariablesGrid & | shiftTimes (double timeShift) |
returnValue | sprint (std::ostream &stream) |
virtual | ~MatrixVariablesGrid () |
Protected Member Functions | |
returnValue | addMatrix (const MatrixVariable &newMatrix, double newTime=-INFTY) |
returnValue | clearValues () |
returnValue | initMatrixVariables (uint _nRows, uint _nCols, VariableType _type=VT_UNKNOWN, const char **const _names=0, const char **const _units=0, const DVector *const _scaling=0, const DVector *const _lb=0, const DVector *const _ub=0, const BooleanType *const _autoInit=0) |
Protected Attributes | |
MatrixVariable ** | values |
Friends | |
std::ostream & | operator<< (std::ostream &stream, const MatrixVariablesGrid &arg) |
std::istream & | operator>> (std::istream &stream, MatrixVariablesGrid &arg) |
Provides a time grid consisting of matrix-valued optimization variables at each grid point.
The class MatrixVariablesGrid provides a time grid consisting of matrix-valued optimization variables at each grid point, as they usually occur when discretizing optimal control problems.
The class inherits from the Grid class and stores the matrix-valued optimization variables in an re-allocatable array of MatrixVariables.
Definition at line 60 of file matrix_variables_grid.hpp.
Default constructor.
Definition at line 48 of file matrix_variables_grid.cpp.
MatrixVariablesGrid::MatrixVariablesGrid | ( | uint | _nRows, |
uint | _nCols, | ||
const Grid & | _grid, | ||
VariableType | _type = VT_UNKNOWN , |
||
const char **const | _names = 0 , |
||
const char **const | _units = 0 , |
||
const DVector *const | _scaling = 0 , |
||
const DVector *const | _lb = 0 , |
||
const DVector *const | _ub = 0 , |
||
const BooleanType *const | _autoInit = 0 |
||
) |
Constructor that takes the dimensions of each MatrixVariable as well as the grid on which they are defined. Further information can optionally be specified.
[in] | _nRows | Number of rows of each matrix. |
[in] | _nCols | Number of columns of each matrix. |
[in] | _grid | Grid on which the MatrixVariable(s) are defined. |
[in] | _type | Type of the variable(s). |
[in] | _names | Array containing name labels for each component of the variable(s). |
[in] | _units | Array containing unit labels for each component of the variable(s). |
[in] | _scaling | Array containing the scaling for each component of the variable(s). |
[in] | _lb | Array containing lower bounds for each component of the variable(s). |
[in] | _ub | Array containing upper bounds for each component of the variable(s). |
[in] | _autoInit | Array defining if each component of the variable(s) is to be automatically initialized. |
Definition at line 54 of file matrix_variables_grid.cpp.
MatrixVariablesGrid::MatrixVariablesGrid | ( | uint | _nRows, |
uint | _nCols, | ||
uint | _nPoints, | ||
VariableType | _type = VT_UNKNOWN , |
||
const char **const | _names = 0 , |
||
const char **const | _units = 0 , |
||
const DVector *const | _scaling = 0 , |
||
const DVector *const | _lb = 0 , |
||
const DVector *const | _ub = 0 , |
||
const BooleanType *const | _autoInit = 0 |
||
) |
Constructor that takes the dimensions of each MatrixVariable as well as the number of grid points on which they are defined. Further information can optionally be specified.
[in] | _nRows | Number of rows of each matrix. |
[in] | _nCols | Number of columns of each matrix. |
[in] | _nPoints | Number of grid points on which the MatrixVariable(s) are defined. |
[in] | _type | Type of the variable(s). |
[in] | _names | Array containing name labels for each component of the variable(s). |
[in] | _units | Array containing unit labels for each component of the variable(s). |
[in] | _scaling | Array containing the scaling for each component of the variable(s). |
[in] | _lb | Array containing lower bounds for each component of the variable(s). |
[in] | _ub | Array containing upper bounds for each component of the variable(s). |
[in] | _autoInit | Array defining if each component of the variable(s) is to be automatically initialized. |
Definition at line 71 of file matrix_variables_grid.cpp.
MatrixVariablesGrid::MatrixVariablesGrid | ( | uint | _nRows, |
uint | _nCols, | ||
double | _firstTime, | ||
double | _lastTime, | ||
uint | _nPoints, | ||
VariableType | _type = VT_UNKNOWN , |
||
const char **const | _names = 0 , |
||
const char **const | _units = 0 , |
||
const DVector *const | _scaling = 0 , |
||
const DVector *const | _lb = 0 , |
||
const DVector *const | _ub = 0 , |
||
const BooleanType *const | _autoInit = 0 |
||
) |
Constructor that takes the dimensions of each MatrixVariable as well as the number of grid points on which they are defined. Moreover, it takes the time of the first and the last grid point; all intermediate grid points are setup to form a equidistant grid of time points. Further information can optionally be specified.
[in] | _nRows | Number of rows of each matrix. |
[in] | _nCols | Number of columns of each matrix. |
[in] | _firstTime | Time of first grid point. |
[in] | _lastTime | Time of last grid point. |
[in] | _nPoints | Number of grid points on which the MatrixVariable(s) are defined. |
[in] | _type | Type of the variable(s). |
[in] | _names | Array containing name labels for each component of the variable(s). |
[in] | _units | Array containing unit labels for each component of the variable(s). |
[in] | _scaling | Array containing the scaling for each component of the variable(s). |
[in] | _lb | Array containing lower bounds for each component of the variable(s). |
[in] | _ub | Array containing upper bounds for each component of the variable(s). |
[in] | _autoInit | Array defining if each component of the variable(s) is to be automatically initialized. |
Definition at line 88 of file matrix_variables_grid.cpp.
MatrixVariablesGrid::MatrixVariablesGrid | ( | const DMatrix & | arg, |
const Grid & | _grid = trivialGrid , |
||
VariableType | _type = VT_UNKNOWN |
||
) |
Constructor that creates a variables grid on a given grid with given type. At each grid point, the MatrixVariable is constructed from the matrix passed.
[in] | arg | DMatrix to be assign at each point of the grid. |
[in] | _grid | Grid on which the MatrixVariable(s) are defined. |
[in] | _type | Type of the variable(s). |
Definition at line 107 of file matrix_variables_grid.cpp.
MatrixVariablesGrid::MatrixVariablesGrid | ( | const MatrixVariablesGrid & | rhs | ) |
Copy constructor (deep copy).
[in] | rhs | Right-hand side object. |
Definition at line 116 of file matrix_variables_grid.cpp.
MatrixVariablesGrid::~MatrixVariablesGrid | ( | ) | [virtual] |
Destructor.
Definition at line 129 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::addMatrix | ( | const DMatrix & | newMatrix, |
double | newTime = -INFTY |
||
) |
Adds a new grid point with given matrix and time to grid.
[in] | newMatrix | DMatrix of grid point to be added. |
[in] | newTime | Time of grid point to be added. |
Definition at line 279 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::addMatrix | ( | const MatrixVariable & | newMatrix, |
double | newTime = -INFTY |
||
) | [protected] |
Adds a new grid point with given MatrixVariable and time to grid.
[in] | newMatrix | MatrixVariable of grid point to be added. |
[in] | newTime | Time of grid point to be added. |
Definition at line 949 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::appendTimes | ( | const MatrixVariablesGrid & | arg, |
MergeMethod | _mergeMethod = MM_DUPLICATE |
||
) |
Appends grid point of given grid to object. A merge method defines the way duplicate entries are handled.
[in] | arg | Grid to append. |
[in] | _mergeMethod | Merge method, see documentation of MergeMethod for details. |
Definition at line 344 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::appendValues | ( | const MatrixVariablesGrid & | arg | ) |
Appends values at all grid points of given grid to object. Both grids need to be defined over identical grid points.
[in] | arg | Grid whose values are to appended. |
Definition at line 386 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::clearValues | ( | ) | [protected] |
Clears all MatrixVariables on the grid. Note that the grid itself is not cleared.
Definition at line 894 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::coarsenGrid | ( | const Grid & | arg | ) |
Coarsens the grid by removing all grid points of current grid that are not included in given grid. For doing so, the given grid has to be a subset of the current grid.
[in] | arg | Grid to be used for coarsening. |
Definition at line 555 of file matrix_variables_grid.cpp.
Enables auto initialization at all grid points.
Definition at line 1466 of file matrix_variables_grid.cpp.
Disables auto initialization at all grid points.
Definition at line 1475 of file matrix_variables_grid.cpp.
BooleanType MatrixVariablesGrid::getAutoInit | ( | uint | pointIdx | ) | const |
Returns whether MatrixVariable at grid point with given index will be automatically initialized.
[in] | pointIdx | Index of grid point. |
Definition at line 1442 of file matrix_variables_grid.cpp.
MatrixVariablesGrid MatrixVariablesGrid::getCoarsenedGrid | ( | const Grid & | arg | ) | const |
Returns a coarsened grid by removing all grid points of current grid that are not included in given grid. For doing so, the given grid has to be a subset of the current grid.
[in] | arg | Grid to be used for coarsening. |
Definition at line 608 of file matrix_variables_grid.cpp.
uint MatrixVariablesGrid::getDim | ( | ) | const |
Returns total dimension of MatrixVariablesGrid, i.e. the sum of dimensions of matrices at all grid point.
Definition at line 1128 of file matrix_variables_grid.cpp.
DMatrix MatrixVariablesGrid::getFirstMatrix | ( | ) | const |
Returns matrix at first grid point.
Definition at line 325 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::getGrid | ( | Grid & | _grid | ) | const |
Returns the time grid of MatrixVariablesGrid.
[out] | grid_ | Time grid. |
Definition at line 1609 of file matrix_variables_grid.cpp.
DMatrix MatrixVariablesGrid::getLastMatrix | ( | ) | const |
Returns matrix at last grid point.
Definition at line 334 of file matrix_variables_grid.cpp.
double MatrixVariablesGrid::getLowerBound | ( | uint | pointIdx, |
uint | valueIdx | ||
) | const |
Returns lower bound of given component of MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
[in] | valueIdx | Index of component. |
Definition at line 1365 of file matrix_variables_grid.cpp.
DVector MatrixVariablesGrid::getLowerBounds | ( | uint | pointIdx | ) | const |
Returns lower bounds of MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
Definition at line 1344 of file matrix_variables_grid.cpp.
DMatrix MatrixVariablesGrid::getMatrix | ( | uint | pointIdx | ) | const |
Returns matrix at grid point with given index.
[in] | pointIdx | Index of grid point. |
Definition at line 313 of file matrix_variables_grid.cpp.
double MatrixVariablesGrid::getMax | ( | ) | const |
Returns maximum value over all matrices at all grid points.
Definition at line 1546 of file matrix_variables_grid.cpp.
double MatrixVariablesGrid::getMean | ( | ) | const |
Returns mean value over all matrices at all grid points.
Definition at line 1574 of file matrix_variables_grid.cpp.
double MatrixVariablesGrid::getMin | ( | ) | const |
Returns minimum value over all matrices at all grid points.
Definition at line 1560 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::getName | ( | uint | pointIdx, |
uint | idx, | ||
char *const | _name | ||
) | const |
Returns name label of given component of MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
[in] | idx | Index of component. |
[out] | _name | Name label of given component at given grid point. |
Definition at line 1245 of file matrix_variables_grid.cpp.
uint MatrixVariablesGrid::getNumCols | ( | ) | const |
Returns number of columns of matrix at first grid point.
Definition at line 1149 of file matrix_variables_grid.cpp.
uint MatrixVariablesGrid::getNumCols | ( | uint | pointIdx | ) | const |
Returns number of columns of matrix at grid point with given index.
[in] | pointIdx | Index of grid point. |
Definition at line 1179 of file matrix_variables_grid.cpp.
uint MatrixVariablesGrid::getNumRows | ( | ) | const |
Returns number of rows of matrix at first grid point.
Definition at line 1140 of file matrix_variables_grid.cpp.
uint MatrixVariablesGrid::getNumRows | ( | uint | pointIdx | ) | const |
Returns number of rows of matrix at grid point with given index.
[in] | pointIdx | Index of grid point. |
Definition at line 1167 of file matrix_variables_grid.cpp.
uint MatrixVariablesGrid::getNumValues | ( | ) | const |
Returns number of values of matrix at first grid point.
Definition at line 1158 of file matrix_variables_grid.cpp.
uint MatrixVariablesGrid::getNumValues | ( | uint | pointIdx | ) | const |
Returns number of values of matrix at grid point with given index.
[in] | pointIdx | Index of grid point. |
Definition at line 1191 of file matrix_variables_grid.cpp.
MatrixVariablesGrid MatrixVariablesGrid::getRefinedGrid | ( | const Grid & | arg, |
InterpolationMode | mode = IM_CONSTANT |
||
) | const |
Returns a refined grid by adding all grid points of given grid that are not yet included. For doing so, the given grid has to be a superset of the current grid. Values at newly added grid points are obtained by the (optionally) specified interpolation mode.
[in] | arg | Grid to be used for refinement. |
[in] | mode | Interpolation mode, see documentation of InterpolationMode. |
Definition at line 571 of file matrix_variables_grid.cpp.
DVector MatrixVariablesGrid::getScaling | ( | uint | pointIdx | ) | const |
Returns scaling of MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
Definition at line 1295 of file matrix_variables_grid.cpp.
double MatrixVariablesGrid::getScaling | ( | uint | pointIdx, |
uint | valueIdx | ||
) | const |
Returns scaling of given component of MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
[in] | valueIdx | Index of component. |
Definition at line 1316 of file matrix_variables_grid.cpp.
Grid MatrixVariablesGrid::getTimePoints | ( | ) | const |
Returns (deep-copy of) time grid of MatrixVariablesGrid.
Definition at line 1616 of file matrix_variables_grid.cpp.
MatrixVariablesGrid MatrixVariablesGrid::getTimeSubGrid | ( | uint | startIdx, |
uint | endIdx | ||
) | const |
Returns the sub grid in time starting and ending at given indices.
[in] | startIdx | Index of first grid point to be included in sub grid. |
[in] | endIdx | Index of last grid point to be included in sub grid. |
Reimplemented in VariablesGrid.
Definition at line 499 of file matrix_variables_grid.cpp.
VariableType MatrixVariablesGrid::getType | ( | ) | const |
Returns variable type of MatrixVariable at first grid point.
Definition at line 1204 of file matrix_variables_grid.cpp.
VariableType MatrixVariablesGrid::getType | ( | uint | pointIdx | ) | const |
Returns variable type of MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
Definition at line 1223 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::getUnit | ( | uint | pointIdx, |
uint | idx, | ||
char *const | _unit | ||
) | const |
Returns current unit label of given component of MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
[in] | idx | Index of component. |
[out] | _unit | Unit label of given component at given grid point. |
Definition at line 1270 of file matrix_variables_grid.cpp.
double MatrixVariablesGrid::getUpperBound | ( | uint | pointIdx, |
uint | valueIdx | ||
) | const |
Returns upper bound of given component of MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
[in] | valueIdx | Index of component. |
Definition at line 1414 of file matrix_variables_grid.cpp.
DVector MatrixVariablesGrid::getUpperBounds | ( | uint | pointIdx | ) | const |
Returns upper bounds of MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
Definition at line 1393 of file matrix_variables_grid.cpp.
MatrixVariablesGrid MatrixVariablesGrid::getValuesSubGrid | ( | uint | startIdx, |
uint | endIdx | ||
) | const |
Returns the sub grid of values. It comprises all grid points of the object, but comprises at each grid point only the compenents starting and ending at given indices.
[in] | startIdx | Index of first compenent to be included in sub grid. |
[in] | endIdx | Index of last compenent to be included in sub grid. |
Reimplemented in VariablesGrid.
Definition at line 518 of file matrix_variables_grid.cpp.
Returns whether MatrixVariablesGrid comprises lower bounds (at at least one of its grid points).
Definition at line 1521 of file matrix_variables_grid.cpp.
BooleanType MatrixVariablesGrid::hasNames | ( | ) | const |
Returns whether MatrixVariablesGrid comprises (non-empty) name labels (at at least one of its grid points).
Definition at line 1485 of file matrix_variables_grid.cpp.
BooleanType MatrixVariablesGrid::hasScaling | ( | ) | const |
Returns whether scaling is set (at at least one grid point).
Definition at line 1509 of file matrix_variables_grid.cpp.
BooleanType MatrixVariablesGrid::hasUnits | ( | ) | const |
Returns whether MatrixVariablesGrid comprises (non-empty) unit labels (at at least one of its grid points).
Definition at line 1497 of file matrix_variables_grid.cpp.
Returns whether MatrixVariablesGrid comprises upper bounds (at at least one of its grid points).
Definition at line 1533 of file matrix_variables_grid.cpp.
Initializes an empty MatrixVariablesGrid.
Reimplemented in VariablesGrid.
Definition at line 175 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::init | ( | uint | _nRows, |
uint | _nCols, | ||
const Grid & | _grid, | ||
VariableType | _type = VT_UNKNOWN , |
||
const char **const | _names = 0 , |
||
const char **const | _units = 0 , |
||
const DVector *const | _scaling = 0 , |
||
const DVector *const | _lb = 0 , |
||
const DVector *const | _ub = 0 , |
||
const BooleanType *const | _autoInit = 0 |
||
) |
Initializes the MatrixVariablesGrid on a given grid with given dimensions of each MatrixVariable. Further information can optionally be specified.
[in] | _nRows | Number of rows of each matrix. |
[in] | _nCols | Number of columns of each matrix. |
[in] | _grid | Grid on which the MatrixVariable(s) are defined. |
[in] | _type | Type of the variable(s). |
[in] | _names | Array containing name labels for each component of the variable(s). |
[in] | _units | Array containing unit labels for each component of the variable(s). |
[in] | _scaling | Array containing the scaling for each component of the variable(s). |
[in] | _lb | Array containing lower bounds for each component of the variable(s). |
[in] | _ub | Array containing upper bounds for each component of the variable(s). |
[in] | _autoInit | Array defining if each component of the variable(s) is to be automatically initialized. |
Definition at line 184 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::init | ( | uint | _nRows, |
uint | _nCols, | ||
uint | _nPoints, | ||
VariableType | _type = VT_UNKNOWN , |
||
const char **const | _names = 0 , |
||
const char **const | _units = 0 , |
||
const DVector *const | _scaling = 0 , |
||
const DVector *const | _lb = 0 , |
||
const DVector *const | _ub = 0 , |
||
const BooleanType *const | _autoInit = 0 |
||
) |
Initializes the MatrixVariablesGrid taking the dimensions of each MatrixVariable as well as the number of grid points on which they are defined. Further information can optionally be specified.
[in] | _nRows | Number of rows of each matrix. |
[in] | _nCols | Number of columns of each matrix. |
[in] | _nPoints | Number of grid points on which the MatrixVariable(s) are defined. |
[in] | _type | Type of the variable(s). |
[in] | _names | Array containing name labels for each component of the variable(s). |
[in] | _units | Array containing unit labels for each component of the variable(s). |
[in] | _scaling | Array containing the scaling for each component of the variable(s). |
[in] | _lb | Array containing lower bounds for each component of the variable(s). |
[in] | _ub | Array containing upper bounds for each component of the variable(s). |
[in] | _autoInit | Array defining if each component of the variable(s) is to be automatically initialized. |
Definition at line 208 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::init | ( | uint | _nRows, |
uint | _nCols, | ||
double | _firstTime, | ||
double | _lastTime, | ||
uint | _nPoints, | ||
VariableType | _type = VT_UNKNOWN , |
||
const char **const | _names = 0 , |
||
const char **const | _units = 0 , |
||
const DVector *const | _scaling = 0 , |
||
const DVector *const | _lb = 0 , |
||
const DVector *const | _ub = 0 , |
||
const BooleanType *const | _autoInit = 0 |
||
) |
Initializes the MatrixVariablesGrid taking the dimensions of each MatrixVariable as well as the number of grid points on which they are defined. Moreover, it takes the time of the first and the last grid point; all intermediate grid points are setup to form a equidistant grid of time points. Further information can optionally be specified.
[in] | _nRows | Number of rows of each matrix. |
[in] | _nCols | Number of columns of each matrix. |
[in] | _firstTime | Time of first grid point. |
[in] | _lastTime | Time of last grid point. |
[in] | _nPoints | Number of grid points on which the MatrixVariable(s) are defined. |
[in] | _type | Type of the variable(s). |
[in] | _names | Array containing name labels for each component of the variable(s). |
[in] | _units | Array containing unit labels for each component of the variable(s). |
[in] | _scaling | Array containing the scaling for each component of the variable(s). |
[in] | _lb | Array containing lower bounds for each component of the variable(s). |
[in] | _ub | Array containing upper bounds for each component of the variable(s). |
[in] | _autoInit | Array defining if each component of the variable(s) is to be automatically initialized. |
Definition at line 232 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::init | ( | const DMatrix & | arg, |
const Grid & | _grid = trivialGrid , |
||
VariableType | _type = VT_UNKNOWN |
||
) |
Initializes the MatrixVariablesGrid on a given grid with given type. At each grid point, the MatrixVariable is constructed from the matrix passed.
[in] | arg | DMatrix to be assign at each point of the grid. |
[in] | _grid | Grid on which the MatrixVariable(s) are defined. |
[in] | _type | Type of the variable(s). |
Definition at line 258 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::initMatrixVariables | ( | uint | _nRows, |
uint | _nCols, | ||
VariableType | _type = VT_UNKNOWN , |
||
const char **const | _names = 0 , |
||
const char **const | _units = 0 , |
||
const DVector *const | _scaling = 0 , |
||
const DVector *const | _lb = 0 , |
||
const DVector *const | _ub = 0 , |
||
const BooleanType *const | _autoInit = 0 |
||
) | [protected] |
Initializes array of MatrixVariables with given information. Note that this function assumes that the grid has already been setup.
[in] | _nRows | Number of rows of each matrix. |
[in] | _nCols | Number of columns of each matrix. |
[in] | _type | Type of the variable(s). |
[in] | _names | Array containing names (labels) for each component of the variable(s). |
[in] | _units | Array containing units for each component of the variable(s). |
[in] | _scaling | Array containing the scaling for each component of the variable(s). |
[in] | _lb | Array containing lower bounds for each component of the variable(s). |
[in] | _ub | Array containing upper bounds for each component of the variable(s). |
[in] | _autoInit | Array defining if each component of the variable(s) is to be automatically initialized. |
Definition at line 912 of file matrix_variables_grid.cpp.
DVector MatrixVariablesGrid::linearInterpolation | ( | double | time | ) | const |
Returns a vector with interpolated values of the MatrixVariablesGrid at given time. If given time lies in between two grid points, the value of the vector will be determined by linear interpolation between these grid points. If given time is smaller than the smallest time of the grid, the value of the first grid point will be returned. Analoguosly, if given time is larger than the largest time of the grid, the vector at the last grid point will be returned.
[in] | time | Time for evaluation. |
Definition at line 669 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::merge | ( | const MatrixVariablesGrid & | arg, |
MergeMethod | _mergeMethod = MM_DUPLICATE , |
||
BooleanType | keepOverlap = BT_TRUE |
||
) |
Constructs the set union in time of current and given grid. A merge method defines the way duplicate entries are handled. Moreover, it can be specified whether an overlap in time of both grids shall be kept or if only the entries of one of them shall be kept according to the merge method.
[in] | arg | Grid to append. |
[in] | _mergeMethod | Merge method, see documentation of MergeMethod for details. |
[in] | keepOverlap | Flag indicating whether overlap shall be kept. |
Definition at line 404 of file matrix_variables_grid.cpp.
Returns the value of a certain component at a certain grid point.
[in] | pointIdx | Index of grid point. |
[in] | rowIdx | Row index of the component to be returned. |
[in] | colIdx | Column index of the component to be returned. |
Definition at line 1012 of file matrix_variables_grid.cpp.
Returns the value of a certain component at a certain grid point (const variant).
[in] | pointIdx | Index of grid point. |
[in] | rowIdx | Row index of the component to be returned. |
[in] | colIdx | Column index of the component to be returned. |
Definition at line 1021 of file matrix_variables_grid.cpp.
MatrixVariablesGrid MatrixVariablesGrid::operator() | ( | const uint | rowIdx | ) | const |
Returns a MatrixVariablesGrid consisting only of the given row.
[in] | rowIdx | Row index of the component to be returned. |
Reimplemented in VariablesGrid.
Definition at line 1031 of file matrix_variables_grid.cpp.
MatrixVariablesGrid MatrixVariablesGrid::operator+ | ( | const MatrixVariablesGrid & | arg | ) | const |
Adds (element-wise) two MatrixVariablesGrid into a temporary object.
[in] | arg | Second summand. |
Definition at line 1071 of file matrix_variables_grid.cpp.
MatrixVariablesGrid & MatrixVariablesGrid::operator+= | ( | const MatrixVariablesGrid & | arg | ) |
Adds (element-wise) a MatrixVariablesGrid to object.
[in] | arg | Second summand. |
Definition at line 1088 of file matrix_variables_grid.cpp.
MatrixVariablesGrid MatrixVariablesGrid::operator- | ( | const MatrixVariablesGrid & | arg | ) | const |
Subtracts (element-wise) a MatrixVariablesGrid from the object and stores result into a temporary object.
[in] | arg | Subtrahend. |
Definition at line 1101 of file matrix_variables_grid.cpp.
MatrixVariablesGrid & MatrixVariablesGrid::operator-= | ( | const MatrixVariablesGrid & | arg | ) |
Subtracts (element-wise) a MatrixVariablesGrid from the object.
[in] | arg | Subtrahend. |
Definition at line 1115 of file matrix_variables_grid.cpp.
MatrixVariablesGrid & MatrixVariablesGrid::operator= | ( | const MatrixVariablesGrid & | rhs | ) |
Assignment operator (deep copy).
[in] | rhs | Right-hand side object. |
Reimplemented in VariablesGrid.
Definition at line 136 of file matrix_variables_grid.cpp.
MatrixVariablesGrid & MatrixVariablesGrid::operator= | ( | const DMatrix & | rhs | ) |
Assignment operator which reads data from a matrix. The data is interpreted as follows: the first entry of each row is taken as time of the grid point to be added, all remaining entries of each row are taken as numerical values of a MatrixVariable with exactly one column. In effect, a MatrixVariablesGrid consisting of <number of columns - 1>-by-1 MatrixVariables defined on <number of="" rows>=""> grid points is setup.
[in] | rhs | DMatrix to be read. |
Reimplemented in VariablesGrid.
Definition at line 158 of file matrix_variables_grid.cpp.
MatrixVariablesGrid MatrixVariablesGrid::operator[] | ( | const uint | pointIdx | ) | const |
Returns a MatrixVariablesGrid consisting only of the values at given grid point.
[in] | pointIdx | Index of grid point. |
Reimplemented in VariablesGrid.
Definition at line 1053 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::print | ( | std::ostream & | stream = std::cout , |
const char *const | name = DEFAULT_LABEL , |
||
const char *const | startString = DEFAULT_START_STRING , |
||
const char *const | endString = DEFAULT_END_STRING , |
||
uint | width = DEFAULT_WIDTH , |
||
uint | precision = DEFAULT_PRECISION , |
||
const char *const | colSeparator = DEFAULT_COL_SEPARATOR , |
||
const char *const | rowSeparator = DEFAULT_ROW_SEPARATOR |
||
) | const |
Prints object to standard ouput stream. Various settings can be specified defining its output format.
[in] | stream | Output stream for printing. |
[in] | name | Name label to be printed before the numerical values. |
[in] | startString | Prefix before printing the numerical values. |
[in] | endString | Suffix after printing the numerical values. |
[in] | width | Total number of digits per single numerical value. |
[in] | precision | Number of decimals per single numerical value. |
[in] | colSeparator | Separator between the columns of the numerical values. |
[in] | rowSeparator | Separator between the rows of the numerical values. |
Definition at line 695 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::print | ( | const char *const | filename, |
const char *const | name = DEFAULT_LABEL , |
||
const char *const | startString = DEFAULT_START_STRING , |
||
const char *const | endString = DEFAULT_END_STRING , |
||
uint | width = DEFAULT_WIDTH , |
||
uint | precision = DEFAULT_PRECISION , |
||
const char *const | colSeparator = DEFAULT_COL_SEPARATOR , |
||
const char *const | rowSeparator = DEFAULT_ROW_SEPARATOR |
||
) | const |
Prints object to file with given name. Various settings can be specified defining its output format.
[in] | filename | Filename for printing. |
[in] | name | Name label to be printed before the numerical values. |
[in] | startString | Prefix before printing the numerical values. |
[in] | endString | Suffix after printing the numerical values. |
[in] | width | Total number of digits per single numerical value. |
[in] | precision | Number of decimals per single numerical value. |
[in] | colSeparator | Separator between the columns of the numerical values. |
[in] | rowSeparator | Separator between the rows of the numerical values. |
Definition at line 736 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::print | ( | const char *const | filename, |
const char *const | name, | ||
PrintScheme | printScheme | ||
) | const |
Prints object to file with given name. Various settings can be specified defining its output format.
[in] | filename | Filename for printing. |
[in] | name | Name label to be printed before the numerical values. |
[in] | printScheme | Print scheme defining the output format of the information. |
Definition at line 760 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::print | ( | std::ostream & | stream, |
const char *const | name, | ||
PrintScheme | printScheme | ||
) | const |
Prints object to given file. Various settings can be specified defining its output format.
[in] | stream | Output stream for printing. |
[in] | name | Name label to be printed before the numerical values. |
[in] | printScheme | Print scheme defining the output format of the information. |
Definition at line 778 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::read | ( | std::istream & | stream | ) |
A fuction that reads data from a file. The data is expected to be in matrix format and is interpreted as follows: the first entry of each row is taken as time of the grid point to be added, all remaining entries of each row are taken as numerical values of a MatrixVariable with exactly one column. In effect, a MatrixVariablesGrid consisting of <number of columns - 1>-by-1 MatrixVariables defined on <number of="" rows>=""> grid points is setup. Note that all rows are expected to have equal number of columns.
[in] | stream | An input stream to be read. |
Definition at line 831 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::read | ( | const char *const | filename | ) |
A function that reads data from a file with given name. The data is expected to be in matrix format and is interpreted as follows: the first entry of each row is taken as time of the grid point to be added, all remaining entries of each row are taken as numerical values of a MatrixVariable with exactly one column. In effect, a MatrixVariablesGrid consisting of <number of columns - 1>-by-1 MatrixVariables defined on <number of="" rows>=""> grid points is setup. Note that all rows are expected to have equal number of columns.
[in] | filename | Name of file to be read. |
Definition at line 859 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::refineGrid | ( | const Grid & | arg, |
InterpolationMode | mode = IM_CONSTANT |
||
) |
Refines the grid by adding all grid points of given grid that are not not yet included. For doing so, the given grid has to be a superset of the current grid. Values at newly added grid points are obtained by the (optionally) specified interpolation mode.
[in] | arg | Grid to be used for refinement. |
[in] | mode | Interpolation mode, see documentation of InterpolationMode. |
Definition at line 538 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::setAll | ( | double | _value | ) |
Assigns given value to all components of all matrices at all grid points.
[in] | _value | New value. |
Definition at line 1598 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::setAllMatrices | ( | const DMatrix & | _values | ) |
Assigns new matrix to all grid points.
[in] | _value | New matrix. |
Definition at line 303 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::setAutoInit | ( | uint | pointIdx, |
BooleanType | _autoInit | ||
) |
Assigns new auto initialization flag to MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
[in] | _autoInit | New auto initialization flag. |
Definition at line 1455 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::setLowerBound | ( | uint | pointIdx, |
uint | valueIdx, | ||
double | _lb | ||
) |
Assigns new lower bound to given component of MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
[in] | valueIdx | Index of component. |
[in] | _lb | New lower bound. |
Definition at line 1376 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::setLowerBounds | ( | uint | pointIdx, |
const DVector & | _lb | ||
) |
Assigns new lower bounds to MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
[in] | _lb | New lower bounds. |
Definition at line 1354 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::setMatrix | ( | uint | pointIdx, |
const DMatrix & | _value | ||
) | const |
Assigns new matrix to grid point with given index.
[in] | pointIdx | Index of grid point. |
[in] | _value | New matrix. |
Definition at line 288 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::setName | ( | uint | pointIdx, |
uint | idx, | ||
const char *const | _name | ||
) |
Assigns new name label to given component of MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
[in] | idx | Index of component. |
[in] | _name | New name label of given component at given grid point. |
Definition at line 1257 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::setScaling | ( | uint | pointIdx, |
const DVector & | _scaling | ||
) |
Assigns new scaling to MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
[in] | _scaling | New scaling. |
Definition at line 1305 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::setScaling | ( | uint | pointIdx, |
uint | valueIdx, | ||
double | _scaling | ||
) |
Assigns new scaling to given component of MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
[in] | valueIdx | Index of component. |
[in] | _scaling | New scaling. |
Definition at line 1327 of file matrix_variables_grid.cpp.
Assigns new variable type at all grid points.
[in] | _type | Type of the variable(s). |
Definition at line 1213 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::setType | ( | uint | pointIdx, |
VariableType | _type | ||
) |
Assigns new variable type to MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
[in] | _type | New type of the variable(s). |
Definition at line 1233 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::setUnit | ( | uint | pointIdx, |
uint | idx, | ||
const char *const | _unit | ||
) |
Assigns new name label to given component of MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
[in] | idx | Index of component. |
[in] | _unit | New unit label of given component at given grid point. |
Definition at line 1282 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::setUpperBound | ( | uint | pointIdx, |
uint | valueIdx, | ||
double | _ub | ||
) |
Assigns new upper bound to given component of MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
[in] | valueIdx | Index of component. |
[in] | _ub | New upper bound. |
Definition at line 1425 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::setUpperBounds | ( | uint | pointIdx, |
const DVector & | _ub | ||
) |
Assigns new upper bounds to MatrixVariable at grid point with given index.
[in] | pointIdx | Index of grid point. |
[in] | _ub | New upper bounds. |
Definition at line 1403 of file matrix_variables_grid.cpp.
Assigns zero to all components of all matrices at all grid points.
Definition at line 1589 of file matrix_variables_grid.cpp.
MatrixVariablesGrid & MatrixVariablesGrid::shiftBackwards | ( | DMatrix | lastValue = emptyMatrix | ) |
Shifts all grid points backwards by one grid point, deleting the first one and doubling the value at last grid point.
Definition at line 650 of file matrix_variables_grid.cpp.
MatrixVariablesGrid & MatrixVariablesGrid::shiftTimes | ( | double | timeShift | ) |
Shifts times at all grid points by a given offset.
[in] | timeShift | Time offset for shifting. |
Reimplemented from Grid.
Reimplemented in VariablesGrid.
Definition at line 642 of file matrix_variables_grid.cpp.
returnValue MatrixVariablesGrid::sprint | ( | std::ostream & | stream | ) |
A printing function needed for plotting.
Definition at line 965 of file matrix_variables_grid.cpp.
std::ostream& operator<< | ( | std::ostream & | stream, |
const MatrixVariablesGrid & | arg | ||
) | [friend] |
Output streaming operator.
Definition at line 874 of file matrix_variables_grid.cpp.
std::istream& operator>> | ( | std::istream & | stream, |
MatrixVariablesGrid & | arg | ||
) | [friend] |
Read a MatrixVariablesGrid from an input stream.
Definition at line 882 of file matrix_variables_grid.cpp.
MatrixVariable** MatrixVariablesGrid::values [protected] |
DMatrix-valued optimization variable at all grid points.
Definition at line 1234 of file matrix_variables_grid.hpp.