VectorNav C++ Library
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
vn::math::mat< 2, 2, T > Struct Template Reference

2x2 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 e10v, T e11v)
 Creates a new matrix with its components initialized to the provided values. More...
 
 mat (vec< 2, T > col0, vec< 2, T > col1)
 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 >
matoperator*= (const S &rhs)
 Multiplies the matrix by a scalar. More...
 
template<typename S >
matoperator*= (const mat< 2, 2, S > &rhs)
 Multiplies the matrix by another matrix. More...
 
template<typename S >
matoperator/= (const S &rhs)
 Divides the matrix by a scalar. More...
 
template<typename S >
matoperator+= (const mat< 2, 2, S > &rhs)
 Adds a matrix to this matrix. More...
 
template<typename S >
matoperator-= (const mat< 2, 2, 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< 2, 2, 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< 2, 2, 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< 2, 2, T > identity ()
 Identity matrix with its diagonal elements set to 1. More...
 

Public Attributes

union vn::math::mat< 2, 2, T >:: { ... }  
 
e00
 Element 0,0.
 
e10
 Element 1,0.
 
e01
 Element 0,1.
 
e11
 Element 1,1.
 
e [2 *2]
 The matrix's elements.
 

Detailed Description

template<typename T>
struct vn::math::mat< 2, 2, T >

2x2 matrix specialization.

Constructor & Destructor Documentation

template<typename T >
vn::math::mat< 2, 2, T >::mat ( val)
inlineexplicit

Creates a new matrix with its elements initialized to val.

Parameters
[in]valThe initialization value.
template<typename T >
vn::math::mat< 2, 2, T >::mat ( e00v,
e01v,
e10v,
e11v 
)
inline

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

Parameters
[in]e00vElement 0,0 value.
[in]e01vElement 0,1 value.
[in]e10vElement 1,0 value.
[in]e11vElement 1,1 value.
template<typename T >
vn::math::mat< 2, 2, T >::mat ( vec< 2, T >  col0,
vec< 2, T >  col1 
)
inline

Constructs a matrix from 4 column vectors.

Parameters
[in]col0The 0 column vector.
[in]col1The 1 column vector.
[in]col2The 2 column vector.
[in]col3The 3 column vector.

Member Function Documentation

template<typename T >
mat vn::math::mat< 2, 2, T >::add ( const mat< 2, 2, T > &  toAdd) const
inline

Adds a matrix to this matrix.

Parameters
[in]toAddThe matrix to add.
Returns
The resulting matrix.
template<typename T >
size_t vn::math::mat< 2, 2, T >::dimCol ( ) const
inline

The matrix's column dimension.

Returns
The matrix's column dimension.
template<typename T >
size_t vn::math::mat< 2, 2, T >::dimRow ( ) const
inline

The matrix's row dimension.

Returns
The matrix's row dimension.
template<typename T >
mat vn::math::mat< 2, 2, T >::div ( const double &  scalar) const
inline

Divides the matrix by a scalar.

Parameters
[in]scalarThe scalar value.
Returns
The divided matrix.
template<typename T >
static mat<2, 2, T> vn::math::mat< 2, 2, T >::identity ( )
inlinestatic

Identity matrix with its diagonal elements set to 1.

Returns
The identity matrix.
template<typename T >
mat vn::math::mat< 2, 2, T >::mult ( const double &  scalar) const
inline

Multiplies the matrix by a scalar.

Parameters
[in]scalarThe scalar value.
Returns
The multiplied matrix.
template<typename T >
mat vn::math::mat< 2, 2, T >::neg ( ) const
inline

Negates the matrix.

Returns
The negated matrix.
template<typename T >
static mat vn::math::mat< 2, 2, T >::one ( )
inlinestatic

Matrix with all of its elements set to 1.

Returns
The 1 matrix.
template<typename T >
T& vn::math::mat< 2, 2, T >::operator() ( size_t  row,
size_t  col 
)
inline

Indexing into the matrix's elements.

Parameters
[in]rowThe 0-based index row.
[in]colThe 0-based index column.
Returns
The requested element.
template<typename T >
const T& vn::math::mat< 2, 2, T >::operator() ( size_t  row,
size_t  col 
) const
inline

Indexing into the matrix's elements.

Parameters
[in]rowThe 0-based index row.
[in]colThe 0-based index column.
Returns
The requested element.
template<typename T >
template<typename S >
mat& vn::math::mat< 2, 2, T >::operator*= ( const S &  rhs)
inline

Multiplies the matrix by a scalar.

Parameters
[in]rhsThe scalar.
Returns
The multiplied matrix.
template<typename T >
template<typename S >
mat& vn::math::mat< 2, 2, T >::operator*= ( const mat< 2, 2, S > &  rhs)
inline

Multiplies the matrix by another matrix.

Parameters
[in]rhsThe other matrix.
Returns
The multiplied matrix.
template<typename T >
template<typename S >
mat& vn::math::mat< 2, 2, T >::operator+= ( const mat< 2, 2, S > &  rhs)
inline

Adds a matrix to this matrix.

Parameters
[in]rhsThe right-side vector.
Returns
The resulting vector.
template<typename T >
mat vn::math::mat< 2, 2, T >::operator- ( ) const
inline

Negates the matrix.

Returns
The negated matrix.
template<typename T >
template<typename S >
mat& vn::math::mat< 2, 2, T >::operator-= ( const mat< 2, 2, S > &  rhs)
inline

Subtracts a matrix from this matrix.

Parameters
[in]rhsThe right-side matrix.
Returns
The resulting matrix.
template<typename T >
template<typename S >
mat& vn::math::mat< 2, 2, T >::operator/= ( const S &  rhs)
inline

Divides the matrix by a scalar.

Parameters
[in]rhsThe scalar.
Returns
The divided matrix.
template<typename T >
mat vn::math::mat< 2, 2, T >::sub ( const mat< 2, 2, T > &  toSub) const
inline

Subtracts a matrix from this matrix.

Parameters
[in]toSubThe matrix to subtract from this.
Returns
The resulting matrix.
template<typename T >
mat<2, 2, T> vn::math::mat< 2, 2, T >::transpose ( ) const
inline

Transposes the matrix.

Returns
The computed transpose.
template<typename T >
static mat vn::math::mat< 2, 2, 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: