Base class for all variables within the symbolic expressions family. More...
#include <expression.hpp>
Protected Member Functions | |
Expression | add (const Expression &arg) const |
Expression & | assignmentSetup (const Expression &arg) |
void | construct (VariableType variableType_, uint globalTypeID_, uint nRows_, uint nCols_, const std::string &name_) |
void | copy (const Expression &rhs) |
void | deleteAll () |
Expression | div (const Expression &arg) const |
Expression | mul (const Expression &arg) const |
Operator * | product (const Operator *a, const Operator *b) const |
Expression | sub (const Expression &arg) const |
Protected Attributes | |
uint | component |
uint | dim |
Operator ** | element |
std::string | name |
uint | nCols |
uint | nRows |
VariableType | variableType |
Friends | |
class | CFunction |
class | COperator |
class | FunctionEvaluationTree |
Expression | operator* (const Expression &arg1, const Expression &arg2) |
Expression | operator+ (const Expression &arg1, const Expression &arg2) |
Expression | operator- (const Expression &arg1, const Expression &arg2) |
Expression | operator/ (const Expression &arg1, const Expression &arg2) |
std::ostream & | operator<< (std::ostream &stream, const Expression &arg) |
Base class for all variables within the symbolic expressions family.
The class Expression serves as a base class for all symbolic variables within the symbolic expressions family. Moreover, the Expression class defines all kind of matrix and vector operations on a symbolic level.
Definition at line 56 of file expression.hpp.
BEGIN_NAMESPACE_ACADO Expression::Expression | ( | ) |
Default constructor.
Definition at line 47 of file expression.cpp.
Expression::Expression | ( | const Operator & | tree_ | ) |
Casting constructor.
Definition at line 72 of file expression.cpp.
|
explicit |
Casting constructor.
Definition at line 57 of file expression.cpp.
|
explicit |
Constructor which takes the arguments.
name_ | the name |
nRows_ | number of rows |
nCols_ | number of columns |
variableType_ | the variable type |
globalTypeID | the global type ID |
Definition at line 52 of file expression.cpp.
|
explicit |
Constructor which takes the arguments.
nRows_ | number of rows |
nCols_ | number of columns |
variableType_ | the variable type |
globalTypeID | the global type ID |
Definition at line 67 of file expression.cpp.
|
explicit |
Constructor which takes the arguments.
nRows_ | number of rows |
nCols_ | number of columns |
variableType_ | the variable type |
globalTypeID | the global type ID |
Definition at line 62 of file expression.cpp.
Expression::Expression | ( | const double & | rhs | ) |
Copy constructor (deep copy).
Definition at line 90 of file expression.cpp.
Expression::Expression | ( | const DVector & | rhs | ) |
Definition at line 97 of file expression.cpp.
Expression::Expression | ( | const DMatrix & | rhs | ) |
Definition at line 107 of file expression.cpp.
Expression::Expression | ( | const Expression & | rhs | ) |
Definition at line 121 of file expression.cpp.
|
virtual |
Destructor.
Definition at line 126 of file expression.cpp.
Expression Expression::ADbackward | ( | const Expression & | arg | ) | const |
Definition at line 1032 of file expression.cpp.
Expression Expression::ADbackward | ( | const Expression & | arg, |
const Expression & | seed | ||
) | const |
Definition at line 1206 of file expression.cpp.
|
protected |
Definition at line 319 of file expression.cpp.
Expression Expression::ADforward | ( | const Expression & | arg | ) | const |
Definition at line 971 of file expression.cpp.
Expression Expression::ADforward | ( | const VariableType & | varType_, |
const int * | arg, | ||
int | nV | ||
) | const |
Definition at line 1002 of file expression.cpp.
Expression Expression::ADforward | ( | const Expression & | arg, |
const Expression & | seed | ||
) | const |
Definition at line 1063 of file expression.cpp.
Expression Expression::ADforward | ( | const VariableType & | varType_, |
const int * | arg, | ||
const Expression & | seed | ||
) | const |
Definition at line 1086 of file expression.cpp.
Expression Expression::ADforward | ( | const VariableType * | varType_, |
const int * | arg, | ||
const Expression & | seed | ||
) | const |
Definition at line 1098 of file expression.cpp.
Expression Expression::ADsymmetric | ( | const Expression & | arg, |
const Expression & | S, | ||
const Expression & | l, | ||
Expression * | dfS = 0 , |
||
Expression * | ldf = 0 |
||
) | const |
Second order symmetric AD routine returning
S^T*(l^T*f'')*S with f'' being the second
order derivative of the current expression.
The matrix S and the vector l can be
interpreted as forward/backward seeds,
respectively. Optionally, this routine also
returns expressions for the first order
order terms f'*S and l^T*f' computed by
first order forward and first order backward
automatic differentiation, respectively.
Caution: this routine is tailored for
full Hessian computation exploiting symmetry.
If only single elements of the Hessian are
needed, forward-over-adjoint or ajoint-over-
forward differentiation may be more
efficient.
S | argument |
l | forward seed |
dfS | backward seed |
ldf | first order forward result first order backward result |
Definition at line 1260 of file expression.cpp.
Expression Expression::ADsymmetric | ( | const Expression & | arg, |
const Expression & | l, | ||
Expression * | dfS = 0 , |
||
Expression * | ldf = 0 |
||
) | const |
Second order symmetric AD routine returning
l^T*f'' with f'' being the second
order derivative of the current expression.
The he vector l can be
interpreted as backward seed,
respectively. Optionally, this routine also
returns expressions for the first order
order terms f'*S and l^T*f' computed by
first order forward and first order backward
automatic differentiation, respectively.
Caution: this routine is tailored for
full Hessian computation exploiting symmetry.
If only single elements of the Hessian are
needed, forward-over-adjoint or ajoint-over-
forward differentiation may be more
efficient.
l | argument |
dfS | backward seed |
ldf | first order forward result first order backward result |
Definition at line 1303 of file expression.cpp.
Expression & Expression::appendCols | ( | const Expression & | arg | ) |
Appends an Expression matrix (n x m) with an argument matrix (n x s) in the column direction, such that the result is ( n x (m + s) ).
As a special case, when applied on an empty Expression, the Expression will be assigned the argument.
Definition at line 162 of file expression.cpp.
Expression & Expression::appendRows | ( | const Expression & | arg | ) |
Appends an Expression matrix (n x m) with an argument matrix (s x m) in the row direction, such that the result is ( (n + s) x m).
As a special case, when applied on an empty Expression, the Expression will be assigned the argument.
Definition at line 141 of file expression.cpp.
|
protected |
Generic copy routine (protected, only for internal use).
Definition at line 1518 of file expression.cpp.
|
inlinevirtual |
Function for cloning.
Reimplemented in ExpressionType< Derived, Type, AllowCounter >, ExpressionType< Output, VT_OUTPUT >, ExpressionType< IntermediateState, VT_INTERMEDIATE_STATE >, ExpressionType< IntegerParameter, VT_INTEGER_PARAMETER >, ExpressionType< Parameter, VT_PARAMETER >, ExpressionType< DifferentialStateDerivative, VT_DDIFFERENTIAL_STATE >, ExpressionType< AlgebraicState, VT_ALGEBRAIC_STATE >, ExpressionType< OnlineData, VT_ONLINE_DATA >, ExpressionType< DifferentialState, VT_DIFFERENTIAL_STATE >, ExpressionType< TIME, VT_TIME, false >, ExpressionType< Control, VT_CONTROL >, ExpressionType< Disturbance, VT_DISTURBANCE >, and ExpressionType< IntegerControl, VT_INTEGER_CONTROL >.
Definition at line 105 of file expression.hpp.
|
protected |
Generic constructor (protected, only for internal use).
variableType_ | The variable type. |
globalTypeID_ | the global type ID |
nRows_ | The number of rows. |
nCols_ | The number of columns. |
name_ | The name |
Definition at line 1471 of file expression.cpp.
|
protected |
Generic copy routine (protected, only for internal use).
Definition at line 1496 of file expression.cpp.
|
protected |
Generic destructor (protected, only for internal use).
Definition at line 1555 of file expression.cpp.
|
protected |
Definition at line 474 of file expression.cpp.
Expression Expression::getAcos | ( | ) | const |
Definition at line 721 of file expression.cpp.
Expression Expression::getAsin | ( | ) | const |
Definition at line 709 of file expression.cpp.
Expression Expression::getAtan | ( | ) | const |
Definition at line 733 of file expression.cpp.
Expression Expression::getCol | ( | const uint & | colIdx | ) | const |
Definition at line 567 of file expression.cpp.
Expression Expression::getCols | ( | const uint & | colIdx1, |
const uint & | colIdx2 | ||
) | const |
Definition at line 582 of file expression.cpp.
|
inline |
Returns the global type idea of the idx-component.
Expression Expression::getCos | ( | ) | const |
Definition at line 685 of file expression.cpp.
DMatrix Expression::getDependencyPattern | ( | const Expression & | arg | ) | const |
When operated on an n x 1 Expression, returns an m x n DMatrix. The element (i,j) of this matrix is zero when this(i) does not depend on arg(j)
arg | m x 1 Expression |
Definition at line 623 of file expression.cpp.
|
inline |
Returns dimension of vector space.
Expression Expression::getDot | ( | ) | const |
Definition at line 952 of file expression.cpp.
Expression Expression::getEntropy | ( | ) | const |
Definition at line 945 of file expression.cpp.
Expression Expression::getEuclideanNorm | ( | ) | const |
Definition at line 912 of file expression.cpp.
Expression Expression::getExp | ( | ) | const |
Definition at line 745 of file expression.cpp.
Expression Expression::getInverse | ( | ) | const |
Returns the symbolic inverse of a matrix (only for square matrices)
Definition at line 490 of file expression.cpp.
Expression Expression::getLn | ( | ) | const |
Definition at line 769 of file expression.cpp.
Expression Expression::getLogSumExp | ( | ) | const |
Definition at line 860 of file expression.cpp.
Expression Expression::getNext | ( | ) | const |
Definition at line 965 of file expression.cpp.
|
inline |
Returns the number of columns.
|
inline |
Returns the number of rows.
Expression Expression::getODEexpansion | ( | const int & | order, |
const int * | arg | ||
) | const |
Definition at line 1149 of file expression.cpp.
Returns a clone of the operator with index idx.
Definition at line 1590 of file expression.cpp.
Expression Expression::getPow | ( | const Expression & | arg | ) | const |
Definition at line 782 of file expression.cpp.
Expression Expression::getPowInt | ( | const int & | arg | ) | const |
Definition at line 797 of file expression.cpp.
Expression Expression::getRow | ( | const uint & | rowIdx | ) | const |
Definition at line 533 of file expression.cpp.
Expression Expression::getRows | ( | const uint & | rowIdx1, |
const uint & | rowIdx2 | ||
) | const |
Definition at line 548 of file expression.cpp.
Expression Expression::getSin | ( | ) | const |
Definition at line 673 of file expression.cpp.
DMatrix Expression::getSparsityPattern | ( | ) | const |
Definition at line 656 of file expression.cpp.
Expression Expression::getSqrt | ( | ) | const |
Definition at line 757 of file expression.cpp.
Expression Expression::getSubMatrix | ( | const uint & | rowIdx1, |
const uint & | rowIdx2, | ||
const uint & | colIdx1, | ||
const uint & | colIdx2 | ||
) | const |
Definition at line 601 of file expression.cpp.
Expression Expression::getSumSquare | ( | ) | const |
Definition at line 828 of file expression.cpp.
Expression Expression::getTan | ( | ) | const |
Definition at line 697 of file expression.cpp.
|
inline |
Returns the variable type
BooleanType Expression::isDependingOn | ( | VariableType | type | ) | const |
Definition at line 1569 of file expression.cpp.
BooleanType Expression::isDependingOn | ( | const Expression & | e | ) | const |
Definition at line 1582 of file expression.cpp.
|
inline |
Returns the number of columns.
|
protected |
Definition at line 412 of file expression.cpp.
Expression Expression::operator() | ( | uint | idx | ) | const |
Definition at line 218 of file expression.cpp.
Expression Expression::operator() | ( | uint | rowIdx, |
uint | colIdx | ||
) | const |
Definition at line 233 of file expression.cpp.
Definition at line 250 of file expression.cpp.
Definition at line 273 of file expression.cpp.
Expression & Expression::operator*= | ( | const Expression & | arg | ) |
Definition at line 313 of file expression.cpp.
Expression & Expression::operator+= | ( | const Expression & | arg | ) |
Definition at line 307 of file expression.cpp.
Expression Expression::operator- | ( | ) | const |
Definition at line 1448 of file expression.cpp.
Expression & Expression::operator-= | ( | const Expression & | arg | ) |
Definition at line 310 of file expression.cpp.
Expression & Expression::operator/= | ( | const Expression & | arg | ) |
Definition at line 316 of file expression.cpp.
Expression & Expression::operator<< | ( | const Expression & | arg | ) |
An operator for adding elements.
Definition at line 175 of file expression.cpp.
Expression & Expression::operator= | ( | const Expression & | arg | ) |
Assignment Operator.
Definition at line 131 of file expression.cpp.
std::ostream & Expression::print | ( | std::ostream & | stream | ) | const |
Definition at line 198 of file expression.cpp.
Internal product routine (protected, only for internal use).
Definition at line 382 of file expression.cpp.
|
protected |
Definition at line 350 of file expression.cpp.
returnValue Expression::substitute | ( | int | idx, |
const Expression & | arg | ||
) | const |
Substitutes a given variable with an expression.
Definition at line 1436 of file expression.cpp.
Expression Expression::transpose | ( | ) | const |
Returns the transpose of this expression.
Definition at line 811 of file expression.cpp.
|
friend |
Definition at line 59 of file expression.hpp.
|
friend |
Definition at line 58 of file expression.hpp.
|
friend |
Definition at line 60 of file expression.hpp.
|
friend |
Definition at line 302 of file expression.cpp.
|
friend |
Definition at line 298 of file expression.cpp.
|
friend |
Definition at line 300 of file expression.cpp.
|
friend |
Definition at line 304 of file expression.cpp.
|
friend |
Definition at line 213 of file expression.cpp.
|
protected |
The expression component
Definition at line 315 of file expression.hpp.
|
protected |
DVector space dimension.
Definition at line 312 of file expression.hpp.
|
protected |
Element of vector space.
Definition at line 311 of file expression.hpp.
|
protected |
The name of the expression
Definition at line 316 of file expression.hpp.
|
protected |
DMatrix dimension.
Definition at line 313 of file expression.hpp.
|
protected |
Definition at line 313 of file expression.hpp.
|
protected |
Variable type.
Definition at line 314 of file expression.hpp.