MeshKit  1.0
Matrix< R, C > Class Template Reference

Fixed-size matrix class. More...

#include <Matrix.hpp>

Inheritance diagram for Matrix< R, C >:

List of all members.

Public Types

enum  { ROWS = R, COLS = C }
typedef Matrix< R, C > my_type

Public Member Functions

 Matrix ()
 Matrix (double v)
 Matrix (const double *v)
 Matrix (const double v[R][C])
 Matrix (const Matrix< R, 1 > *c)
 Matrix (const Matrix< 1, C > *r)
 Matrix (const char *s)
 Matrix (const std::string &s)
 Matrix (const Matrix< R+1, C+1 > &m, unsigned r, unsigned c)
Matrix< R, C > & operator= (double v)
Matrix< R, C > & operator= (const double *v)
Matrix< R, C > & operator= (const char *s)
Matrix< R, C > & operator= (const std::string &s)
double & operator() (unsigned r, unsigned c)
double operator() (unsigned r, unsigned c) const
double * data ()
const double * data () const
void zero ()
void identity ()
void set (double v)
void set (const double *v)
void set (const double v[R][C])
void set (const char *s)
void set (const std::string &s)
void diag (double v)
void diag (const double *v)
void make_minor (const Matrix< R+1, C+1 > &m, unsigned r, unsigned c)
 Extract minor of a matrix and assign to *this.
Matrix< R, C > & assign_add_transpose (const Matrix< C, R > &other)
Matrix< R, C > & assign_product (double s, const Matrix< R, C > &m)
Matrix< R, C > & assign_add_product (double s, const Matrix< R, C > &m)
Matrix< R, C > & assign_multiply_elements (const Matrix< R, C > &m)
Matrix< R, C > & operator+= (const Matrix< R, C > &other)
Matrix< R, C > & operator-= (const Matrix< R, C > &other)
Matrix< R, C > & operator+= (double scalar)
Matrix< R, C > & operator-= (double scalar)
Matrix< R, C > & operator*= (double scalar)
Matrix< R, C > & operator/= (double scalar)
Matrix< 1, C > row (unsigned r) const
Matrix< R, 1 > column (unsigned c) const
Matrix< 1, R > column_transpose (unsigned c) const
void set_row (unsigned r, const Matrix< 1, C > &v)
void add_row (unsigned r, const Matrix< 1, C > &v)
void set_row_transpose (unsigned r, const Matrix< C, 1 > &v)
void set_rows (const Matrix< 1, C > *v)
void set_column (unsigned c, const Matrix< R, 1 > &v)
void add_column (unsigned c, const Matrix< R, 1 > &v)
void set_column_transpose (unsigned c, const Matrix< 1, R > &v)
void set_columns (const Matrix< R, 1 > *v)

Protected Attributes

double m [R *C]

Detailed Description

template<unsigned R, unsigned C>
class MeshKit::Matrix< R, C >

Fixed-size matrix class.

This class implements a fixed-size 2-dimensional matrix. The actual size is specified with template parameters.

Definition at line 50 of file Matrix.hpp.


Member Typedef Documentation

typedef Matrix<R,C> my_type

Definition at line 55 of file Matrix.hpp.


Member Enumeration Documentation

anonymous enum
Enumerator:
ROWS 
COLS 

Definition at line 57 of file Matrix.hpp.


Constructor & Destructor Documentation

Matrix ( ) [inline]

Constructor for uninitialized matrix

Definition at line 60 of file Matrix.hpp.

Matrix ( double  v) [inline]

Initialize diagonal values, zero others

Definition at line 62 of file Matrix.hpp.

Matrix ( const double *  v) [inline]

Initialize to an array of values

Definition at line 64 of file Matrix.hpp.

Matrix ( const double  v[R][C]) [inline]

Initialize from 2D array

Definition at line 66 of file Matrix.hpp.

Matrix ( const Matrix< R, 1 > *  c) [inline]

Initialize with column vectors

Definition at line 68 of file Matrix.hpp.

Matrix ( const Matrix< 1, C > *  r) [inline]

Initialize with row vectors

Definition at line 70 of file Matrix.hpp.

Matrix ( const char *  s) [inline]

Parse initial values from string

Definition at line 72 of file Matrix.hpp.

Matrix ( const std::string &  s) [inline]

Parse initial values from string

Definition at line 74 of file Matrix.hpp.

Matrix ( const Matrix< R+1, C+1 > &  m,
unsigned  r,
unsigned  c 
) [inline]

Initialize to the minor of a larger matrix This matrix is the passed matrix with the specified row and column removed.

Definition at line 79 of file Matrix.hpp.


Member Function Documentation

void add_column ( unsigned  c,
const Matrix< R, 1 > &  v 
) [inline]

Definition at line 400 of file Matrix.hpp.

void add_row ( unsigned  r,
const Matrix< 1, C > &  v 
) [inline]

