T3DMatrix< T > Class Template Reference
Basic data strctures and functions

a simple 3x3 matrix More...

`#include <mia/3d/matrix.hh>`

Inheritance diagram for T3DMatrix< T >:
[legend]
Collaboration diagram for T3DMatrix< T >:
[legend]

## Public Member Functions

T3DCVector< T > | get_complex_eigenvector (int i) const
T | get_det () const
int | get_eigenvalues (T3DVector< T > &v) const
int | get_rank () const
T3DVector< T > | get_real_eigenvector (int i) const
T3DMatrix< T > & | operator-= (const T3DMatrix< T > &other)
void | print (std::ostream &os) const
| T3DMatrix ()
template<typename I>
| T3DMatrix (const T3DMatrix< I > &o)
| T3DMatrix (const T3DVector< T > &x, const T3DVector< T > &y, const T3DVector< T > &z)
| T3DMatrix (const T3DVector< T3DVector< T > > &other)
T3DMatrix< T > | transposed () const
Public Member Functions inherited from T3DVector< T3DVector< T > >
void | fill (T v)
| Fill the vector elements with value v.
double | norm () const
double | norm2 () const
| square of Euclidian norm of the vector
T3DVector< T > & | operator*= (const double a)
| inplace multiplication
T3DVector< T > & | operator+= (const T3DVector< T > &a)
| inplace addition
T3DVector | operator- () const
T3DVector< T > & | operator-= (const T3DVector< T > &a)
| inplace subtraction
T3DVector< T > & | operator/= (const double a)
| inplace divisison by a scalar
T3DVector< T > & | operator= (const T3DVector< T > &other)=default
| we provide the default copy mechanisms
const T | operator[] (size_t i) const
double | product () const
void | read (std::istream &is)
| read the vector from a formatted string
int | size () const
| T3DVector ()
| standart constructor
void | write (std::ostream &os) const
| print out the formatted vector to the stream
const T3DVector< T > & | xyz () const
| swizzle operator
const T3DVector< T > | xzy () const
| swizzle operator
const T3DVector< T > | yxz () const
| swizzle operator
const T3DVector< T > | yzx () const
| swizzle operator
const T3DVector< T > | zxy () const
| swizzle operator
const T3DVector< T > | zyx () const
| swizzle operator

## Static Public Member Functions

static T3DMatrix< T > | diagonal (const T3DVector< T > &values)
static T3DMatrix< T > | diagonal (T value)

## Static Public Attributes

static const T3DMatrix | _0
| The zero matrix.
static const T3DMatrix | _1
| The unity matrix.
Static Public Attributes inherited from T3DVector< T3DVector< T > >
static T3DVector< T > | _0
| declare the vector (0,0,0)
static T3DVector< T > | _1
| declare the vector (1,1,1)
static const unsigned int | elements
| the number of elements this vector holds (=3)

## Additional Inherited Members

Public Types inherited from T3DVector< T3DVector< T > >
typedef T | value_type
| typedef for generic programming
Data Fields inherited from T3DVector< T3DVector< T > >
T | x
| vector element
T | y
| vector element
T | z
| vector element

## Detailed Description

template<typename T>
class T3DMatrix< T >

a simple 3x3 matrix

This si a simple implementation of a 3x3 matrix that supports the evaluation of certain properties and operations with vectors

Template Parameters

  T | the data type of the elements of the matrix

Definition at line 45 of file 3d/matrix.hh.

## Constructor & Destructor Documentation

## T3DMatrix() [1/4]

template<typename T>

T3DMatrix< T >::T3DMatrix | ( |  | ) |

Referenced by operator-=(), and T3DMatrix().

## T3DMatrix() [2/4]

template<typename T>
template<typename I>

T3DMatrix< T >::T3DMatrix | ( | const T3DMatrix< I > & | o | ) |

Construct a matrix by copying from a differenty typed matrix

Template Parameters

  I | the element type of the original matrix

Parameters

  o | the matrix to be copied

Definition at line 171 of file 3d/matrix.hh.

References T3DMatrix(), T3DVector< T3DVector< T > >::T3DVector(), T3DVector< T3DVector< T > >::x, T3DVector< T3DVector< T > >::y, and T3DVector< T3DVector< T > >::z.

