GMatrix Class Reference

#include <GMatrix.h>

List of all members.

Public Member Functions

 GMatrix (int rows, int cols)
 GMatrix (int rows, int cols, const double ad[])
 GMatrix (int rows, int cols, double *data, bool preset=false)
 GMatrix (const GMatrix &gmatrix)
virtual ~GMatrix ()
double & operator() (int i, int j) const
double * operator[] (int i) const
int LUD (GMatrix &LU, GVector &permutation)
int SVD (GMatrix &U, GMatrix &W, GMatrix &V)
void add (const GMatrix &gmatrix)
void add (const GMatrix &gmatrix, const GMatrix &gmatrix1)
void copySubMatrix (int i, int j, int k, int l, int i1, int j1, GMatrix &gmatrix)
virtual bool epsilonEquals (const GMatrix &gmatrix, double d) const
virtual bool equals (const GMatrix &gmatrix) const
void get (GMatrix &gmatrix) const
void get (Matrix3d &matrix3d) const
void get (Matrix3f &matrix3f) const
void get (Matrix4d &matrix4d) const
void get (Matrix4f &matrix4f) const
void getColumn (int col, GVector gvector) const
void getColumn (int col, double ad[]) const
double getElement (int row, int col) const
int getNumCol () const
int getNumRow () const
void getRow (int row, GVector gvector) const
void getRow (int row, double ad[]) const
virtual int hashCode () const
void identityMinus ()
void invert ()
void invert (GMatrix &gmatrix)
void mul (const GMatrix &gmatrix)
void mul (const GMatrix &gmatrix, const GMatrix &gmatrix1)
void mul (const GVector &gvector, const GVector &gvector1)
void mulTransposeBoth (const GMatrix &gmatrix, const GMatrix &gmatrix1)
void mulTransposeLeft (GMatrix gmatrix, GMatrix gmatrix1)
void mulTransposeRight (const GMatrix &gmatrix, const GMatrix &gmatrix1)
void negate ()
void negate (const GMatrix &gmatrix)
void set (const GMatrix &gmatrix)
void set (const Matrix3d &matrix3d)
void set (const Matrix3f &matrix3f)
void set (const Matrix4d &matrix4d)
void set (const Matrix4f &matrix4f)
void set (const double ad[])
void setColumn (int i, const GVector &gvector)
void setColumn (int i, const double ad[])
void setElement (int i, int j, double d)
void setIdentity ()
void setRow (int i, const GVector &gvector)
void setRow (int i, const double ad[])
void setScale (double d)
void setSize (int i, int j)
void setZero ()
void sub (const GMatrix &gmatrix)
void sub (const GMatrix &gmatrix, const GMatrix &gmatrix1)
double trace () const
void transpose ()
void transpose (const GMatrix &gmatrix)

Static Public Member Functions

static int computeSVD (GMatrix &gmatrix, GMatrix &gmatrix1, GMatrix &gmatrix2, GMatrix &gmatrix3, bool flag)
 Performs the SVD decomposition of A.
static int compute_2X2 (double d, double d1, double d2, double ad[], double ad1[], double ad2[], double ad3[], double ad4[], int i)
static void compute_qr (int i, int j, double ad[], double ad1[], GMatrix &gmatrix, GMatrix &gmatrix1, bool flag)
static double compute_rot (double d, double d1, double ad[], double ad1[])
static double compute_shift (double d, double d1, double d2)
static double d_sign (double d, double d1)
static void luBacksubstitution (int i, double ad[], int ai[], double ad1[])
static bool luDecomposition (int i, double ad[], int ai[], int ai1[])

Public Attributes

int nRow
int nCol
DoubleArray2 values

Static Public Attributes

static const double EPS = 1E-10

Private Member Functions

void resize (int rows, int cols)
void resizeSet (int rows, int cols)
void setZero (int r, int c)
void invertGeneral (GMatrix &gmatrix)

Static Private Member Functions

