Atmel Software Framework

math::matrix4d Class Reference

4-Dimensional Matrix Class

#include <matrix.h>

Public Member Functions

const matrix4d adjoint () const
 calculate the adjoint of a 4x4 matrix More...
 
const scalar determinant () const
 calculate the determinant of a 4x4 matrix More...
 
void identity ()
 
const matrix4d inverse () const
 calculate the inverse of a 4x4 matrix More...
 
void transpose ()
 
void zero ()
 
class construction and destruction
 matrix4d ()
 
 matrix4d (const vector4d &c0, const vector4d &c1, const vector4d &c2, const vector4d &c3)
 
 matrix4d (scalar m11, scalar m12, scalar m13, scalar m14, scalar m21, scalar m22, scalar m23, scalar m24, scalar m31, scalar m32, scalar m33, scalar m34, scalar m41, scalar m42, scalar m43, scalar m44)
 
 matrix4d (const scalar *m)
 
class member operators
scalaroperator() (int i, int j)
 
const scalaroperator() (int i, int j) const
 
const vector4d operator* (const vector4d &v) const
 
const matrix4doperator+= (const matrix4d &b)
 
const matrix4doperator-= (const matrix4d &b)
 
const matrix4doperator*= (const matrix4d &b)
 
const matrix4doperator*= (const scalar &s)
 
const matrix4d operator+ (const matrix4d &m) const
 
const matrix4d operator- (const matrix4d &m) const
 
const matrix4d operator* (const matrix4d &m) const
 

Friends

const matrix4d operator* (const scalar &s, const matrix4d &A)
 
const matrix4d operator- (const matrix4d &A)
 

math::matrix4d::matrix4d ( )
inline
math::matrix4d::matrix4d ( const vector4d c0,
const vector4d c1,
const vector4d c2,
const vector4d c3 
)
inline

References c0, c1, and c2.

math::matrix4d::matrix4d ( scalar  m11,
scalar  m12,
scalar  m13,
scalar  m14,
scalar  m21,
scalar  m22,
scalar  m23,
scalar  m24,
scalar  m31,
scalar  m32,
scalar  m33,
scalar  m34,
scalar  m41,
scalar  m42,
scalar  m43,
scalar  m44 
)
inline
math::matrix4d::matrix4d ( const scalar m)
inlineexplicit

const matrix4d math::matrix4d::adjoint ( ) const

calculate the adjoint of a 4x4 matrix

Calculate the caller's adjoint matrix. Given a square matrix 'A', where 'C[i,j]' is the cofactor of 'a[i,j]', then the matrix:

\[ \left[ \begin{array}{cccc} C_{11} & C_{12} & ... & C_{1n}\\ C_{21} & C_{22} & ... & C_{2n}\\ : & : & & :\\ C_{n1} & C_{n2} & ... & C_{nn} \end{array} \right] \]

is the 'matrix of cofactors from A'. The transpose of this matrix is the 'adjoint of A'.

Return values
math::matrix4dThe adjoint of the invoking object.

References _m11, _m12, _m13, _m14, _m21, _m22, _m23, _m24, _m31, _m32, _m33, _m34, _m41, _m42, _m43, _m44, math::det(), and matrix4d().

const scalar math::matrix4d::determinant ( ) const

calculate the determinant of a 4x4 matrix

Calculate the caller's determinant via minors with cofactor expansion along the first row. The determinant of a square matrix 'A' can be computed by multiplying the entries in any row or column by their cofactors and adding the resulting products. For each 1 <= i <= n and 1 <= j <= n, cofactor expansion on the jth column is:

\[ det(A) = a_{1j} C_{1j} + a_{2j} C_{2j} + ... + a_{nj} C_{nj} \]

and cofactor expansion on the ith row is:

\[ det(A) = a_{i1} C_{i1} + a_{i2} C_{i2} + ... + a_{in} C_{in} \]

Return values
scalarThe real-valued determinant of the invoking object.

References _m11, _m12, _m13, _m14, _m21, _m22, _m23, _m24, _m31, _m32, _m33, _m34, _m41, _m42, _m43, _m44, and math::det().

void math::matrix4d::identity ( )
inline
const matrix4d math::matrix4d::inverse ( ) const

calculate the inverse of a 4x4 matrix

Calculate the caller's inverse matrix. If 'A' and 'B' are square matrices of the same size such that 'AB = BA = I' (where 'I' is the identity matrix), then 'A' is 'invertible' and 'B' is an 'inverse' of 'A'. If no such matrix 'B' exists, then 'A' is 'singular'.

Return values
math::matrix4dThe inverse of the invoking matrix (if nonsingular), else the zero matrix if not invertible (singular).
scalar& math::matrix4d::operator() ( int  i,
int  j 
)
inline

References i, and j.

const scalar& math::matrix4d::operator() ( int  i,
int  j 
) const
inline

References i, and j.

const vector4d math::matrix4d::operator* ( const vector4d v) const
inline
const matrix4d math::matrix4d::operator* ( const matrix4d m) const
inline

References matrix4d().

const matrix4d& math::matrix4d::operator*= ( const matrix4d b)
inline
const matrix4d& math::matrix4d::operator*= ( const scalar s)
inline

References s.

const matrix4d math::matrix4d::operator+ ( const matrix4d m) const
inline

References matrix4d().

const matrix4d& math::matrix4d::operator+= ( const matrix4d b)
inline
const matrix4d math::matrix4d::operator- ( const matrix4d m) const
inline

References matrix4d().

const matrix4d& math::matrix4d::operator-= ( const matrix4d b)
inline
void math::matrix4d::transpose ( )
inline
void math::matrix4d::zero ( )
inline

const matrix4d operator* ( const scalar s,
const matrix4d A 
)
friend
const matrix4d operator- ( const matrix4d A)
friend