MULTIBODY SIMULATION SOFTWARE - API documentation
Public Member Functions | Static Public Member Functions
chrono::ChSparseMatrix Class Reference

#include <CHspmatrix.h>

Inheritance diagram for chrono::ChSparseMatrix:
Inheritance graph
[legend]
Collaboration diagram for chrono::ChSparseMatrix:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ChSparseMatrix (int row, int col, double fullness)
 ChSparseMatrix (int row, int col)
 ChSparseMatrix ()
void Build (int row, int col, double fullness)
void CopyFromMatrix (ChMatrix<> *matra)
void CopyFromMatrix (ChSparseMatrix *matra)
void CopyToMatrix (ChMatrix<> *matra)
ChMelementSetElement (int row, int col, double val, ChMelement *guess)
ChMelementGetElement (int row, int col, double *val, ChMelement *guess)
void MoreBuffer (double inflate)
void Resize (int nrows, int ncols)
void Reset ()
void Reset (int row, int col)
void ResetBlocks (int row, int col)
void SetElement (int row, int col, double elem)
double GetElement (int row, int col)
void SwapColumns (int a, int b)
void SwapRows (int a, int b)
void PasteMatrix (ChMatrix<> *matra, int insrow, int inscol)
void PasteTranspMatrix (ChMatrix<> *matra, int insrow, int inscol)
void PasteMatrixFloat (ChMatrix< float > *matra, int insrow, int inscol)
void PasteTranspMatrixFloat (ChMatrix< float > *matra, int insrow, int inscol)
void PasteMatrix (ChSparseMatrix *matra, int insrow, int inscol)
void PasteTranspMatrix (ChSparseMatrix *matra, int insrow, int inscol)
void PasteClippedMatrix (ChMatrix<> *matra, int cliprow, int clipcol, int nrows, int ncolumns, int insrow, int inscol)
void PasteSumMatrix (ChMatrix<> *matra, int insrow, int inscol)
void PasteSumTranspMatrix (ChMatrix<> *matra, int insrow, int inscol)
void MatrMultiply (ChSparseMatrix *matra, ChSparseMatrix *matrb)
void MatrMultiplyT (ChSparseMatrix *matra, ChSparseMatrix *matrb)
void MatrTMultiply (ChSparseMatrix *matra, ChSparseMatrix *matrb)
void MatrAdd (ChSparseMatrix *matra, ChSparseMatrix *matrb)
void MatrSub (ChSparseMatrix *matra, ChSparseMatrix *matrb)
void MatrInc (ChSparseMatrix *matra)
void MatrScale (double factor)
void MatrTranspose ()
void Neg ()
int BestPivotRow (int current)
int BestPivotDiag (int current)
void DiagPivotSymmetric (int rowA, int rowB)
int Solve_LinSys (ChMatrix<> *B, ChMatrix<> *X, int *pivarray, double *det)
void Solve_LinSys (ChMatrix<> *B, ChMatrix<> *X)
int Decompose_LU (int *pivarray, double *det)
int Solve_LU (ChMatrix<> *B, ChMatrix<> *X, int *pivarray)
int Extract_LU (ChMatrix<> *L, ChMatrix<> *U)
int Decompose_LDL (int *pivarray, double *det, int from_eq=0)
int Solve_LDL (ChMatrix<> *B, ChMatrix<> *X, int *pivarray)
int Extract_LDL (ChMatrix<> *L, ChMatrix<> *D, ChMatrix<> *Lu)
int DecomposeAndSolve_LDL (ChMatrix<> *B, ChMatrix<> *X, double &mdet, int from_eq=0)
int DecomposeAndSolve_LDL_forLCP (ChMatrix<> *B, ChMatrix<> *X, double &mdet, int i_D, int i_C, int n_unilaterals, ChUnilateralData constr_data[], int from_eq=0)
int SolveLCP (ChMatrix<> *B, ChMatrix<> *X, int n_bilaterals, int n_unilaterals, int maxiters=200, bool keep_unilateral_status=false, ChUnilateralData constr_data[]=NULL)
void StreamOUTsparseMatlabFormat (ChStreamOutAscii &mstream)

Static Public Member Functions

static int DecomposeAndSolve_LDL_forLCP (ChSparseMatrix *Afact, ChSparseMatrix *Aorig, ChMatrix<> *B, ChMatrix<> *X, double &mdet, int i_D, int i_C, int n_unilaterals, ChUnilateralData constr_data[], int from_eq, int backup_from)

Detailed Description

This class defines a sparse matrix, using the method of linked lists of non-structural-zeros per each row.

Note that this class is inherited from the ChMatrix class, however, since ChMatrix has no 'virtual' members for speed reasons (especially, the Set/GetElement fundamental methods are not virtual!) this means that MOST ChMatrix methods must be overridden and re-implemented, even if you would stick with the implementation in the base class! (here, only few of them are reimplemented, more will come later in futire releases.).


Constructor & Destructor Documentation

chrono::ChSparseMatrix::ChSparseMatrix ( int  row,
int  col,
double  fullness 
)

Creates a sparse matrix with given size. fullness = predicted initial "density" of matrix, between 0..1, to have best buffer handling and memory allocations.

chrono::ChSparseMatrix::ChSparseMatrix ( int  row,
int  col 
)

Creates a sparse matrix with given size. and default 'predicted' fullness as SPM_DEF_FULLNESS

chrono::ChSparseMatrix::ChSparseMatrix ( )

Creates a default 3x3 (a bit unuseful, use ChSparseMatrix for _large_ matrices! :)


Member Function Documentation

int chrono::ChSparseMatrix::Decompose_LDL ( int *  pivarray,
double *  det,
int  from_eq = 0 
)

LDL decomposition, only for symmetric matrices [A]!! Note: pivarray is for both row and col swap (full diagonal pivot)! Note: only upper part of [A] is used. The decomposition can be made to start from the 'from_eq' equation, if matrix was already decomposed and only a basis has been modified under the right-lower part at 'from_eq, from_eq' cell (ex: in LCP solver)

double chrono::ChSparseMatrix::GetElement ( int  row,
int  col 
)

Gets the element at row,col position. Indexes start with zero. The return value is a copy of original value. Use Element() instead if you want to access directly by reference the original element.

Reimplemented from chrono::ChMatrix< double >.

void chrono::ChSparseMatrix::StreamOUTsparseMatlabFormat ( ChStreamOutAscii mstream)

Method to allow serializing transient data into in ascii stream (es a file) as a Matlab sparse matrix format ( each row in file has three elements: row, column, value Note: the row and column indexes start from 1, not 0 as in C language.


CHRONO::ENGINE
C++ library for multibody simulation, (C) Alessandro Tasora
This API documentation has been generated on Tue Jul 10 2012 by Doxygen