static void checkMatrix (GMatrix gmatrix)
static void print_m (const GMatrix &gmatrix, const GMatrix &gmatrix1, const GMatrix &gmatrix2)
static void print_se (double ad[], double ad1[])
static void print_svd (const double ad[], const double ad1[], const GMatrix &gmatrix, const GMatrix &gmatrix1)
static void update_u (int i, GMatrix &gmatrix, double ad[], double ad1[])
static void update_u_split (int i, int j, GMatrix &gmatrix, double ad[], double ad1[], bool flag, GMatrix &gmatrix1, GMatrix &gmatrix2)
static void update_v (int i, GMatrix &gmatrix, double ad[], double ad1[])
static void update_v_split (int i, int j, GMatrix &gmatrix, double ad[], double ad1[], bool flag, GMatrix &gmatrix1, GMatrix &gmatrix2)
static void chase_across (double ad[], double ad1[], int i, GMatrix &gmatrix, bool flag)
static void chase_up (double ad[], double ad1[], int i, GMatrix &gmatrix, bool flag)


Detailed Description

Definition at line 75 of file GMatrix.h.


Constructor & Destructor Documentation

GMatrix::GMatrix int  rows,
int  cols
[inline]
 

Definition at line 83 of file GMatrix.h.

References nCol, nRow, DoubleArray2::resize(), setIdentity(), and values.

GMatrix::GMatrix int  rows,
int  cols,
const double  ad[]
 

Definition at line 7 of file GMatrix.cc.

References nCol, nRow, DoubleArray2::resize(), and values.

GMatrix::GMatrix int  rows,
int  cols,
double *  data,
bool  preset = false
 

Definition at line 17 of file GMatrix.cc.

References nCol, nRow, DoubleArray2::resize(), DoubleArray2::setPreset(), and values.

GMatrix::GMatrix const GMatrix gmatrix  ) 
 

Definition at line 32 of file GMatrix.cc.

References nCol, nRow, DoubleArray2::resize(), and values.

virtual GMatrix::~GMatrix  )  [inline, virtual]
 

Definition at line 97 of file GMatrix.h.


Member Function Documentation

void GMatrix::add const GMatrix gmatrix,
const GMatrix gmatrix1
 

Definition at line 78 of file GMatrix.cc.

References nCol, nRow, and values.

void GMatrix::add const GMatrix gmatrix  ) 
 

Definition at line 72 of file GMatrix.cc.

References nCol, nRow, and values.

void GMatrix::chase_across double  ad[],
double  ad1[],
int  i,
GMatrix gmatrix,
bool  flag
[static, private]
 

Definition at line 1564 of file GMatrix.cc.

References compute_rot(), nCol, nRow, setIdentity(), and update_u_split().

void GMatrix::chase_up double  ad[],
double  ad1[],
int  i,
GMatrix gmatrix,
bool  flag
[static, private]
 

Definition at line 1599 of file GMatrix.cc.

References compute_rot(), nCol, nRow, setIdentity(), and update_v_split().

void GMatrix::checkMatrix GMatrix  gmatrix  )  [static, private]
 

Definition at line 1405 of file GMatrix.cc.

References Math::abs(), EPS, nCol, nRow, and values.

Referenced by update_u_split(), and update_v_split().

int GMatrix::compute_2X2 double  d,
double  d1,
double  d2,
double  ad[],
double  ad1[],
double  ad2[],
double  ad3[],
double  ad4[],
int  i
[static]
 

Definition at line 336 of file GMatrix.cc.

References Math::abs(), and d_sign().

Referenced by compute_qr().

void GMatrix::compute_qr int  i,
int  j,
double  ad[],
double  ad1[],
GMatrix gmatrix,
GMatrix gmatrix1,
bool  flag
[static]
 

Definition at line 547 of file GMatrix.cc.

References Math::abs(), compute_2X2(), compute_rot(), compute_shift(), d_sign(), EPS, nCol, nRow, print_m(), print_svd(), update_u(), and update_v().

Referenced by computeSVD().

double GMatrix::compute_rot double  d,
double  d1,
double  ad[],
double  ad1[]
[static]
 

Definition at line 671 of file GMatrix.cc.

References Math::abs(), and Math::max().

Referenced by chase_across(), chase_up(), and compute_qr().

double GMatrix::compute_shift double  d,
double  d1,
double  d2
[static]
 

Definition at line 738 of file GMatrix.cc.

References Math::abs(), Math::max(), and Math::min().

Referenced by compute_qr().

int GMatrix::computeSVD GMatrix gmatrix,
GMatrix gmatrix1,
GMatrix gmatrix2,
GMatrix gmatrix3,
bool  flag
[static]
 

Performs the SVD decomposition of A.

Performs the SVD decomposition of A. It is not recommended to use this routine has errors from the decomposition routine are discarded

Parameters:
A the matrix to decompose
Warning:
The matrix A must have a number equal or higher of rows than columns.
Author:
Philippe Lavoie
Date:
22 October 1997

Definition at line 99 of file GMatrix.cc.

References compute_qr(), d_sign(), nCol, nRow, setIdentity(), Math::sqr(), and values.

Referenced by SVD().

void GMatrix::copySubMatrix int  i,
int  j,
int  k,
int  l,
int  i1,
int  j1,
GMatrix gmatrix
 

Definition at line 778 of file GMatrix.cc.

References values.

static double GMatrix::d_sign double  d,
double  d1
[inline, static]
 

Definition at line 124 of file GMatrix.h.

Referenced by compute_2X2(), compute_qr(), and computeSVD().

bool GMatrix::epsilonEquals const GMatrix gmatrix,
double  d
const [virtual]
 

Definition at line 796 of file GMatrix.cc.

References nCol, nRow, and values.

bool GMatrix::equals const GMatrix gmatrix  )  const [virtual]
 

Definition at line 809 of file GMatrix.cc.

References nCol, nRow, and values.

void GMatrix::get Matrix4f matrix4f  )  const
 

Definition at line 920 of file GMatrix.cc.

References nCol, nRow, and values.

void GMatrix::get Matrix4d matrix4d  )  const
 

Definition at line 891 of file GMatrix.cc.

References nCol, nRow, and values.

void GMatrix::get Matrix3f matrix3f  )  const
 

Definition at line 869 of file GMatrix.cc.

References nCol, nRow, and values.

void GMatrix::get Matrix3d matrix3d  )  const
 

Definition at line 847 of file GMatrix.cc.

References nCol, nRow, and values.

void GMatrix::get GMatrix gmatrix  )  const
 

Definition at line 821 of file GMatrix.cc.

References nCol, nRow, and values.

void GMatrix::getColumn int  col,
double  ad[]
const [inline]
 

Definition at line 144 of file GMatrix.h.

References nRow, and values.

void GMatrix::getColumn int  col,
GVector  gvector
const [inline]
 

Definition at line 137 of file GMatrix.h.

References GVector::getSize(), nRow, GVector::setSize(), values, and GVector::values.

double GMatrix::getElement int  row,
int  col
const [inline]
 

Definition at line 149 of file GMatrix.h.

References values.

int GMatrix::getNumCol  )  const [inline]
 

Definition at line 153 of file GMatrix.h.

References nCol.

Referenced by operator<<().

int GMatrix::getNumRow  )  const [inline]
 

Definition at line 157 of file GMatrix.h.

References nRow.

Referenced by operator<<().

void GMatrix::getRow int  row,
double  ad[]
const [inline]
 

Definition at line 169 of file GMatrix.h.

References nCol, and values.

void GMatrix::getRow int  row,
GVector  gvector
const [inline]
 

Definition at line 161 of file GMatrix.h.

References GVector::getSize(), nCol, GVector::setSize(), values, and GVector::values.

