# w2img::Matrix Class Reference

List of all members.

## Detailed Description

A Matrix is implemented as holding on to a result code::Image<float> which can be obtained by calling getResult().

Author:
Lakshman
Version:
Id
w2img_Matrix.h,v 1.7 2009/06/02 20:17:57 lakshman Exp

## Public Member Functions

Matrix (const code::Image< float > &inData)
Note that this makes a shallow copy of the input data, replacing the data whenever possible.
Matrix ()
For STL use.
void set_val (int i, int j, double v)
const code::Image< float > & getResult () const
Matrix clone () const
bool hasSameDimensionsAs (const Matrix &another) const
bool isSquare () const
bool isScalar () const
Matrixsubtract (const Matrix &another)
Matrixtranspose ()
Matrixmultiply (const Matrix &another)
double getScalar () const
The behavior of this method is undefined if the given matrix is not really a scalar, i.e.
Matrixinvert () throw (SingularException)
inverts this matrix using Gauss-Jordan elimination, admittedly not the most efficient method.
Matrixmultiply (double factor)
double determinant () const
returns the determinant of this matrix.

## Static Public Member Functions

static code::Image< float > multiply (const code::Image< float > &a, const code::Image< float > &b)
Helper function used by the Matrix multiplication.
static code::Image< float > transpose (const code::Image< float > &a)
Helper function used by the Matrix transpose.
static Matrix Zero (int rows, int cols)
return a zero matrix with these dimensions.
static Matrix Identity (int rows, int cols)
return an identity matrix with these dimensions.

## Friends

bool operator== (const Matrix &a, const Matrix &b)

## Classes

struct  SingularException
An exception thrown by Matrix operations such as invert when they encounter a singular matrix. More...

## Constructor & Destructor Documentation

 w2img::Matrix::Matrix ( const code::Image< float > & inData ) ` [inline]`

Note that this makes a shallow copy of the input data, replacing the data whenever possible.

You may be interested in passing a twin() of the actual image so your copy is not affected.

 w2img::Matrix::Matrix ( ) ` [inline]`

For STL use.

## Member Function Documentation

 Matrix& w2img::Matrix::add ( const Matrix & another )

 Matrix w2img::Matrix::clone ( ) const` [inline]`

 double w2img::Matrix::determinant ( ) const

returns the determinant of this matrix.

A very expensive ( O(N^3) operation ).

 const code::Image& w2img::Matrix::getResult ( ) const` [inline]`

 double w2img::Matrix::getScalar ( ) const

The behavior of this method is undefined if the given matrix is not really a scalar, i.e.

has only one row and one column.

 bool w2img::Matrix::hasSameDimensionsAs ( const Matrix & another ) const

 static Matrix w2img::Matrix::Identity ( int rows, int cols ) ` [static]`

return an identity matrix with these dimensions.

 Matrix& w2img::Matrix::invert ( ) throw (SingularException)

inverts this matrix using Gauss-Jordan elimination, admittedly not the most efficient method.

A very expensive ( O(N^3) operation ).

If the exception is thrown, the matrix held is in an unusable state. Further operations are undefined.

 bool w2img::Matrix::isScalar ( ) const

 bool w2img::Matrix::isSquare ( ) const

 static code::Image w2img::Matrix::multiply ( const code::Image< float > & a, const code::Image< float > & b ) ` [static]`

Helper function used by the Matrix multiplication.

 Matrix& w2img::Matrix::multiply ( double factor )

 Matrix& w2img::Matrix::multiply ( const Matrix & another )

 void w2img::Matrix::set_val ( int i, int j, double v ) ` [inline]`

 Matrix& w2img::Matrix::subtract ( const Matrix & another )

 static code::Image w2img::Matrix::transpose ( const code::Image< float > & a ) ` [static]`

Helper function used by the Matrix transpose.

 Matrix& w2img::Matrix::transpose ( )

 static Matrix w2img::Matrix::Zero ( int rows, int cols ) ` [static]`

return a zero matrix with these dimensions.

## Friends And Related Function Documentation

 bool operator== ( const Matrix & a, const Matrix & b ) ` [friend]`

Generated on Fri May 4 13:40:24 2012 for WDSS-IIw2algs by 1.4.7