sofa::defaulttype::Mat< L, C, real > Class Template Reference

#include <Mat.h>

Inheritance diagram for sofa::defaulttype::Mat< L, C, real >:

Inheritance graph
[legend]
Collaboration diagram for sofa::defaulttype::Mat< L, C, real >:

Collaboration graph
[legend]

Public Types

enum  { N = L*C }
typedef real Real
typedef Vec< C, real > Line
typedef Vec< L, real > Col

Public Member Functions

 Mat ()
 Mat (NoInit)
 Mat (Line r1, Line r2)
 Specific constructor with 2 lines.
 Mat (Line r1, Line r2, Line r3)
 Specific constructor with 3 lines.
 Mat (Line r1, Line r2, Line r3, Line r4)
 Specific constructor with 4 lines.
 Mat (const real &v)
 Constructor from an element.
template<typename real2 >
 Mat (const Mat< L, C, real2 > &m)
 Constructor from another matrix.
template<typename real2 >
 Mat (const real2 *p)
 Constructor from an array of elements (stored per line).
real getNbLines () const
 number of lines
real getNbCols () const
 number of colums
void operator= (const real *p)
 Assignment from an array of elements (stored per line).
template<typename real2 >
void operator= (const Mat< L, C, real2 > &m)
 Assignment from another matrix.
template<int L2, int C2>
void operator= (const Mat< L2, C2, real > &m)
 Assignment from a matrix of different size.
template<int L2, int C2>
void getsub (int L0, int C0, Mat< L2, C2, real > &m) const
template<int L2, int C2>
void setsub (int L0, int C0, const Mat< L2, C2, real > &m)
void clear ()
 Sets each element to 0.
void fill (real r)
 Sets each element to r.
const Line & line (int i) const
 Read-only access to line i.
Col col (int j) const
 Copy of column j.
Line & operator[] (int i)
 Write acess to line i.
const Line & operator[] (int i) const
 Read-only access to line i.
Line & operator() (int i)
 Write acess to line i.
const Line & operator() (int i) const
 Read-only access to line i.
real & operator() (int i, int j)
 Write access to element (i,j).
const real & operator() (int i, int j) const
 Read-only access to element (i,j).
const Line * lptr () const
 Cast into a standard C array of lines (read-only).
Line * lptr ()
 Cast into a standard C array of lines.
const real * ptr () const
 Cast into a standard C array of elements (stored per line) (read-only).
real * ptr ()
 Cast into a standard C array of elements (stored per line).
Line & x ()
 Special access to first line.
Line & y ()
 Special access to second line.
Line & z ()
 Special access to third line.
Line & w ()
 Special access to fourth line.
const Line & x () const
 Special access to first line (read-only).
const Line & y () const
 Special access to second line (read-only).
const Line & z () const
 Special access to thrid line (read-only).
const Line & w () const
 Special access to fourth line (read-only).
void identity ()
 Set matrix to identity.
void transpose (const Mat< C, L, real > &m)
 Set matrix as the transpose of m.
Mat< C, L, real > transposed () const
 Return the transpose of m.
void transpose ()
 Transpose current matrix.
template<int P>
Mat< L, P, real > operator* (const Mat< C, P, real > &m) const
 Matrix multiplication operator.
Mat< L, C, real > operator+ (const Mat< L, C, real > &m) const
 Matrix addition operator.
Mat< L, C, real > operator- (const Mat< L, C, real > &m) const
 Matrix subtraction operator.
Col operator* (const Line &v) const
 Multiplication operator Matrix * Line.
Line multTranspose (const Col &v) const
 Multiplication of the transposed Matrix * Column.
template<int P>
Mat< C, P, real > multTranspose (const Mat< L, P, real > &m) const
 Transposed Matrix multiplication operator.
Mat< L, C, real > operator* (real f) const
 Scalar multiplication operator.
Mat< L, C, real > operator/ (real f) const
 Scalar division operator.
void operator*= (real r)
 Scalar multiplication assignment operator.
void operator/= (real r)
 Scalar division assignment operator.
void operator+= (const Mat< L, C, real > &m)
 Addition assignment operator.
void addTransposed (const Mat< L, C, real > &m)
 Addition of the transposed of m (possible for square matrices only).