virtual int GMatrix::hashCode  )  const [inline, virtual]
 

Definition at line 174 of file GMatrix.h.

void GMatrix::identityMinus  ) 
 

Definition at line 949 of file GMatrix.cc.

References nCol, nRow, and values.

void GMatrix::invert GMatrix gmatrix  )  [inline]
 

Definition at line 190 of file GMatrix.h.

References invertGeneral().

void GMatrix::invert  )  [inline]
 

Definition at line 186 of file GMatrix.h.

References invertGeneral().

Referenced by GVector::SVDBackSolve().

void GMatrix::invertGeneral GMatrix gmatrix  )  [private]
 

Definition at line 1417 of file GMatrix.cc.

References luBacksubstitution(), nCol, nRow, and values.

Referenced by invert().

void GMatrix::luBacksubstitution int  i,
double  ad[],
int  ai[],
double  ad1[]
[static]
 

Definition at line 959 of file GMatrix.cc.

Referenced by invertGeneral(), and GVector::LUDBackSolve().

int GMatrix::LUD GMatrix LU,
GVector permutation
 

Definition at line 41 of file GMatrix.cc.

References nCol, nRow, GVector::values, and values.

bool GMatrix::luDecomposition int  i,
double  ad[],
int  ai[],
int  ai1[]
[static]
 

Definition at line 992 of file GMatrix.cc.

References Math::abs().

void GMatrix::mul const GVector gvector,
const GVector gvector1
 

Definition at line 1112 of file GMatrix.cc.

References GVector::getSize(), GVector::values, and values.

void GMatrix::mul const GMatrix gmatrix,
const GMatrix gmatrix1
 

Definition at line 1099 of file GMatrix.cc.

References nCol, nRow, DoubleArray2::swap(), and values.

void GMatrix::mul const GMatrix gmatrix  ) 
 

Definition at line 1086 of file GMatrix.cc.

References nCol, nRow, DoubleArray2::swap(), and values.

Referenced by print_m(), GVector::SVDBackSolve(), update_u_split(), and update_v_split().

void GMatrix::mulTransposeBoth const GMatrix gmatrix,
const GMatrix gmatrix1
 

Definition at line 1119 of file GMatrix.cc.

References nCol, nRow, DoubleArray2::swap(), and values.

void GMatrix::mulTransposeLeft GMatrix  gmatrix,
GMatrix  gmatrix1
 

Definition at line 1143 of file GMatrix.cc.

References nCol, nRow, DoubleArray2::swap(), and values.

Referenced by print_svd().

void GMatrix::mulTransposeRight const GMatrix gmatrix,
const GMatrix gmatrix1
 

Definition at line 1168 of file GMatrix.cc.

References nCol, nRow, DoubleArray2::swap(), and values.

Referenced by print_svd(), and GVector::SVDBackSolve().

void GMatrix::negate const GMatrix gmatrix  ) 
 

Definition at line 1197 of file GMatrix.cc.

References nCol, nRow, and values.

void GMatrix::negate  ) 
 

Definition at line 1191 of file GMatrix.cc.

References nCol, nRow, and values.

double& GMatrix::operator() int  i,
int  j
const [inline]
 

Definition at line 99 of file GMatrix.h.

References values.

double* GMatrix::operator[] int  i  )  const [inline]
 

Definition at line 103 of file GMatrix.h.

References values.

void GMatrix::print_m const GMatrix gmatrix,
const GMatrix gmatrix1,
const GMatrix gmatrix2
[static, private]
 

Definition at line 1446 of file GMatrix.cc.

References mul(), nCol, nRow, and setIdentity().

Referenced by compute_qr().

void GMatrix::print_se double  ad[],
double  ad1[]
[static, private]
 

Definition at line 1457 of file GMatrix.cc.

void GMatrix::print_svd const double  ad[],
const double  ad1[],
const GMatrix gmatrix,
const GMatrix gmatrix1
[static, private]
 

