Fully featured I2C and SPI driver for CEVA (Hilcrest)'s BNO080 and FSM300 Inertial Measurement Units.

Dependents:   BNO080-Examples BNO080-Examples

Embed: (wiki syntax)

« Back to documentation index

BasicMatrix< Rows, Cols, value_type > Class Template Reference

BasicMatrix< Rows, Cols, value_type > Class Template Reference

Base class implementing standard matrix functionality. More...

#include <tmatrix.h>

Inherited by BasicIndexMatrix< Rows, Cols, value_type >, BasicIndexMatrix< 1, 1, value_type >, BasicIndexMatrix< 2, 1, value_type >, BasicIndexMatrix< 3, 1, value_type >, and BasicIndexMatrix< 4, 1, value_type >.

Public Member Functions

template<uint16_t RhsCols>
TMatrix< Rows, RhsCols,
value_type > 
operator* (const TMatrix< Cols, RhsCols, value_type > &rhs) const
 Matrix multiplication operator.
TMatrix< Rows, Cols, value_type > operator+ (const TMatrix< Rows, Cols, value_type > &rhs) const
 Element-wise addition operator.
TMatrix< Rows, Cols, value_type > operator- (const TMatrix< Rows, Cols, value_type > &rhs) const
 Element-wise subtraction operator.
TMatrix< Rows, Cols, value_type > operator* (value_type s) const
 Scalar multiplication operator.
TMatrix< Rows, Cols, value_type > operator/ (value_type s) const
 Scalar division operator.
TMatrix< Rows, Cols, value_type > operator- (void) const
 Unary negation operator.
TMatrix< Cols, Rows, value_type > transpose (void) const
 Returns the matrix transpose of this matrix.
value_type sum (void) const
 Returns the sum of the matrix entries.
value_type sumLog (void) const
 Returns the sum of the log of the matrix entries.
TMatrix< Rows, Cols, value_type > recip (void) const
 Returns this vector with its elements replaced by their reciprocals.
TMatrix< Rows, Cols, value_type > pseudoRecip (double epsilon=1e-50) const
 Returns this vector with its elements replaced by their reciprocals, unless a value is less than epsilon, in which case it is left as zero.
bool hasNaN (void) const
 Checks to see if any of this matrix's elements are NaN.

Static Public Member Functions

static TMatrix< Rows, Cols,
value_type > 
identity ()
 Returns an "identity" matrix with dimensions given by the class's template parameters.
static TMatrix< Rows, Cols,
value_type > 
one ()
 Returns a ones matrix with dimensions given by the class's template parameters.
static TMatrix< Rows, Cols,
value_type > 
zero ()
 Returns a zero matrix with dimensions given by the class's template parameters.

Data Fields

TMatrix<(Rows > Cols Cols:Rows
 Returns the diagonal elements of the matrix.

Detailed Description

template<uint16_t Rows, uint16_t Cols, typename value_type = double>
class BasicMatrix< Rows, Cols, value_type >

Base class implementing standard matrix functionality.

Definition at line 251 of file tmatrix.h.


Member Function Documentation

bool hasNaN ( void   ) const

Checks to see if any of this matrix's elements are NaN.

Definition at line 561 of file tmatrix.h.

static TMatrix<Rows, Cols, value_type> identity (  ) [static]

Returns an "identity" matrix with dimensions given by the class's template parameters.

In the case that Rows != Cols, this matrix is simply the one where the Aii elements for i < min(Rows, Cols) are 1, and all other elements are 0.

Returns:
A TMatrix<Rows, Cols, value_type> with off-diagonal elements set to 0, and diagonal elements set to 1.

Definition at line 520 of file tmatrix.h.

static TMatrix<Rows, Cols, value_type> one (  ) [static]

Returns a ones matrix with dimensions given by the class's template parameters.

Returns:
A TMatrix<Rows, Cols, value_type> with all elements set to 1.

Definition at line 535 of file tmatrix.h.

TMatrix<Rows, RhsCols, value_type> operator* ( const TMatrix< Cols, RhsCols, value_type > &  rhs ) const

Matrix multiplication operator.

Returns:
A matrix where result is the matrix product (*this) * rhs.

Definition at line 343 of file tmatrix.h.

TMatrix<Rows, Cols, value_type> operator* ( value_type  s ) const

Scalar multiplication operator.

Returns:
A matrix where result(i,j) = (*this)(i,j) * s.

Definition at line 400 of file tmatrix.h.

TMatrix<Rows, Cols, value_type> operator+ ( const TMatrix< Rows, Cols, value_type > &  rhs ) const

Element-wise addition operator.

Returns:
A matrix where result(i,j) = (*this)(i,j) + rhs(i,j).

Definition at line 374 of file tmatrix.h.

TMatrix<Rows, Cols, value_type> operator- ( void   ) const

Unary negation operator.

Returns:
A matrix where result(i,j) = -(*this)(i,j).

Definition at line 426 of file tmatrix.h.

TMatrix<Rows, Cols, value_type> operator- ( const TMatrix< Rows, Cols, value_type > &  rhs ) const

Element-wise subtraction operator.

Returns:
A matrix where result(i,j) = (*this)(i,j) - rhs(i,j).

Definition at line 387 of file tmatrix.h.

TMatrix<Rows, Cols, value_type> operator/ ( value_type  s ) const

Scalar division operator.

Returns:
A matrix where result(i,j) = (*this)(i,j) / s.

Definition at line 413 of file tmatrix.h.

TMatrix<Rows,Cols, value_type> pseudoRecip ( double  epsilon = 1e-50 ) const

Returns this vector with its elements replaced by their reciprocals, unless a value is less than epsilon, in which case it is left as zero.

This is used mostly for pseudo-inverse computations.

Definition at line 496 of file tmatrix.h.

TMatrix<Rows,Cols, value_type> recip ( void   ) const

Returns this vector with its elements replaced by their reciprocals.

Definition at line 482 of file tmatrix.h.

value_type sum ( void   ) const

Returns the sum of the matrix entries.

Definition at line 468 of file tmatrix.h.

value_type sumLog ( void   ) const

Returns the sum of the log of the matrix entries.

Definition at line 475 of file tmatrix.h.

TMatrix<Cols, Rows, value_type> transpose ( void   ) const

Returns the matrix transpose of this matrix.

Returns:
A TMatrix of dimension Cols by Rows where result(i,j) = (*this)(j,i) for each element.

Definition at line 441 of file tmatrix.h.

static TMatrix<Rows, Cols, value_type> zero (  ) [static]

Returns a zero matrix with dimensions given by the class's template parameters.

Returns:
A TMatrix<Rows, Cols, value_type> containing all 0.

Definition at line 551 of file tmatrix.h.


Field Documentation

TMatrix<(Rows> Cols Cols

Returns the diagonal elements of the matrix.

Returns:
A column vector v with dimension MIN(Rows,Cols) where v[i] = (*this)[i][i].

Definition at line 458 of file tmatrix.h.