void subTransposed (const Mat< L, C, real > &m)
 Substraction of the transposed of m (possible for square matrices only).
void operator-= (const Mat< L, C, real > &m)
 Substraction assignment operator.
bool invert (const Mat< L, C, real > &m)
 Invert matrix m.
Tests operators
bool operator== (const Mat< L, C, real > &b) const
bool operator!= (const Mat< L, C, real > &b) const
bool isSymetric () const

Detailed Description

template<int L, int C, class real = float>
class sofa::defaulttype::Mat< L, C, real >

Definition at line 41 of file Mat.h.


Member Typedef Documentation

template<int L, int C, class real = float>
typedef Vec<L,real> sofa::defaulttype::Mat< L, C, real >::Col

Definition at line 50 of file Mat.h.

template<int L, int C, class real = float>
typedef Vec<C,real> sofa::defaulttype::Mat< L, C, real >::Line

Definition at line 49 of file Mat.h.

template<int L, int C, class real = float>
typedef real sofa::defaulttype::Mat< L, C, real >::Real

Definition at line 48 of file Mat.h.


Member Enumeration Documentation

template<int L, int C, class real = float>
anonymous enum

Enumerator:
N 

Definition at line 46 of file Mat.h.


Constructor & Destructor Documentation

template<int L, int C, class real = float>
sofa::defaulttype::Mat< L, C, real >::Mat (  )  [inline]

Definition at line 52 of file Mat.h.

template<int L, int C, class real = float>
sofa::defaulttype::Mat< L, C, real >::Mat ( NoInit   )  [inline, explicit]

Definition at line 57 of file Mat.h.

template<int L, int C, class real = float>
sofa::defaulttype::Mat< L, C, real >::Mat ( Line  r1,
Line  r2 
) [inline]

Specific constructor with 2 lines.

Definition at line 71 of file Mat.h.

template<int L, int C, class real = float>
sofa::defaulttype::Mat< L, C, real >::Mat ( Line  r1,
Line  r2,
Line  r3 
) [inline]

Specific constructor with 3 lines.

Definition at line 79 of file Mat.h.

template<int L, int C, class real = float>
sofa::defaulttype::Mat< L, C, real >::Mat ( Line  r1,
Line  r2,
Line  r3,
Line  r4 
) [inline]

Specific constructor with 4 lines.

Definition at line 88 of file Mat.h.

template<int L, int C, class real = float>
sofa::defaulttype::Mat< L, C, real >::Mat ( const real &  v  )  [inline, explicit]

Constructor from an element.

Definition at line 98 of file Mat.h.

template<int L, int C, class real = float>
template<typename real2 >
sofa::defaulttype::Mat< L, C, real >::Mat ( const Mat< L, C, real2 > &  m  )  [inline]

Constructor from another matrix.

Definition at line 107 of file Mat.h.

template<int L, int C, class real = float>
template<typename real2 >
sofa::defaulttype::Mat< L, C, real >::Mat ( const real2 *  p  )  [inline, explicit]

Constructor from an array of elements (stored per line).

Definition at line 114 of file Mat.h.


Member Function Documentation

template<int L, int C, class real = float>
void sofa::defaulttype::Mat< L, C, real >::addTransposed ( const Mat< L, C, real > &  m  )  [inline]

Addition of the transposed of m (possible for square matrices only).

Definition at line 459 of file Mat.h.

template<int L, int C, class real = float>
void sofa::defaulttype::Mat< L, C, real >::clear (  )  [inline]

template<int L, int C, class real = float>
Col sofa::defaulttype::Mat< L, C, real >::col ( int  j  )  const [inline]

template<int L, int C, class real = float>
void sofa::defaulttype::Mat< L, C, real >::fill ( real  r  )  [inline]

template<int L, int C, class real = float>
real sofa::defaulttype::Mat< L, C, real >::getNbCols (  )  const [inline]

number of colums

Definition at line 126 of file Mat.h.

template<int L, int C, class real = float>
real sofa::defaulttype::Mat< L, C, real >::getNbLines (  )  const [inline]

number of lines

Definition at line 120 of file Mat.h.

template<int L, int C, class real = float>
template<int L2, int C2>
void sofa::defaulttype::Mat< L, C, real >::getsub ( int  L0,
int  C0,
Mat< L2, C2, real > &  m 
) const [inline]

