In file matrix.h:

class matrix

generic matrix class.

Public Fields

[more] Friend functions and operators

Public Methods

[more] matrix(void)
constructs an uninitialized matrix
[more] matrix(int N)
constructs an NxN matrix but does not initialize its elements
[more] matrix(int Nr, int Nc, int clear = 1)
constructs an Nr x Nc matrix and sets the elements to 0 if clear is 1
[more] matrix(int Nr, int Nc, const double* data)
constructs an Nr x Nc matrix and sets its elements to the values pointed to by data.
[more] matrix(const matrix &other)
copy constructor
[more] matrix(const tmatrix &tm)
copy constructor
[more] matrix(const quaternion &q)
constructor for a 3x3 matrix corresponding to the rotation represented by q
[more] ~matrix(void)
destructor
[more]static matrix identity(int N)
returns an N x N identity matrix
[more]inline int nrows(void) const
returns the number of rows in the matrix
[more]inline int ncols(void) const
returns the number of columns in the matrix
[more]inline double& operator()(int r, int c)
returns a reference to element (r, c)
[more]inline double& elem(int r, int c)
returns a reference to element (r, c)
[more]inline double* elem(void)
returns a pointer to the matrix's storage space.
[more]inline double* addr(int r, int c)
returns a pointer to the element at (r, c)
[more]inline double* rowAddr(int row)
returns a pointer to the first element in the indicated row
[more]inline int isSquare(void) const
returns non-zero if the matrix is square, 0 if not
[more]void resize(int newRows, int newCols)
resizes a matrix.
[more]matrix& makeIdentity(void)
sets the matrix to the identity matrix, maintaining current dimensions and assuming the matrix is square
[more]void print(FILE* fp) const
prints the matrix to a file
[more] Row, column, and block operations
[more]int compose(double rx, double ry, double rz)
composes a 3x3 rotation matrix.
[more]int decompose(double &rx, double &ry, double &rz)
decomposes a 3x3 rotation matrix into the rotation angles as specified by matrix::compose.
[more]void transpose(void)
transposes the matrix.
[more]void negate(void)
negates all elements in the matrix
[more]matrix& operator=(int zeroOrOne)
sets a matrix to either the zero matrix or the identity matrix.
[more]matrix& operator=(const matrix &src)
assignment operator
[more]matrix& operator=(const tmatrix &src)
assignment operator.
[more]matrix& operator=(const quaternion &q)
assignment operator.
[more]matrix& operator*=(double d)
scalar multiplication operator
[more]matrix& operator*=(const matrix &src)
matrix multiplication operator; computes (*this)*src
[more]matrix& operator+=(const matrix &src)
addition operator
[more]matrix& operator-=(const matrix &src)
subtraction operator


Documentation