## T3DMatrix() [3/4]

template<typename T>

T3DMatrix< T >::T3DMatrix | ( | const T3DVector< T3DVector< T > > & | other | ) |

Construct the matrix by giving a 3D vector of 3D vectors

Remarks
  This is needed to make transparent use of the T3DVector operators

Parameters

  other | the input matrix

## T3DMatrix() [4/4]

template<typename T>

T3DMatrix< T >::T3DMatrix | ( | const T3DVector< T > & | x,
|  | const T3DVector< T > & | y,
|  | const T3DVector< T > & | z )

Construct the matrix by giving the rows as 3D vectors

Parameters

  x | 1st row
  y | 2st row
  z | 3rd row

## Member Function Documentation

## diagonal() [1/2]

template<typename T>

T3DMatrix< T > T3DMatrix< T >::diagonal | ( | const T3DVector< T > & | values | ) |

static

Create a diagonal matrix

Parameters

  values | the values to set the diagonal elements to a(0,0) = values.x, a(1,1) = values.y, ...

Returns
  a diagonal matrix with the gibe diagonal

## diagonal() [2/2]

template<typename T>

T3DMatrix< T > T3DMatrix< T >::diagonal | ( | T | value | ) |

static

Create a diagonal matrix

Parameters

  value | the value to set the diagonal elements to

Returns
  a diagonal matrix with the gibe diagonal

## get_complex_eigenvector()

template<typename T>

T3DCVector< T > T3DMatrix< T >::get_complex_eigenvector | ( | int | i | ) | const

Calculate the complex eigenvector to a given eigenvalues.

Parameters

  i | number of eigenvector

Returns
  the requested eigenvector

## get_det()

template<typename T>

T T3DMatrix< T >::get_det | ( |  | ) | const

Returns
  the determinat of the matrix

## get_eigenvalues()

template<typename T>

int T3DMatrix< T >::get_eigenvalues | ( | T3DVector< T > & | v | ) | const

calculated the eigenvalues of the matrix using the caracteristic polynome, and Cardans formula

Return values

  result | stores the three eigenvalues, interprete dependend on returns

Returns
  1 one real, two complex eigenvalues, real part = result->y, imaginary part = result->z 2 three real eigenvalues, at least two are equal 3 three distinct real eigenvalues 4 three real eigenvalues, all equal

## get_rank()

template<typename T>

int T3DMatrix< T >::get_rank | ( |  | ) | const

Returns
  the rank of the matrix

## get_real_eigenvector()

template<typename T>

T3DVector< T > T3DMatrix< T >::get_real_eigenvector | ( | int | i | ) | const

Calculate the eigenvector to a given eigenvalues. This function doesn't work for complex valued eigenvectors

Parameters

  i | number of eigenvector

Returns
  the requested eigenvector

## operator-=()

template<typename T>

T3DMatrix< T > & T3DMatrix< T >::operator-= | ( | const T3DMatrix< T > & | other | ) |

inplace subtract

Parameters

  other |

Returns

Definition at line 202 of file 3d/matrix.hh.

References T3DMatrix(), T3DVector< T >::x, T3DVector< T3DVector< T > >::x, T3DVector< T >::y, T3DVector< T3DVector< T > >::y, T3DVector< T >::z, and T3DVector< T3DVector< T > >::z.

## print()

template<typename T>

void T3DMatrix< T >::print | ( | std::ostream & | os | ) | const

print the matrix to an ostream

Parameters

  os | the output stream

Referenced by operator<<().

## transposed()

template<typename T>

T3DMatrix< T > T3DMatrix< T >::transposed | ( |  | ) | const

Returns
  the transposed of this matrix

## Field Documentation

## _0

template<typename T>

const T3DMatrix T3DMatrix< T >::_0

static

The zero matrix.

Definition at line 157 of file 3d/matrix.hh.

## _1

template<typename T>

const T3DMatrix T3DMatrix< T >::_1

static

The unity matrix.

Definition at line 154 of file 3d/matrix.hh.

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

- 3d/matrix.hh