Definition at line 150 of file Mat.h.

template<int L, int C, class real = float>
void sofa::defaulttype::Mat< L, C, real >::identity (  )  [inline]

template<int L, int C, class real = float>
bool sofa::defaulttype::Mat< L, C, real >::invert ( const Mat< L, C, real > &  m  )  [inline]

template<int L, int C, class real = float>
bool sofa::defaulttype::Mat< L, C, real >::isSymetric (  )  const [inline]

Definition at line 328 of file Mat.h.

template<int L, int C, class real = float>
const Line& sofa::defaulttype::Mat< L, C, real >::line ( int  i  )  const [inline]

Read-only access to line i.

Definition at line 179 of file Mat.h.

template<int L, int C, class real = float>
Line* sofa::defaulttype::Mat< L, C, real >::lptr (  )  [inline]

Cast into a standard C array of lines.

Definition at line 236 of file Mat.h.

template<int L, int C, class real = float>
const Line* sofa::defaulttype::Mat< L, C, real >::lptr (  )  const [inline]

Cast into a standard C array of lines (read-only).

Definition at line 230 of file Mat.h.

template<int L, int C, class real = float>
template<int P>
Mat<C,P,real> sofa::defaulttype::Mat< L, C, real >::multTranspose ( const Mat< L, P, real > &  m  )  const [inline]

Transposed Matrix multiplication operator.

Definition at line 403 of file Mat.h.

template<int L, int C, class real = float>
Line sofa::defaulttype::Mat< L, C, real >::multTranspose ( const Col &  v  )  const [inline]

template<int L, int C, class real = float>
bool sofa::defaulttype::Mat< L, C, real >::operator!= ( const Mat< L, C, real > &  b  )  const [inline]

Definition at line 320 of file Mat.h.

template<int L, int C, class real = float>
const real& sofa::defaulttype::Mat< L, C, real >::operator() ( int  i,
int  j 
) const [inline]

Read-only access to element (i,j).

Definition at line 224 of file Mat.h.

template<int L, int C, class real = float>
real& sofa::defaulttype::Mat< L, C, real >::operator() ( int  i,
int  j 
) [inline]

Write access to element (i,j).

Definition at line 218 of file Mat.h.

template<int L, int C, class real = float>
const Line& sofa::defaulttype::Mat< L, C, real >::operator() ( int  i  )  const [inline]

Read-only access to line i.

Definition at line 212 of file Mat.h.

template<int L, int C, class real = float>
Line& sofa::defaulttype::Mat< L, C, real >::operator() ( int  i  )  [inline]

Write acess to line i.

Definition at line 206 of file Mat.h.

template<int L, int C, class real = float>
Mat<L,C,real> sofa::defaulttype::Mat< L, C, real >::operator* ( real  f  )  const [inline]

Scalar multiplication operator.

Definition at line 418 of file Mat.h.

template<int L, int C, class real = float>
Col sofa::defaulttype::Mat< L, C, real >::operator* ( const Line &  v  )  const [inline]

Multiplication operator Matrix * Line.

Definition at line 375 of file Mat.h.

template<int L, int C, class real = float>
template<int P>
Mat<L,P,real> sofa::defaulttype::Mat< L, C, real >::operator* ( const Mat< C, P, real > &  m  )  const [inline]

Matrix multiplication operator.

Definition at line 343 of file Mat.h.

template<int L, int C, class real = float>
void sofa::defaulttype::Mat< L, C, real >::operator*= ( real  r  )  [inline]

Scalar multiplication assignment operator.

Definition at line 438 of file Mat.h.

template<int L, int C, class real = float>
Mat<L,C,real> sofa::defaulttype::Mat< L, C, real >::operator+ ( const Mat< L, C, real > &  m  )  const [inline]

Matrix addition operator.

Definition at line 357 of file Mat.h.

template<int L, int C, class real = float>
void sofa::defaulttype::Mat< L, C, real >::operator+= ( const Mat< L, C, real > &  m  )  [inline]

Addition assignment operator.

Definition at line 452 of file Mat.h.

