Loading...
Searching...
No Matches
RDNumeric::Matrix< TYPE > Class Template Reference

A matrix class for general, non-square matrices. More...

`#include <Matrix.h>`

Inheritance diagram for RDNumeric::Matrix< TYPE >:

## Public Types

typedef boost::shared_array< TYPE > | DATA_SPTR

## Public Member Functions

| Matrix (unsigned int nRows, unsigned int nCols)
| Initialize with a size.
| Matrix (unsigned int nRows, unsigned int nCols, TYPE val)
| Initialize with a size and default value.
| Matrix (unsigned int nRows, unsigned int nCols, DATA_SPTR data)
| Initialize from a pointer.
| Matrix (const Matrix< TYPE > &other)
| copy constructor
virtual | ~Matrix ()
unsigned int | numRows () const
| returns the number of rows
unsigned int | numCols () const
| returns the number of columns
unsigned int | getDataSize () const
virtual TYPE | getVal (unsigned int i, unsigned int j) const
| returns a particular element of the matrix
virtual void | setVal (unsigned int i, unsigned int j, TYPE val)
| sets a particular element of the matrix
virtual TYPE | getValUnchecked (unsigned int i, unsigned int j) const
| returns a particular element of the matrix
virtual void | setValUnchecked (unsigned int i, unsigned int j, TYPE val)
| sets a particular element of the matrix
virtual void | getRow (unsigned int i, Vector< TYPE > &row) const
| returns a copy of a row of the matrix
virtual void | getCol (unsigned int i, Vector< TYPE > &col) const
| returns a copy of a column of the matrix
TYPE * | getData ()
| returns a pointer to our data array
const TYPE * | getData () const
| returns a const pointer to our data array
Matrix< TYPE > & | assign (const Matrix< TYPE > &other)
| Copy operator.
virtual Matrix< TYPE > & | operator+= (const Matrix< TYPE > &other)
| Matrix addition.
virtual Matrix< TYPE > & | operator-= (const Matrix< TYPE > &other)
| Matrix subtraction.
virtual Matrix< TYPE > & | operator*= (TYPE scale)
| Multiplication by a scalar.
virtual Matrix< TYPE > & | operator/= (TYPE scale)
| division by a scalar
virtual Matrix< TYPE > & | transpose (Matrix< TYPE > &transpose) const
| copies the transpose of this Matrix into another, returns the result

## Protected Member Functions

| Matrix ()

## Protected Attributes

unsigned int | d_nRows {0}
unsigned int | d_nCols {0}
unsigned int | d_dataSize {0}
DATA_SPTR | d_data

## Detailed Description

template<class TYPE>
class RDNumeric::Matrix< TYPE >

A matrix class for general, non-square matrices.

Definition at line 29 of file Matrix.h.

## Member Typedef Documentation

## DATA_SPTR

template<class TYPE>

typedef boost::shared_array<TYPE> RDNumeric::Matrix< TYPE >::DATA_SPTR

Definition at line 31 of file Matrix.h.

## Constructor & Destructor Documentation

## Matrix() [1/5]

template<class TYPE>

RDNumeric::Matrix< TYPE >::Matrix | ( | unsigned int | nRows,
|  | unsigned int | nCols )

inline

Initialize with a size.

Definition at line 34 of file Matrix.h.

## Matrix() [2/5]

template<class TYPE>

RDNumeric::Matrix< TYPE >::Matrix | ( | unsigned int | nRows,
|  | unsigned int | nCols,
|  | TYPE | val )

inline

Initialize with a size and default value.

Definition at line 42 of file Matrix.h.

## Matrix() [3/5]

template<class TYPE>

RDNumeric::Matrix< TYPE >::Matrix | ( | unsigned int | nRows,
|  | unsigned int | nCols,
|  | DATA_SPTR | data )

inline

Initialize from a pointer.

NOTE: this does not take ownership of the data, if you delete the data externally, this Matrix will be sad.

Definition at line 57 of file Matrix.h.

## Matrix() [4/5]

template<class TYPE>

RDNumeric::Matrix< TYPE >::Matrix | ( | const Matrix< TYPE > & | other | ) |

inline

copy constructor

We make a copy of the other vector's data.

Definition at line 65 of file Matrix.h.

## ~Matrix()

template<class TYPE>

virtual RDNumeric::Matrix< TYPE >::~Matrix | ( |  | ) |

inline virtual

Definition at line 76 of file Matrix.h.

## Matrix() [5/5]

template<class TYPE>

RDNumeric::Matrix< TYPE >::Matrix | ( |  | ) |

inline protected

Definition at line 245 of file Matrix.h.

## Member Function Documentation

## assign()

template<class TYPE>

Matrix< TYPE > & RDNumeric::Matrix< TYPE >::assign | ( | const Matrix< TYPE > & | other | ) |

inline

Copy operator.

We make a copy of the other Matrix's data.

Definition at line 150 of file Matrix.h.

## getCol()

template<class TYPE>

virtual void RDNumeric::Matrix< TYPE >::getCol | ( | unsigned int | i,
|  | Vector< TYPE > & | col ) const

inline virtual

returns a copy of a column of the matrix

Definition at line 128 of file Matrix.h.

## getData() [1/2]

template<class TYPE>

TYPE * RDNumeric::Matrix< TYPE >::getData | ( |  | ) |

inline

returns a pointer to our data array

Definition at line 141 of file Matrix.h.