generic matrix class. Matrix elements are stored in row-major form (i.e. the first element in a matrix's array is for (row=0, col=0), the second element in the array is for (row=0, col=1), and so on. Each matrix has a small amount of storage (determined by the constant MATRIX_SPACE) so that small matrices do not require calls to new and delete. Larger matrices allocate and deallocate dynamic memory.
o matrix(void)
constructs an uninitialized matrix

o matrix(int N)
constructs an NxN matrix but does not initialize its elements

o matrix(int Nr, int Nc, int clear = 1)
constructs an Nr x Nc matrix and sets the elements to 0 if clear is 1

o matrix(int Nr, int Nc, const double* data)
constructs an Nr x Nc matrix and sets its elements to the values pointed to by data. Data must hold Nr x Nc elements in row-major form.

o matrix(const matrix &other)
copy constructor

o matrix(const tmatrix &tm)
copy constructor

o matrix(const quaternion &q)
constructor for a 3x3 matrix corresponding to the rotation represented by q

o ~matrix(void)
destructor

ostatic matrix identity(int N)
returns an N x N identity matrix

oinline int nrows(void) const
returns the number of rows in the matrix

oinline int ncols(void) const
returns the number of columns in the matrix

oinline double& operator()(int r, int c)
returns a reference to element (r, c)

oinline double& elem(int r, int c)
returns a reference to element (r, c)

oinline double* elem(void)
returns a pointer to the matrix's storage space. Note that this space may either be part of the matrix's internal space, or may be dynamically allocated.

oinline double* addr(int r, int c)
returns a pointer to the element at (r, c)

oinline double* rowAddr(int row)
returns a pointer to the first element in the indicated row

oinline int isSquare(void) const
returns non-zero if the matrix is square, 0 if not

ovoid resize(int newRows, int newCols)
resizes a matrix. if the current size is not equal to the new size, then the contents of the matrix will likely be lost.

omatrix& makeIdentity(void)
sets the matrix to the identity matrix, maintaining current dimensions and assuming the matrix is square

ovoid print(FILE* fp) const
prints the matrix to a file

o Row, column, and block operations

oinline void getRow(int r, double* data) const
copies the r'th row into data

oinline void getRow(int r, vector &v) const
copies the r'th row into v; assumes v has sufficient space

oinline void getCol(int c, double* data) const
copies the c'th col into data

oinline void getCol(int c, vector &v) const
copies the c'th col into v; assumes v has sufficient space

oinline void setRow(int r, const double* data)
sets the r'th row to the elements pointed to by data

oinline void clearRow(int r)
sets the r'th row to zero

oinline void clearColumn(int c)
sets the c'th column to zero

oinline void setSubRow(int r, int c0, int size, const double* data)
Sets part of a row to the supplied values. 'size' entries starting at column 'c0' in row 'r' are set to the values pointed to by 'data'.

oinline void setColumn(int c, const double* data)
sets the c'th column to the elements pointed to by data

oinline void setSubColumn(int c, int r0, int size, const double* data)
Sets part of a column to the supplied values. 'size' entries starting at row 'r0' in column 'c' are set to the values pointed to by 'data'.

ovoid setBlock(const matrix &subM, int r, int c)
sets the sub-block starting at (r, c) to subM

ovoid copyBlock(const matrix &M, int destr, int destc, int mr0, int mc0, int mr1, int mc1)
copies the block ([mr0mr1], [mc0mc1]) into M starting at (destr, destc)

ovoid clearBlock(int r, int c, int nr, int nc)
sets an nr by nc block (starting at (r, c)) to zero

oint compose(double rx, double ry, double rz)
composes a 3x3 rotation matrix. The matrix is equivalent to the product of three rotation matrices: rotZ(rz)*rotX(rx)*rotY(ry) where rotZ(rz) indicates a rotation about z by rz.

oint decompose(double &rx, double &ry, double &rz)
decomposes a 3x3 rotation matrix into the rotation angles as specified by matrix::compose. The matrix must be 3x3.

ovoid transpose(void)
transposes the matrix. Note that if the matrix is not square, some dynamic is temporarily allocated to use as a workspace. If you are concerned about performance, use the two-argument friend function transpose().

ovoid negate(void)
negates all elements in the matrix

omatrix& operator=(int zeroOrOne)
sets a matrix to either the zero matrix or the identity matrix. If zeroOrOne is 0, then the matrix will be zeroed; otherwise, it will be set to the identity matrix assuming the matrix is square.

omatrix& operator=(const matrix &src)
assignment operator

omatrix& operator=(const tmatrix &src)
assignment operator. Creates a 4x4 matrix with elements equal to those of src

omatrix& operator=(const quaternion &q)
assignment operator. Creates a 3x3 matrix corresponding to the rotation represented by q.

omatrix& operator*=(double d)
scalar multiplication operator

omatrix& operator*=(const matrix &src)
matrix multiplication operator; computes (*this)*src

omatrix& operator+=(const matrix &src)
addition operator

omatrix& operator-=(const matrix &src)
subtraction operator

o Friend functions and operators
Friends:
matrix &transpose(matrix &dest, const matrix &src)
matrix transpose(const matrix &src)
int eliminateUnusedDims(matrix &dest, const matrix &src,
int restoreUnusedDims(matrix &dest, const matrix &src,
matrix operator+(matrix &m1, matrix &m2)
matrix operator-(matrix &m1, matrix &m2)
matrix operator*(const matrix &m, double d)
matrix operator*(double d, const matrix &m)
vector operator*(const matrix &m, const vector &v)
vector operator*(const vector &v, const matrix &m)
triple operator*(const matrix &m, const triple &t)
triple operator*(const triple &t, const matrix &m)
int operator==(const matrix &a, const matrix &b)
matrix operator *(const matrix &m1, const matrix &m2)
int mmult(matrix &result, const matrix &a, const matrix &b)
int mmult(matrix &result, const matrix &a, const matrix &b,
int mmultTranspose(matrix &result, const matrix &A, const matrix &B)
int diagMatrixMult(matrix &M, const vector &D)
int outerProduct(matrix &result, const vector &v1, const vector &v2)
int outerProduct(matrix &result, const triple &v1, const triple &v2)
int inverse(matrix &result, const matrix &m,

oint* ignoredR

oconst int* unused


This class has no child classes.
Friends:
tmatrix
triple
vector
quaternion

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.