Definition at line 1462 of file GMatrix.cc.

References mulTransposeLeft(), mulTransposeRight(), nCol, nRow, and setIdentity().

Referenced by compute_qr().

void GMatrix::resize int  rows,
int  cols
[inline, private]
 

Definition at line 249 of file GMatrix.h.

References nCol, nRow, DoubleArray2::resize(), and values.

Referenced by resizeSet().

void GMatrix::resizeSet int  rows,
int  cols
[inline, private]
 

Definition at line 257 of file GMatrix.h.

References nCol, nRow, and resize().

Referenced by set().

void GMatrix::set const double  ad[]  ) 
 

Definition at line 1305 of file GMatrix.cc.

References nCol, nRow, and values.

void GMatrix::set const Matrix4f matrix4f  ) 
 

Definition at line 1282 of file GMatrix.cc.

References CLEAN_REST, resizeSet(), and values.

void GMatrix::set const Matrix4d matrix4d  ) 
 

Definition at line 1259 of file GMatrix.cc.

References CLEAN_REST, resizeSet(), and values.

void GMatrix::set const Matrix3f matrix3f  ) 
 

Definition at line 1243 of file GMatrix.cc.

References CLEAN_REST, resizeSet(), and values.

void GMatrix::set const Matrix3d matrix3d  ) 
 

Definition at line 1222 of file GMatrix.cc.

References resizeSet(), and values.

void GMatrix::set const GMatrix gmatrix  ) 
 

Definition at line 1204 of file GMatrix.cc.

References Math::min(), nCol, nRow, DoubleArray2::resize(), and values.

void GMatrix::setColumn int  i,
const double  ad[]
 

Definition at line 1316 of file GMatrix.cc.

References nRow, and values.

void GMatrix::setColumn int  i,
const GVector gvector
 

Definition at line 1311 of file GMatrix.cc.

References nRow, GVector::values, and values.

void GMatrix::setElement int  i,
int  j,
double  d
[inline]
 

Definition at line 213 of file GMatrix.h.

References values.

void GMatrix::setIdentity  )  [inline]
 

Definition at line 217 of file GMatrix.h.

References setScale().

Referenced by chase_across(), chase_up(), computeSVD(), GMatrix(), print_m(), print_svd(), update_u_split(), and update_v_split().

void GMatrix::setRow int  i,
const double  ad[]
 

Definition at line 1326 of file GMatrix.cc.

References nCol, and values.

void GMatrix::setRow int  i,
const GVector gvector
 

Definition at line 1321 of file GMatrix.cc.

References nCol, GVector::values, and values.

void GMatrix::setScale double  d  ) 
 

Definition at line 1331 of file GMatrix.cc.

References nCol, nRow, setZero(), and values.

Referenced by setIdentity().

void GMatrix::setSize int  i,
int  j
 

Definition at line 1338 of file GMatrix.cc.

References nCol, nRow, DoubleArray2::swap(), and values.

void GMatrix::setZero int  r,
int  c
[inline, private]
 

Definition at line 262 of file GMatrix.h.

References nCol, nRow, and values.

void GMatrix::setZero  )  [inline]
 

Definition at line 226 of file GMatrix.h.

Referenced by setScale().

void GMatrix::sub const GMatrix gmatrix,
const GMatrix gmatrix1
 

Definition at line 1360 of file GMatrix.cc.

References nCol, nRow, and values.

void GMatrix::sub const GMatrix gmatrix  ) 
 

Definition at line 1354 of file GMatrix.cc.

References nCol, nRow, and values.

int GMatrix::SVD GMatrix U,
GMatrix W,
GMatrix V
 

Definition at line 68 of file GMatrix.cc.

References computeSVD().

double GMatrix::trace  )  const
 

Definition at line 1366 of file GMatrix.cc.

References nCol, nRow, and values.

void GMatrix::transpose const GMatrix gmatrix  ) 
 