Referenced by RDNumeric::Matrix< double >::assign(), RDNumeric::Matrix< double >::Matrix(), RDNumeric::multiply(), RDNumeric::multiply(), RDNumeric::SquareMatrix< double >::operator*=(), RDNumeric::Matrix< double >::operator+=(), and RDNumeric::Matrix< double >::operator-=().

## getData() [2/2]

template<class TYPE>

const TYPE * RDNumeric::Matrix< TYPE >::getData | ( |  | ) | const

inline

returns a const pointer to our data array

Definition at line 144 of file Matrix.h.

## getDataSize()

template<class TYPE>

unsigned int RDNumeric::Matrix< TYPE >::getDataSize | ( |  | ) | const

inline

Definition at line 84 of file Matrix.h.

## getRow()

template<class TYPE>

virtual void RDNumeric::Matrix< TYPE >::getRow | ( | unsigned int | i,
|  | Vector< TYPE > & | row ) const

inline virtual

returns a copy of a row of the matrix

Definition at line 117 of file Matrix.h.

## getVal()

template<class TYPE>

virtual TYPE RDNumeric::Matrix< TYPE >::getVal | ( | unsigned int | i,
|  | unsigned int | j ) const

inline virtual

returns a particular element of the matrix

Definition at line 87 of file Matrix.h.

Referenced by operator<<().

## getValUnchecked()

template<class TYPE>

virtual TYPE RDNumeric::Matrix< TYPE >::getValUnchecked | ( | unsigned int | i,
|  | unsigned int | j ) const

inline virtual

returns a particular element of the matrix

Definition at line 104 of file Matrix.h.

## numCols()

template<class TYPE>

unsigned int RDNumeric::Matrix< TYPE >::numCols | ( |  | ) | const

inline

returns the number of columns

Definition at line 82 of file Matrix.h.

Referenced by RDNumeric::Matrix< double >::assign(), RDNumeric::multiply(), RDNumeric::multiply(), RDNumeric::Matrix< double >::operator+=(), RDNumeric::Matrix< double >::operator-=(), and operator<<().

## numRows()

template<class TYPE>

unsigned int RDNumeric::Matrix< TYPE >::numRows | ( |  | ) | const

inline

returns the number of rows

Definition at line 79 of file Matrix.h.

Referenced by RDNumeric::Matrix< double >::assign(), RDNumeric::multiply(), RDNumeric::multiply(), RDNumeric::SquareMatrix< double >::operator*=(), RDNumeric::Matrix< double >::operator+=(), RDNumeric::Matrix< double >::operator-=(), and operator<<().

## operator*=()

template<class TYPE>

virtual Matrix< TYPE > & RDNumeric::Matrix< TYPE >::operator*= | ( | TYPE | scale | ) |

inline virtual

Multiplication by a scalar.

Reimplemented in RDNumeric::SquareMatrix< TYPE >, and RDNumeric::SquareMatrix< double >.

Definition at line 197 of file Matrix.h.

Referenced by RDNumeric::SquareMatrix< double >::operator*=().

## operator+=()

template<class TYPE>

virtual Matrix< TYPE > & RDNumeric::Matrix< TYPE >::operator+= | ( | const Matrix< TYPE > & | other | ) |

inline virtual

Matrix addition.

Perform a element by element addition of other Matrix to this Matrix

Definition at line 165 of file Matrix.h.

## operator-=()

template<class TYPE>

virtual Matrix< TYPE > & RDNumeric::Matrix< TYPE >::operator-= | ( | const Matrix< TYPE > & | other | ) |

inline virtual

Matrix subtraction.

Perform a element by element subtraction of other Matrix from this Matrix

Definition at line 182 of file Matrix.h.

## operator/=()

template<class TYPE>

virtual Matrix< TYPE > & RDNumeric::Matrix< TYPE >::operator/= | ( | TYPE | scale | ) |

inline virtual

division by a scalar

Definition at line 207 of file Matrix.h.

## setVal()

template<class TYPE>

virtual void RDNumeric::Matrix< TYPE >::setVal | ( | unsigned int | i,
|  | unsigned int | j,
|  | TYPE | val )

inline virtual

sets a particular element of the matrix

Definition at line 95 of file Matrix.h.

## setValUnchecked()

template<class TYPE>

virtual void RDNumeric::Matrix< TYPE >::setValUnchecked | ( | unsigned int | i,
|  | unsigned int | j,
|  | TYPE | val )

inline virtual

sets a particular element of the matrix

Definition at line 110 of file Matrix.h.

## transpose()

template<class TYPE>

virtual Matrix< TYPE > & RDNumeric::Matrix< TYPE >::transpose | ( | Matrix< TYPE > & | transpose | ) | const

inline virtual

copies the transpose of this Matrix into another, returns the result

Parameters

  transpose | the Matrix to store the results

Returns
  the transpose of this matrix. This is just a reference to the argument.

Definition at line 224 of file Matrix.h.

## Member Data Documentation

## d_data

template<class TYPE>

DATA_SPTR RDNumeric::Matrix< TYPE >::d_data

protected

Definition at line 249 of file Matrix.h.

## d_dataSize

template<class TYPE>

unsigned int RDNumeric::Matrix< TYPE >::d_dataSize {0}

protected

Definition at line 248 of file Matrix.h.

## d_nCols

template<class TYPE>

unsigned int RDNumeric::Matrix< TYPE >::d_nCols {0}

protected

Definition at line 247 of file Matrix.h.

## d_nRows

template<class TYPE>

unsigned int RDNumeric::Matrix< TYPE >::d_nRows {0}

protected

Definition at line 246 of file Matrix.h.

The documentation for this class was generated from the following file:

- Matrix.h