# VectorNav C++ Library: vn::math::mat< 4, 4, T > Struct Template Reference

vn::math::mat< 4, 4, T > Struct Template Reference

4x4 matrix specialization. More...

`#include <matrix.h>`

## Public Member Functions

| mat ()
| Creates a new matrix with uninitialized elements.
| mat (T val)
| Creates a new matrix with its elements initialized to val. More...
| mat (T e00v, T e01v, T e02v, T e03v, T e10v, T e11v, T e12v, T e13v, T e20v, T e21v, T e22v, T e23v, T e30v, T e31v, T e32v, T e33v)
| Creates a new matrix with its components intialized to the provided values. More...
| mat (vec< 4, T > col0, vec< 4, T > col1, vec< 4, T > col2, vec< 4, T > col3)
| Constructs a matrix from 4 column vectors. More...
T & | operator() (size_t row, size_t col)
| Indexing into the matrix's elements. More...
const T & | operator() (size_t row, size_t col) const
| Indexing into the matrix's elements. More...
mat | operator- () const
| Negates the matrix. More...
template<typename S >
mat & | operator*= (const S &rhs)
| Multiplies the matrix by a scalar. More...
template<typename S >
mat & | operator*= (const mat< 4, 4, S > &rhs)
| Multiplies the matrix by another matrix. More...
template<typename S >
mat & | operator/= (const S &rhs)
| Divides the matrix by a scalar. More...
template<typename S >
mat & | operator+= (const mat< 4, 4, S > &rhs)
| Adds a matrix to this matrix. More...
template<typename S >
mat & | operator-= (const mat< 4, 4, S > &rhs)
| Subtracts a matrix from this matrix. More...
size_t | dimRow () const
| The matrix's row dimension. More...
size_t | dimCol () const
| The matrix's column dimension. More...
template<typename S >
void | copy (const mat< 4, 4, S > &rhs)
mat | neg () const
| Negates the matrix. More...
mat | mult (const double &scalar) const
| Multiplies the matrix by a scalar. More...
mat | div (const double &scalar) const
| Divides the matrix by a scalar. More...
mat | add (const mat &toAdd) const
| Adds a matrix to this matrix. More...
mat | sub (const mat &toSub) const
| Subtracts a matrix from this matrix. More...
mat< 4, 4, T > | transpose () const
| Transposes the matrix. More...

## Static Public Member Functions

static mat | zero ()
| Matrix with all of its elements set to 0. More...
static mat | one ()
| Matrix with all of its elements set to 1. More...
static mat< 4, 4, T > | identity ()
| Identity matrix with its diagonal elements set to 1. More...

## Public Attributes

union vn::math::mat< 4, 4, T >:: { ... } |
T | e00
| Element 0,0.
T | e10
| Element 1,0.
T | e20
| Element 2,0.
T | e30
| Element 3,0.
T | e01
| Element 0,1.
T | e11
| Element 1,1.
T | e21
| Element 2,1.
T | e31
| Element 3,1.
T | e02
| Element 0,2.
T | e12
| Element 1,2.
T | e22
| Element 2,2.
T | e32
| Element 3,2.
T | e03
| Element 0,3.
T | e13
| Element 1,3.
T | e23
| Element 2,3.
T | e33
| Element 3,3.
T | e [4 *4]
| The matrix's elements.

## Detailed Description

### template<typename T>
struct vn::math::mat< 4, 4, T >

4x4 matrix specialization.

## Constructor & Destructor Documentation

template<typename T >

vn::math::mat< 4, 4, T >::mat | ( | T | val | ) |

inlineexplicit

Creates a new matrix with its elements initialized to val.

Parameters

  [in] | val | The initialization value.

template<typename T >

vn::math::mat< 4, 4, T >::mat | ( | T | e00v,
|  | T | e01v,
|  | T | e02v,
|  | T | e03v,
|  | T | e10v,
|  | T | e11v,
|  | T | e12v,
|  | T | e13v,
|  | T | e20v,
|  | T | e21v,
|  | T | e22v,
|  | T | e23v,
|  | T | e30v,
|  | T | e31v,
|  | T | e32v,
|  | T | e33v
| ) |  |

inline

Creates a new matrix with its components intialized to the provided values.

Parameters

  [in] | e00v | Element 0,0 value.
  [in] | e01v | Element 0,1 value.
  [in] | e02v | Element 0,2 value.
  [in] | e03v | Element 0,3 value.
  [in] | e10v | Element 1,0 value.
  [in] | e11v | Element 1,1 value.
  [in] | e12v | Element 1,2 value.
  [in] | e13v | Element 1,3 value.
  [in] | e20v | Element 2,0 value.
  [in] | e21v | Element 2,1 value.
  [in] | e22v | Element 2,2 value.
  [in] | e23v | Element 2,3 value.
  [in] | e30v | Element 3,0 value.
  [in] | e31v | Element 3,1 value.
  [in] | e32v | Element 3,2 value.
  [in] | e33v | Element 3,3 value.

template<typename T >

