Protium
Math and Design Features
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
Protium::LinearAlgebra::Matrix< T, n, m > Class Template Reference

Implements matrix addition, subtraction, multiplication. More...

#include <Matrix.h>

Inheritance diagram for Protium::LinearAlgebra::Matrix< T, n, m >:

Public Member Functions

 Matrix ()
 Default constructor. More...
 
 Matrix (const Matrix< T, n, m > &other)
 Copy Constructor. More...
 
virtual ~Matrix ()
 Default Destructor. More...
 
Vector< T, n > At (const int &row) const
 
const T & At (const int &row, const int &column) const
 
GetDeterminant () const
 Gets determinant. More...
 
Matrix< T, m-1, n-1 > GetSubMatrix (const int &i, const int &j) const
 Get submatrix. More...
 
void Init ()
 Standard initialization. More...
 
bool operator!= (const Matrix< T, n, m > &rhs) const
 
template<int k>
const Matrix< T, n, k > operator* (const Matrix< T, m, k > &rhs) const
 
const Matrix< T, n, m > operator* (const T &rhs) const
 
const Vector< T, m > operator* (const Vector< T, n > &rhs)
 
Matrix< T, n, m > & operator*= (const T &rhs)
 
Vector< T, m > operator*= (const Vector< T, n > &rhs)
 
template<int k>
Matrix< T, n, k > operator*= (const Matrix< T, m, k > &rhs) const
 
const Matrix< T, n, m > operator+ (const Matrix< T, n, m > &rhs) const
 
Matrix< T, n, m > & operator+= (const Matrix< T, n, m > &rhs)
 
const Matrix< T, n, m > operator- (const Matrix< T, n, m > &rhs) const
 
Matrix< T, n, m > & operator-= (const Matrix< T, n, m > &rhs)
 
Matrix< T, n, m > & operator= (const Matrix< T, n, m > &rhs)
 
bool operator== (const Matrix< T, n, m > &rhs) const
 
Vector< T, n > & operator[] (const int &row)
 
Matrix< T, m, n > Transpose () const
 Computes matrix transpose. More...
 
- Public Member Functions inherited from Protium::Allocation::SmallObject< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >
virtual ~SmallObject ()
 

Static Public Member Functions

static int GetNColumns ()
 Retrieves abcissa dimension. More...
 
static int GetNRows ()
 Retrieves ordinant dimension. More...
 
static Matrix< T, n, m > Unit ()
 
- Static Public Member Functions inherited from Protium::Allocation::SmallObjectBase< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >
static void operator delete (void *p, std::size_t size) throw ()
 
static void operator delete (void *p, const std::nothrow_t &) throw ()
 
static void operator delete (void *p, void *place)
 
static void operator delete[] (void *p, std::size_t size) throw ()
 
static void operator delete[] (void *p, const std::nothrow_t &) throw ()
 
static void operator delete[] (void *p, void *place)
 
static void * operator new (std::size_t size) throw ( std::bad_alloc )
 
static void * operator new (std::size_t size, const std::nothrow_t &) throw ()
 
static void * operator new (std::size_t size, void *place)
 
static void * operator new[] (std::size_t size) throw ( std::bad_alloc )
 
static void * operator new[] (std::size_t size, const std::nothrow_t &) throw ()
 
static void * operator new[] (std::size_t size, void *place)
 

Private Attributes

std::vector< Vector< T, n >
, Protium::Allocation::STLAdapter
< Vector< T, n > > > 
fComponents
 Data implementation. More...
 

Additional Inherited Members

- Public Types inherited from Protium::Allocation::SmallObjectBase< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >
typedef
Protium::Allocation::SmallObjectAllocator
< ThreadingModel, chunkSize,
maxSmallObjectSize,
objectAlignSize,
LifetimePolicy > 
ObjAllocator
 Type of allocator to host the allocator singleton. More...
 
- Protected Member Functions inherited from Protium::Allocation::SmallObject< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >
 SmallObject (void)
 
- Protected Member Functions inherited from Protium::Allocation::SmallObjectBase< ThreadingModel, chunkSize, maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >
 SmallObjectBase (void)
 
 SmallObjectBase (const SmallObjectBase &)
 
 ~SmallObjectBase ()
 
SmallObjectBaseoperator= (const SmallObjectBase &)
 

Detailed Description

template<typename T, int n, int m>
class Protium::LinearAlgebra::Matrix< T, n, m >

Implements matrix addition, subtraction, multiplication.

Definition at line 15 of file Matrix.h.

Constructor & Destructor Documentation

template<typename T, int n, int m>
Protium::LinearAlgebra::Matrix< T, n, m >::Matrix ( )
inline

Default constructor.

Definition at line 123 of file Matrix.h.

template<typename T, int n, int m>
Protium::LinearAlgebra::Matrix< T, n, m >::Matrix ( const Matrix< T, n, m > &  other)
inline

Copy Constructor.

Definition at line 128 of file Matrix.h.

template<typename T, int n, int m>
virtual Protium::LinearAlgebra::Matrix< T, n, m >::~Matrix ( )
inlinevirtual

Default Destructor.

Definition at line 136 of file Matrix.h.

Member Function Documentation

template<typename T, int n, int m>
Vector<T,n> Protium::LinearAlgebra::Matrix< T, n, m >::At ( const int &  row) const
inline

Non-const access operator

Definition at line 154 of file Matrix.h.

template<typename T, int n, int m>
const T& Protium::LinearAlgebra::Matrix< T, n, m >::At ( const int &  row,
const int &  column 
) const
inline

Const Reference operator

Definition at line 160 of file Matrix.h.

template<typename T, int n, int m>
T Protium::LinearAlgebra::Matrix< T, n, m >::GetDeterminant ( ) const
inline