template<int L, int C, class real = float>
Mat<L,C,real> sofa::defaulttype::Mat< L, C, real >::operator- ( const Mat< L, C, real > &  m  )  const [inline]

Matrix subtraction operator.

Definition at line 366 of file Mat.h.

template<int L, int C, class real = float>
void sofa::defaulttype::Mat< L, C, real >::operator-= ( const Mat< L, C, real > &  m  )  [inline]

Substraction assignment operator.

Definition at line 477 of file Mat.h.

template<int L, int C, class real = float>
Mat<L,C,real> sofa::defaulttype::Mat< L, C, real >::operator/ ( real  f  )  const [inline]

Scalar division operator.

Definition at line 428 of file Mat.h.

template<int L, int C, class real = float>
void sofa::defaulttype::Mat< L, C, real >::operator/= ( real  r  )  [inline]

Scalar division assignment operator.

Definition at line 445 of file Mat.h.

template<int L, int C, class real = float>
template<int L2, int C2>
void sofa::defaulttype::Mat< L, C, real >::operator= ( const Mat< L2, C2, real > &  m  )  [inline]

Assignment from a matrix of different size.

Definition at line 145 of file Mat.h.

template<int L, int C, class real = float>
template<typename real2 >
void sofa::defaulttype::Mat< L, C, real >::operator= ( const Mat< L, C, real2 > &  m  )  [inline]

Assignment from another matrix.

Definition at line 139 of file Mat.h.

template<int L, int C, class real = float>
void sofa::defaulttype::Mat< L, C, real >::operator= ( const real *  p  )  [inline]

Assignment from an array of elements (stored per line).

Reimplemented in sofa::defaulttype::MatNoInit< L, C, real >, and sofa::defaulttype::MatNoInit< 3, 3, Coord::value_type >.

Definition at line 133 of file Mat.h.

Referenced by sofa::component::linearsolver::TNewMatMatrix< Mat >::operator=().

template<int L, int C, class real = float>
bool sofa::defaulttype::Mat< L, C, real >::operator== ( const Mat< L, C, real > &  b  )  const [inline]

Definition at line 313 of file Mat.h.

template<int L, int C, class real = float>
const Line& sofa::defaulttype::Mat< L, C, real >::operator[] ( int  i  )  const [inline]

Read-only access to line i.

Definition at line 200 of file Mat.h.

template<int L, int C, class real = float>
Line& sofa::defaulttype::Mat< L, C, real >::operator[] ( int  i  )  [inline]

Write acess to line i.

Definition at line 194 of file Mat.h.

template<int L, int C, class real = float>
real* sofa::defaulttype::Mat< L, C, real >::ptr (  )  [inline]

Cast into a standard C array of elements (stored per line).

Definition at line 248 of file Mat.h.

template<int L, int C, class real = float>
const real* sofa::defaulttype::Mat< L, C, real >::ptr (  )  const [inline]

Cast into a standard C array of elements (stored per line) (read-only).

Definition at line 242 of file Mat.h.

Referenced by sofa::gpu::cuda::CudaRigidDistanceGridCollisionModel::draw(), sofa::component::collision::RigidDistanceGridCollisionModel::draw(), and SofaFlowVR::FlowVRRenderMesh::renderUpdate().

template<int L, int C, class real = float>
template<int L2, int C2>
void sofa::defaulttype::Mat< L, C, real >::setsub ( int  L0,
int  C0,
const Mat< L2, C2, real > &  m 
) [inline]

template<int L, int C, class real = float>
void sofa::defaulttype::Mat< L, C, real >::subTransposed ( const Mat< L, C, real > &  m  )  [inline]

Substraction of the transposed of m (possible for square matrices only).

Definition at line 468 of file Mat.h.

template<int L, int C, class real = float>
void sofa::defaulttype::Mat< L, C, real >::transpose (  )  [inline]

Transpose current matrix.

Definition at line 299 of file Mat.h.

template<int L, int C, class real = float>
void sofa::defaulttype::Mat< L, C, real >::transpose ( const Mat< C, L, real > &  m  )  [inline]

Set matrix as the transpose of m.

Definition at line 281 of file Mat.h.