vn::math::mat< 4, 4, T >::mat | ( | vec< 4, T > | col0,
|  | vec< 4, T > | col1,
|  | vec< 4, T > | col2,
|  | vec< 4, T > | col3
| ) |  |

inline

Constructs a matrix from 4 column vectors.

Parameters

  [in] | col0 | The 0 column vector.
  [in] | col1 | The 1 column vector.
  [in] | col2 | The 2 column vector.
  [in] | col3 | The 3 column vector.

## Member Function Documentation

template<typename T >

mat vn::math::mat< 4, 4, T >::add | ( | const mat< 4, 4, T > & | toAdd | ) | const

inline

Adds a matrix to this matrix.

Parameters

  [in] | toAdd | The matrix to add.

Returns
  The resulting matrix.

template<typename T >

size_t vn::math::mat< 4, 4, T >::dimCol | ( |  | ) | const

inline

The matrix's column dimension.

Returns
  The matrix's column dimension.

template<typename T >

size_t vn::math::mat< 4, 4, T >::dimRow | ( |  | ) | const

inline

The matrix's row dimension.

Returns
  The matrix's row dimension.

template<typename T >

mat vn::math::mat< 4, 4, T >::div | ( | const double & | scalar | ) | const

inline

Divides the matrix by a scalar.

Parameters

  [in] | scalar | The scalar value.

Returns
  The divided matrix.

template<typename T >

static mat<4, 4, T> vn::math::mat< 4, 4, T >::identity | ( |  | ) |

inlinestatic

Identity matrix with its diagonal elements set to 1.

Returns
  The identity matrix.

template<typename T >

mat vn::math::mat< 4, 4, T >::mult | ( | const double & | scalar | ) | const

inline

Multiplies the matrix by a scalar.

Parameters

  [in] | scalar | The scalar value.

Returns
  The multiplied matrix.

template<typename T >

mat vn::math::mat< 4, 4, T >::neg | ( |  | ) | const

inline

Negates the matrix.

Returns
  The negated matrix.

template<typename T >

static mat vn::math::mat< 4, 4, T >::one | ( |  | ) |

inlinestatic

Matrix with all of its elements set to 1.

Returns
  The 1 matrix.

template<typename T >

T& vn::math::mat< 4, 4, T >::operator() | ( | size_t | row,
|  | size_t | col
| ) |  |

inline

Indexing into the matrix's elements.

Parameters

  [in] | row | The 0-based index row.
  [in] | col | The 0-based index column.

Returns
  The requested element.

template<typename T >

const T& vn::math::mat< 4, 4, T >::operator() | ( | size_t | row,
|  | size_t | col
| ) |  | const

inline

Indexing into the matrix's elements.

Parameters

  [in] | row | The 0-based index row.
  [in] | col | The 0-based index column.

Returns
  The requested element.

template<typename T >
template<typename S >

mat& vn::math::mat< 4, 4, T >::operator*= | ( | const S & | rhs | ) |

inline

Multiplies the matrix by a scalar.

Parameters

  [in] | rhs | The scalar.

Returns
  The multiplied matrix.

template<typename T >
template<typename S >

mat& vn::math::mat< 4, 4, T >::operator*= | ( | const mat< 4, 4, S > & | rhs | ) |

inline

Multiplies the matrix by another matrix.

Parameters

  [in] | rhs | The other matrix.

Returns
  The multiplied matrix.

template<typename T >
template<typename S >

mat& vn::math::mat< 4, 4, T >::operator+= | ( | const mat< 4, 4, S > & | rhs | ) |

inline

Adds a matrix to this matrix.

Parameters

  [in] | rhs | The right-side vector.

Returns
  The resulting vector.

template<typename T >

mat vn::math::mat< 4, 4, T >::operator- | ( |  | ) | const

inline

Negates the matrix.

Returns
  The negated matrix.

template<typename T >
template<typename S >

mat& vn::math::mat< 4, 4, T >::operator-= | ( | const mat< 4, 4, S > & | rhs | ) |

inline

Subtracts a matrix from this matrix.

Parameters

  [in] | rhs | The right-side matrix.

Returns
  The resulting matrix.

template<typename T >
template<typename S >

mat& vn::math::mat< 4, 4, T >::operator/= | ( | const S & | rhs | ) |

inline

Divides the matrix by a scalar.

Parameters

  [in] | rhs | The scalar.

Returns
  The divided matrix.

template<typename T >

mat vn::math::mat< 4, 4, T >::sub | ( | const mat< 4, 4, T > & | toSub | ) | const

inline

Subtracts a matrix from this matrix.

Parameters

  [in] | toSub | The matrix to subtract from this.

Returns
  The resulting matrix.

template<typename T >

mat<4, 4, T> vn::math::mat< 4, 4, T >::transpose | ( |  | ) | const

inline

Transposes the matrix.

Returns
  The computed transpose.

template<typename T >

static mat vn::math::mat< 4, 4, T >::zero | ( |  | ) |

inlinestatic

Matrix with all of its elements set to 0.

Returns
  The 0 matrix.

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

- include/vn/matrix.h