Definition at line 1394 of file GMatrix.cc.

References nCol, nRow, transpose(), and values.

void GMatrix::transpose  ) 
 

Definition at line 1376 of file GMatrix.cc.

References nCol, nRow, DoubleArray2::swap(), Math::swap(), and values.

Referenced by transpose().

void GMatrix::update_u int  i,
GMatrix gmatrix,
double  ad[],
double  ad1[]
[static, private]
 

Definition at line 1489 of file GMatrix.cc.

References nCol, and values.

Referenced by compute_qr().

void GMatrix::update_u_split int  i,
int  j,
GMatrix gmatrix,
double  ad[],
double  ad1[],
bool  flag,
GMatrix gmatrix1,
GMatrix gmatrix2
[static, private]
 

Definition at line 1498 of file GMatrix.cc.

References checkMatrix(), mul(), nCol, setIdentity(), and values.

Referenced by chase_across().

void GMatrix::update_v int  i,
GMatrix gmatrix,
double  ad[],
double  ad1[]
[static, private]
 

Definition at line 1524 of file GMatrix.cc.

References nRow, and values.

Referenced by compute_qr().

void GMatrix::update_v_split int  i,
int  j,
GMatrix gmatrix,
double  ad[],
double  ad1[],
bool  flag,
GMatrix gmatrix1,
GMatrix gmatrix2
[static, private]
 

Definition at line 1532 of file GMatrix.cc.

References checkMatrix(), mul(), nRow, setIdentity(), and values.

Referenced by chase_up().


Member Data Documentation

const double GMatrix::EPS = 1E-10 [static]
 

Definition at line 77 of file GMatrix.h.

Referenced by checkMatrix(), and compute_qr().

int GMatrix::nCol
 

Definition at line 80 of file GMatrix.h.

Referenced by add(), chase_across(), chase_up(), checkMatrix(), compute_qr(), computeSVD(), epsilonEquals(), equals(), get(), getNumCol(), getRow(), GMatrix(), identityMinus(), invertGeneral(), LUD(), GVector::LUDBackSolve(), mul(), mulTransposeBoth(), mulTransposeLeft(), mulTransposeRight(), negate(), print_m(), print_svd(), resize(), resizeSet(), set(), setRow(), setScale(), setSize(), setZero(), sub(), GVector::SVDBackSolve(), trace(), transpose(), update_u(), and update_u_split().

int GMatrix::nRow
 

Definition at line 79 of file GMatrix.h.

Referenced by add(), chase_across(), chase_up(), checkMatrix(), compute_qr(), computeSVD(), epsilonEquals(), equals(), get(), getColumn(), getNumRow(), GMatrix(), identityMinus(), invertGeneral(), LUD(), GVector::LUDBackSolve(), mul(), mulTransposeBoth(), mulTransposeLeft(), mulTransposeRight(), negate(), print_m(), print_svd(), resize(), resizeSet(), set(), setColumn(), setScale(), setSize(), setZero(), sub(), GVector::SVDBackSolve(), trace(), transpose(), update_v(), and update_v_split().

DoubleArray2 GMatrix::values
 

Definition at line 81 of file GMatrix.h.

Referenced by add(), checkMatrix(), computeSVD(), copySubMatrix(), epsilonEquals(), equals(), get(), getColumn(), getElement(), getRow(), GMatrix(), identityMinus(), invertGeneral(), LUD(), GVector::LUDBackSolve(), GVector::mul(), mul(), mulTransposeBoth(), mulTransposeLeft(), mulTransposeRight(), negate(), operator()(), operator<<(), operator[](), resize(), set(), setColumn(), setElement(), setRow(), setScale(), setSize(), setZero(), sub(), trace(), transpose(), update_u(), update_u_split(), update_v(), and update_v_split().


The documentation for this class was generated from the following files:
Generated on Thu Sep 29 13:39:45 2005 for vecmath by  doxygen 1.4.4