Referenced by sofa::component::collision::TetrahedronModel::computeBoundingTree(), sofa::component::forcefield::TriangularFEMForceField< DataTypes >::computeEigenStrain(), sofa::component::forcefield::TriangularFEMForceField< DataTypes >::computeForce(), sofa::component::forcefield::TriangleFEMForceField< DataTypes >::computeForce(), sofa::component::collision::DiscreteIntersection::computeIntersection(), sofa::component::forcefield::TriangularAnisotropicFEMForceField< DataTypes >::computeMaterialStiffness(), sofa::component::forcefield::TetrahedronFEMForceField< DataTypes >::computeStiffnessMatrix(), sofa::component::forcefield::TetrahedralCorotationalFEMForceField< DataTypes >::computeStiffnessMatrix(), sofa::component::mapping::BarycentricMapperMeshTopology< gpu::cuda::CudaVectorTypes< VecIn, VecIn, float >, gpu::cuda::CudaVectorTypes< VecOut, VecOut, float > >::createPointInQuad(), sofa::component::mapping::BarycentricMapperQuadSetTopology< In, Out >::createPointInQuad(), sofa::component::mapping::BarycentricMapperMeshTopology< In, Out >::createPointInQuad(), sofa::gpu::cuda::CudaRigidDistanceGridCollisionModel::draw(), sofa::component::collision::RigidDistanceGridCollisionModel::draw(), sofa::component::mapping::BarycentricMapperMeshTopology< gpu::cuda::CudaVectorTypes< VecIn, VecIn, float >, gpu::cuda::CudaVectorTypes< VecOut, VecOut, float > >::init(), sofa::component::mapping::BarycentricMapperHexahedronSetTopology< In, Out >::init(), sofa::component::mapping::BarycentricMapperTetrahedronSetTopology< In, Out >::init(), sofa::component::mapping::BarycentricMapperQuadSetTopology< In, Out >::init(), sofa::component::mapping::BarycentricMapperTriangleSetTopology< In, Out >::init(), sofa::component::mapping::BarycentricMapperMeshTopology< In, Out >::init(), sofa::component::constraint::ParabolicConstraint< DataTypes >::init(), and sofa::helper::polar_decomp().

template<int L, int C, class real = float>
Mat<C,L,real> sofa::defaulttype::Mat< L, C, real >::transposed (  )  const [inline]

Return the transpose of m.

Definition at line 289 of file Mat.h.

Referenced by sofa::defaulttype::SolidTypes< R >::RigidInertia::operator*().

template<int L, int C, class real = float>
const Line& sofa::defaulttype::Mat< L, C, real >::w (  )  const [inline]

Special access to fourth line (read-only).

Definition at line 269 of file Mat.h.

template<int L, int C, class real = float>
Line& sofa::defaulttype::Mat< L, C, real >::w (  )  [inline]

Special access to fourth line.

Definition at line 260 of file Mat.h.

template<int L, int C, class real = float>
const Line& sofa::defaulttype::Mat< L, C, real >::x (  )  const [inline]

Special access to first line (read-only).

Definition at line 263 of file Mat.h.

template<int L, int C, class real = float>
Line& sofa::defaulttype::Mat< L, C, real >::x (  )  [inline]

Special access to first line.

Definition at line 254 of file Mat.h.

Referenced by sofa::helper::Quater< Real >::fromMatrix().

template<int L, int C, class real = float>
const Line& sofa::defaulttype::Mat< L, C, real >::y (  )  const [inline]

Special access to second line (read-only).

Definition at line 265 of file Mat.h.

template<int L, int C, class real = float>
Line& sofa::defaulttype::Mat< L, C, real >::y (  )  [inline]

Special access to second line.

Definition at line 256 of file Mat.h.

Referenced by sofa::helper::Quater< Real >::fromMatrix().

template<int L, int C, class real = float>
const Line& sofa::defaulttype::Mat< L, C, real >::z (  )  const [inline]

Special access to thrid line (read-only).

Definition at line 267 of file Mat.h.

template<int L, int C, class real = float>
Line& sofa::defaulttype::Mat< L, C, real >::z (  )  [inline]

Special access to third line.

Definition at line 258 of file Mat.h.

Referenced by sofa::helper::Quater< Real >::fromMatrix().


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

Generated on Sun Nov 23 04:23:53 2008 for Sofa by  doxygen 1.5.7.1