Gets determinant.

Definition at line 179 of file Matrix.h.

template<typename T, int n, int m>
static int Protium::LinearAlgebra::Matrix< T, n, m >::GetNColumns ( )
inlinestatic

Retrieves abcissa dimension.

Definition at line 143 of file Matrix.h.

template<typename T, int n, int m>
static int Protium::LinearAlgebra::Matrix< T, n, m >::GetNRows ( )
inlinestatic

Retrieves ordinant dimension.

Definition at line 141 of file Matrix.h.

template<typename T, int n, int m>
Matrix<T,m-1,n-1> Protium::LinearAlgebra::Matrix< T, n, m >::GetSubMatrix ( const int &  i,
const int &  j 
) const
inline

Get submatrix.

Definition at line 173 of file Matrix.h.

template<typename T, int n, int m>
void Protium::LinearAlgebra::Matrix< T, n, m >::Init ( )
inline

Standard initialization.

Definition at line 118 of file Matrix.h.

template<typename T, int n, int m>
bool Protium::LinearAlgebra::Matrix< T, n, m >::operator!= ( const Matrix< T, n, m > &  rhs) const
inline

Negative comparison operator

Definition at line 301 of file Matrix.h.

template<typename T, int n, int m>
template<int k>
const Matrix<T,n,k> Protium::LinearAlgebra::Matrix< T, n, m >::operator* ( const Matrix< T, m, k > &  rhs) const
inline

Multiplication Operator on the lhs we have this, a matrix of dimensions nxm or m vectors of n length on the rhs, we have a matrix of dimensions mxk or k vectors of m length the product is a vector of size nxk transpose the

Parameters
rhsA vector of same type and size
Returns
constant of vector type

Definition at line 254 of file Matrix.h.

template<typename T, int n, int m>
const Matrix<T,n,m> Protium::LinearAlgebra::Matrix< T, n, m >::operator* ( const T &  rhs) const
inline

Multiplication Operator

Parameters
rhsOf vector type
Returns
Vector of same size and type as current one

Definition at line 267 of file Matrix.h.

template<typename T, int n, int m>
const Vector<T,m> Protium::LinearAlgebra::Matrix< T, n, m >::operator* ( const Vector< T, n > &  rhs)
inline

Vector multiplication operator

Definition at line 273 of file Matrix.h.

template<typename T, int n, int m>
Matrix<T,n,m>& Protium::LinearAlgebra::Matrix< T, n, m >::operator*= ( const T &  rhs)
inline

Operator only defined for multiplying by another type

Definition at line 195 of file Matrix.h.

template<typename T, int n, int m>
Vector<T,m> Protium::LinearAlgebra::Matrix< T, n, m >::operator*= ( const Vector< T, n > &  rhs)
inline

Operator defined for vector multiplication

Definition at line 204 of file Matrix.h.

template<typename T, int n, int m>
template<int k>
Matrix<T,n,k> Protium::LinearAlgebra::Matrix< T, n, m >::operator*= ( const Matrix< T, m, k > &  rhs) const
inline

Inner product operator

Definition at line 215 of file Matrix.h.

template<typename T, int n, int m>
const Matrix<T,n,m> Protium::LinearAlgebra::Matrix< T, n, m >::operator+ ( const Matrix< T, n, m > &  rhs) const
inline

Addition operator

Definition at line 235 of file Matrix.h.

template<typename T, int n, int m>
Matrix<T,n,m>& Protium::LinearAlgebra::Matrix< T, n, m >::operator+= ( const Matrix< T, n, m > &  rhs)
inline

Increment operator

Parameters
rhsMatrix to increment by (increments each element by it's corresponding one)

Definition at line 187 of file Matrix.h.

template<typename T, int n, int m>
const Matrix<T,n,m> Protium::LinearAlgebra::Matrix< T, n, m >::operator- ( const Matrix< T, n, m > &  rhs) const
inline

Subtraction operator

Definition at line 241 of file Matrix.h.

template<typename T, int n, int m>
Matrix<T,n,m>& Protium::LinearAlgebra::Matrix< T, n, m >::operator-= ( const Matrix< T, n, m > &  rhs)
inline

Decrement operator

Definition at line 226 of file Matrix.h.

template<typename T, int n, int m>
Matrix<T,n,m>& Protium::LinearAlgebra::Matrix< T, n, m >::operator= ( const Matrix< T, n, m > &  rhs)
inline

Assignment Operator

Definition at line 284 of file Matrix.h.

template<typename T, int n, int m>
bool Protium::LinearAlgebra::Matrix< T, n, m >::operator== ( const Matrix< T, n, m > &  rhs) const
inline

Comparison operator

Definition at line 291 of file Matrix.h.

template<typename T, int n, int m>
Vector<T, n>& Protium::LinearAlgebra::Matrix< T, n, m >::operator[] ( const int &  row)
inline

Reference Access operator.

Definition at line 147 of file Matrix.h.

template<typename T, int n, int m>
Matrix<T,m,n> Protium::LinearAlgebra::Matrix< T, n, m >::Transpose ( ) const
inline

Computes matrix transpose.

Definition at line 165 of file Matrix.h.

template<typename T, int n, int m>
static Matrix<T,n,m> Protium::LinearAlgebra::Matrix< T, n, m >::Unit ( )
inlinestatic

Produces unit matrix of same dimension

Definition at line 307 of file Matrix.h.

Member Data Documentation

template<typename T, int n, int m>
std::vector< Vector<T,n>, Protium::Allocation::STLAdapter< Vector<T, n> > > Protium::LinearAlgebra::Matrix< T, n, m >::fComponents
private

Data implementation.

Definition at line 114 of file Matrix.h.