Definition at line 383 of file Matrix.hpp.

Matrix< R, C > & assign_add_product ( double  s,
const Matrix< R, C > &  m 
) [inline]

*this += s*m

Definition at line 459 of file Matrix.hpp.

Matrix< R, C > & assign_add_transpose ( const Matrix< C, R > &  other) [inline]

*this += transpose(other)

Definition at line 441 of file Matrix.hpp.

Matrix< R, C > & assign_multiply_elements ( const Matrix< R, C > &  m) [inline]

multiply each element by the cooresponding element in m

Definition at line 449 of file Matrix.hpp.

Matrix< R, C > & assign_product ( double  s,
const Matrix< R, C > &  m 
) [inline]

*this = s*m

Definition at line 454 of file Matrix.hpp.

Matrix< R, 1 > column ( unsigned  c) const [inline]

Definition at line 414 of file Matrix.hpp.

Matrix< 1, R > column_transpose ( unsigned  c) const [inline]

Definition at line 422 of file Matrix.hpp.

double* data ( ) [inline]

Definition at line 89 of file Matrix.hpp.

const double* data ( ) const [inline]

Definition at line 90 of file Matrix.hpp.

void diag ( double  v) [inline]

Set diagonal value to passed values, others to zero.

Definition at line 248 of file Matrix.hpp.

void diag ( const double *  v) [inline]

Set diagonal values to passed values, others to zero.

Definition at line 303 of file Matrix.hpp.

void identity ( ) [inline]

Definition at line 93 of file Matrix.hpp.

void make_minor ( const Matrix< R+1, C+1 > &  M,
unsigned  r,
unsigned  c 
) [inline]

Extract minor of a matrix and assign to *this.

Set this matrix to the minor of a larger matrix

Given a matrix m, a row r and an column c, set *this to the matrix that is m with row r and column c deleted.

Definition at line 363 of file Matrix.hpp.

double& operator() ( unsigned  r,
unsigned  c 
) [inline]

Definition at line 87 of file Matrix.hpp.

double operator() ( unsigned  r,
unsigned  c 
) const [inline]

Definition at line 88 of file Matrix.hpp.

Matrix< R, C > & operator*= ( double  scalar) [inline]

Definition at line 484 of file Matrix.hpp.

Matrix< R, C > & operator+= ( const Matrix< R, C > &  other) [inline]

Definition at line 464 of file Matrix.hpp.

Matrix< R, C > & operator+= ( double  scalar) [inline]

Definition at line 474 of file Matrix.hpp.

Matrix< R, C > & operator-= ( const Matrix< R, C > &  other) [inline]

Definition at line 469 of file Matrix.hpp.

Matrix< R, C > & operator-= ( double  scalar) [inline]

Definition at line 479 of file Matrix.hpp.

Matrix< R, C > & operator/= ( double  scalar) [inline]

Definition at line 489 of file Matrix.hpp.

Matrix<R,C>& operator= ( double  v) [inline]

Definition at line 82 of file Matrix.hpp.

Matrix<R,C>& operator= ( const double *  v) [inline]

Definition at line 83 of file Matrix.hpp.

Matrix<R,C>& operator= ( const char *  s) [inline]

Definition at line 84 of file Matrix.hpp.

Matrix<R,C>& operator= ( const std::string &  s) [inline]

Definition at line 85 of file Matrix.hpp.

Matrix<1,C> row ( unsigned  r) const [inline]

Definition at line 128 of file Matrix.hpp.

void set ( double  v) [inline]

Definition at line 94 of file Matrix.hpp.

void set ( const double *  v) [inline]

Definition at line 97 of file Matrix.hpp.

void set ( const double  v[R][C]) [inline]

Definition at line 241 of file Matrix.hpp.

void set ( const char *  s) [inline]

Definition at line 101 of file Matrix.hpp.

void set ( const std::string &  s) [inline]

Definition at line 102 of file Matrix.hpp.

void set_column ( unsigned  c,
const Matrix< R, 1 > &  v 
) [inline]

Definition at line 396 of file Matrix.hpp.

void set_column_transpose ( unsigned  c,
const Matrix< 1, R > &  v 
) [inline]

Definition at line 404 of file Matrix.hpp.

void set_columns ( const Matrix< R, 1 > *  v) [inline]

Definition at line 408 of file Matrix.hpp.

void set_row ( unsigned  r,
const Matrix< 1, C > &  v 
) [inline]

Definition at line 379 of file Matrix.hpp.

void set_row_transpose ( unsigned  r,
const Matrix< C, 1 > &  v 
) [inline]

Definition at line 387 of file Matrix.hpp.

void set_rows ( const Matrix< 1, C > *  v) [inline]

Definition at line 391 of file Matrix.hpp.

void zero ( ) [inline]

Definition at line 92 of file Matrix.hpp.


Member Data Documentation

double m[R *C] [protected]

Definition at line 52 of file Matrix.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines