chrono::ChStateDelta Class Reference

Description

Class for incremental form of state of time-integrable objects.

Note that for many cases, this would be superfluous, because one could do y_new = y_old + dydt*td, where dydt is a ChState just like y and y_new, but there are cases where such simple "+" operations between vectors is not practical, for instance when integrating rotations in 3D space, where it is better to work with quaternions in y and y_new, but with spinors/angular velocities/etc. in dydt; so dim(y) is not dim(dydt); hence the need of this specific class for increments in states. This is a vector (one-column matrix), hence inherited from ChMatrixDynamic. It is used in ChIntegrable, ChTimestepper, etc.

#include <ChState.h>

Inheritance diagram for chrono::ChStateDelta:
Collaboration diagram for chrono::ChStateDelta:

Public Member Functions

 ChStateDelta (ChIntegrable *mint=0)
 Constructors.
 
 ChStateDelta (const int nrows, ChIntegrable *mint)
 
 ChStateDelta (const ChMatrixDynamic< double > matr, ChIntegrable *mint)
 
 ChStateDelta (const ChStateDelta &msource)
 Copy constructor.
 
template<class Real >
ChStateDelta operator*= (const Real factor)
 Multiplies this matrix by a factor, in place.
 
template<class RealB >
ChStateDelta operator+= (const ChMatrix< RealB > &matbis)
 Increments this matrix by another matrix, in place.
 
template<class RealB >
ChStateDelta operator-= (const ChMatrix< RealB > &matbis)
 Decrements this matrix by another matrix, in place.
 
ChStateDelta operator- () const
 Negates sign of the matrix. More...
 
template<class RealB >
ChStateDelta operator+ (const ChMatrix< RealB > &matbis) const
 Sums this matrix and another matrix. More...
 
template<class RealB >
ChStateDelta operator- (const ChMatrix< RealB > &matbis) const
 Subtracts this matrix and another matrix. More...
 
template<class Real >
ChStateDelta operator* (const Real factor) const
 Multiplies this matrix by a scalar value. More...
 
void Reset (int nrows, ChIntegrable *mint)
 Reset to zeroes and (if needed) changes the size.
 
ChIntegrableGetIntegrable () const
 
- Public Member Functions inherited from chrono::ChVectorDynamic< double >
 ChVectorDynamic ()
 [simply use the "Real* address" pointer of the base class More...
 
 ChVectorDynamic (const int rows)
 The constructor for a generic n sized vector. More...
 
 ChVectorDynamic (const ChVectorDynamic< double > &msource)
 Copy constructor.
 
 ChVectorDynamic (const ChMatrix< RealB > &msource)
 Copy constructor from all types of base matrices Note! Assumes that the source matrix has one column only! There is no run-time check for the one-column sizing. More...
 
virtual ~ChVectorDynamic ()
 Destructor Delete allocated heap mem. More...
 
int GetLength () const
 Return the length of the vector.
 
ChVectorDynamic< double > & operator= (const ChMatrix< double > &matbis)
 Assignment operator (from generic other matrix, it always work)
 
ChVectorDynamic< double > operator- () const
 Negates sign of the matrix. More...
 
ChVectorDynamic< double > operator- (const ChMatrix< RealB > &matbis) const
 Subtracts this vector and another vector. More...
 
ChVectorDynamic< double > operator+ (const ChMatrix< RealB > &matbis) const
 Sums this vector and another vector. More...
 
ChVectorDynamic< double > operator* (const doublefactor) const
 Multiplies this vector by a scalar value. More...
 
virtual void Resize (int nrows)
 Reallocate memory for a new size.
 
virtual void Resize (int nrows, int ncols)
 Reallocate memory for a new size. VIRTUAL! Must be implemented by child classes!
 
void Reset (int nrows)
 Reset to zeroes and (if needed) changes the size to have row and col.
 
void Reset ()
 Resets the matrix to zero (warning: simply sets memory to 0 bytes!)
 
double NormWRMS (const ChVectorDynamic< double > &w)
 Calculate the WRMS (weighted root-mean-square) norm of this vector. More...
 
- Public Member Functions inherited from chrono::ChMatrix< double >
double & operator() (const int row, const int col)
 Parenthesis () operator, to access a single element of the matrix, by supplying the row and the column (indexes start from 0). More...
 
const double & operator() (const int row, const int col) const
 
double & operator() (const int el)
 Parenthesis () operator, to access a single element of the matrix, by supplying the ordinal of the element (indexes start from 0). More...
 
const double & operator() (const int el) const
 
double * operator[] (const int row)
 The [] operator returns the address of the n-th row. More...
 
const double * operator[] (const int row) const
 
ChMatrix< double > & operator*= (const doublefactor)
 Multiplies this matrix by a factor, in place.
 
ChMatrix< double > & operator+= (const ChMatrix< RealB > &matbis)
 Increments this matrix by another matrix, in place.
 
ChMatrix< double > & operator-= (const ChMatrix< RealB > &matbis)
 Decrements this matrix by another matrix, in place.
 
bool operator== (const ChMatrix< double > &other)
 Matrices are equal?
 
bool operator!= (const ChMatrix< double > &other)
 Matrices are not equal?
 
ChMatrix< double > & operator= (const ChMatrix< double > &matbis)
 Assignment operator.
 
ChMatrix< double > & operator= (const ChMatrix< RealB > &matbis)
 
void SetElement (int row, int col, doubleelem)
 Sets the element at row,col position. Indexes start with zero.
 
double GetElement (int row, int col)
 Gets the element at row,col position. More...
 
double GetElement (int row, int col) const
 
void SetElementN (int index, doubleelem)
 Sets the Nth element, counting row after row.
 
double GetElementN (int index)
 Gets the Nth element, counting row after row.
 
const double GetElementN (int index) const
 
double & Element (int row, int col)
 Access a single element of the matrix, by supplying the row and the column (indexes start from 0). More...
 
const double & Element (int row, int col) const
 
double & ElementN (int index)
 Access a single element of the matrix, the Nth element, counting row after row. More...
 
const double & ElementN (int index) const
 
double * GetAddress ()
 Access directly the "Real* address" buffer. More...
 
const double * GetAddress () const
 
int GetRows () const
 Gets the number of rows.
 
int GetColumns () const
 Gets the number of columns.
 
void SwapColumns (int a, int b)
 Swaps the columns a and b.
 
void SwapRows (int a, int b)
 Swap the rows a and b.
 
void FillDiag (doublesample)
 Fill the diagonal elements, given a sample. More...
 
void FillElem (doublesample)
 Fill the matrix with the same value in all elements.
 
void FillRandom (doublemax, doublemin)
 Fill the matrix with random float numbers, falling within the "max"/"min" range. More...
 
void Reset ()
 Resets the matrix to zero (warning: simply sets memory to 0 bytes!)
 
void Reset (int nrows, int ncols)
 Reset to zeroes and (if needed) changes the size to have row and col.
 
void SetIdentity ()
 Reset to identity matrix (ones on diagonal, zero elsewhere)
 
void CopyFromMatrix (const ChMatrix< RealB > &matra)
 Copy a matrix "matra" into this matrix. More...
 
void CopyFromMatrixT (const ChMatrix< RealB > &matra)
 Copy the transpose of matrix "matra" into this matrix. More...
 
void CopyTUpMatrix (const ChMatrix< RealB > &matra)
 Copy the transposed upper triangular part of "matra" in the lower triangular part of this matrix. More...
 
void CopyTLwMatrix (const ChMatrix< RealB > &matra)
 Copy the transposed lower triangulat part of "matra" in the upper triangular part of this matrix. More...
 
virtual void ArchiveOUT (ChArchiveOut &marchive)
 Method to allow serialization of transient data in archives.
 
virtual void ArchiveIN (ChArchiveIn &marchive)
 Method to allow de serialization of transient data from archives.
 
void StreamOUT (ChStreamOutAscii &mstream)
 Method to allow serializing transient data into in ascii as a readable item, for example "chrono::GetLog() << myobject;" ***OBSOLETE***.
 
void StreamOUTdenseMatlabFormat (ChStreamOutAscii &mstream)
 Method to allow serializing transient data into an ascii stream (ex. More...
 
void MatrNeg ()
 Changes the sign of all the elements of this matrix, in place.
 
void MatrAdd (const ChMatrix< RealB > &matra, const ChMatrix< RealC > &matrb)
 Sum two matrices, and stores the result in "this" matrix: [this]=[A]+[B].
 
void MatrSub (const ChMatrix< RealB > &matra, const ChMatrix< RealC > &matrb)
 Subtract two matrices, and stores the result in "this" matrix: [this]=[A]-[B].
 
void MatrInc (const ChMatrix< RealB > &matra)
 Increments this matrix with another matrix A, as: [this]+=[A].
 
void MatrDec (const ChMatrix< RealB > &matra)
 Decrements this matrix with another matrix A, as: [this]-=[A].
 
void MatrScale (doublefactor)
 Scales a matrix, multiplying all elements by a constant value: [this]*=f.
 
void MatrScale (const ChMatrix< RealB > &matra)
 Scales a matrix, multiplying all element by all oter elements of matra (it is not the classical matrix multiplication!)
 
void MatrDivScale (doublefactor)
 Scales a matrix, dividing all elements by a constant value: [this]/=f.
 
void MatrDivScale (const ChMatrix< RealB > &matra)
 Scales a matrix, dividing all element by all oter elements of matra (it is not the classical matrix multiplication!)
 
void MatrMultiply (const ChMatrix< RealB > &matra, const ChMatrix< RealC > &matrb)
 Multiplies two matrices, and stores the result in "this" matrix: [this]=[A]*[B].
 
void MatrMultiplyT (const ChMatrix< RealB > &matra, const ChMatrix< RealC > &matrb)
 Multiplies two matrices (the second is considered transposed): [this]=[A]*[B]' Faster than doing B.MatrTranspose(); result.MatrMultiply(A,B); Note: no check on mistaken size of this!
 
void MatrTMultiply (const ChMatrix< RealB > &matra, const ChMatrix< RealC > &matrb)
 Multiplies two matrices (the first is considered transposed): [this]=[A]'*[B] Faster than doing A.MatrTranspose(); result.MatrMultiply(A,B);.
 
void MatrTranspose ()
 Transpose this matrix in place.
 
double Det ()
 Returns the determinant of the matrix. More...
 
void MatrInverse ()
 Returns the inverse of the matrix. More...
 
bool Equals (const ChMatrix< double > &other)
 Returns true if vector is identical to other matrix.
 
bool Equals (const ChMatrix< double > &other, doubletol)
 Returns true if vector equals another vector, within a tolerance 'tol'.
 
ChVector< double > Matr34_x_Quat (const ChQuaternion< RealB > &qua)
 Multiplies this 3x4 matrix by a quaternion, as v=[G]*q The matrix must be 3x4. More...
 
ChQuaternion< double > Matr34T_x_Vect (const ChVector< RealB > &va)
 Multiplies this 3x4 matrix (transposed) by a vector, as q=[G]'*v The matrix must be 3x4. More...
 
ChQuaternion< double > Matr44_x_Quat (const ChQuaternion< RealB > &qua)
 Multiplies this 4x4 matrix (transposed) by a quaternion, The matrix must be 4x4. More...
 
void MatrXq_SemiTranspose ()
 Transposes only the lower-right 3x3 submatrix of a hemisymmetric 4x4 matrix, used when the 4x4 matrix is a "star" matrix [q] coming from a quaternion q: the non commutative quat. More...
 
void MatrXq_SemiNeg ()
 Change the sign of the 2nd, 3rd and 4th columns of a 4x4 matrix, The product between a quaternion q1 and the conjugate of q2 (q2'), is: q1 x q2' = [q1]*q2' = [q1sn]*q2 where [q1sn] is the semi-negation of the 4x4 matrix [q1]. More...
 
double NormInf ()
 Gets the norm infinite of the matrix, i.e. More...
 
double NormTwo ()
 Gets the norm two of the matrix, i.e. More...
 
double Max ()
 Finds max value among the values of the matrix.
 
double Min ()
 Finds min value among the values of the matrix.
 
void LinInterpolate (const ChMatrix< double > &matra, const ChMatrix< double > &matrb, doublemx)
 Linear interpolation of two matrices. More...
 
void RowColInterp (doublevmin, doublevmax, doubleumin, doubleumax)
 Fills a matrix or a vector with a bilinear interpolation, from corner values (as a u-v patch). More...
 
void PasteMatrix (const ChMatrix< RealB > &matra, int insrow, int inscol)
 Paste a matrix "matra" into "this", inserting at location insrow-inscol. More...
 
void PasteSumMatrix (const ChMatrix< RealB > &matra, int insrow, int inscol)
 Paste a matrix "matra" into "this", inserting at location insrow-inscol and performing a sum with the preexisting values. More...
 
void PasteTranspMatrix (const ChMatrix< RealB > &matra, int insrow, int inscol)
 Paste a matrix "matra", transposed, into "this", inserting at location insrow-inscol. More...
 
void PasteSumTranspMatrix (const ChMatrix< RealB > &matra, int insrow, int inscol)
 Paste a matrix "matra", transposed, into "this", inserting at location insrow-inscol and performing a sum with the preexisting values. More...
 
void PasteClippedMatrix (const ChMatrix< RealB > &matra, int cliprow, int clipcol, int nrows, int ncolumns, int insrow, int inscol)
 Paste a clipped portion of the matrix "matra" into "this", inserting the clip (of size nrows, ncolumns) at the location insrow-inscol. More...
 
void PasteClippedMatrixToVector (const ChMatrix< RealB > &matra, int cliprow, int clipcol, int nrows, int ncolumns, int insindex)
 Paste a clipped portion of the matrix "matra" into "this", where "this" is a vector (of ChMatrix type), inserting the clip (of size nrows, ncolumns) at the location insindex. More...
 
void PasteClippedVectorToMatrix (const ChMatrix< RealB > &matra, int cliprow, int clipcol, int nrows, int ncolumns, int insindex)
 Paste a clipped portion of a vector into "this", where "this" is a matrix (of ChMatrix type), inserting the clip (of size nrows, ncolumns) at the location insindex. More...
 
void PasteSumClippedMatrix (const ChMatrix< RealB > &matra, int cliprow, int clipcol, int nrows, int ncolumns, int insrow, int inscol)
 Paste a clipped portion of the matrix "matra" into "this", performing a sum with preexisting values, inserting the clip (of size nrows, ncolumns) at the location insrow-inscol. More...
 
void PasteVector (const ChVector< RealB > &va, int insrow, int inscol)
 Paste a vector "va" into the matrix.
 
void PasteSumVector (const ChVector< RealB > &va, int insrow, int inscol)
 Paste a vector "va" into the matrix, summing it with preexisting values.
 
void PasteSubVector (const ChVector< RealB > &va, int insrow, int inscol)
 Paste a vector "va" into the matrix, subtracting it from preexisting values.
 
void PasteQuaternion (const ChQuaternion< RealB > &qa, int insrow, int inscol)
 Paste a quaternion into the matrix.
 
void PasteSumQuaternion (const ChQuaternion< RealB > &qa, int insrow, int inscol)
 Paste a quaternion into the matrix, summing it with preexisting values.
 
void PasteCoordsys (const ChCoordsys< RealB > &cs, int insrow, int inscol)
 Paste a coordsys into the matrix.
 
ChVector< double > ClipVector (int insrow, int inscol) const
 Returns the vector clipped from insrow, inscol.
 
ChQuaternion< double > ClipQuaternion (int insrow, int inscol) const
 Returns the quaternion clipped from insrow, inscol.
 
ChCoordsys< double > ClipCoordsys (int insrow, int inscol) const
 Returns the coordsys clipped from insrow, inscol.
 
void Set_Xq_matrix (const ChQuaternion< RealB > &q)
 Fills a 4x4 matrix as the "star" matrix, representing quaternion cross product. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from chrono::ChMatrix< double >
static double MatrDot (const ChMatrix< RealB > &ma, const ChMatrix< RealC > &mb)
 Computes dot product between two column-matrices (vectors) with same size. More...
 
- Protected Attributes inherited from chrono::ChMatrix< double >
int rows
 
int columns
 
double * address
 

Member Function Documentation

template<class Real >
ChStateDelta chrono::ChStateDelta::operator* ( const Real  factor) const

Multiplies this matrix by a scalar value.

Performance warning: a new object is created.

template<class RealB >
ChStateDelta chrono::ChStateDelta::operator+ ( const ChMatrix< RealB > &  matbis) const

Sums this matrix and another matrix.

Performance warning: a new object is created.

ChStateDelta chrono::ChStateDelta::operator- ( ) const

Negates sign of the matrix.

Performance warning: a new object is created.

template<class RealB >
ChStateDelta chrono::ChStateDelta::operator- ( const ChMatrix< RealB > &  matbis) const

Subtracts this matrix and another matrix.

Performance warning: a new object is created.