FlightGear next
JSBSim::FGMatrix33 Class Reference

Handles matrix math operations. More...

#include <FGMatrix33.h>

Public Types

enum  { eRows = 3 , eColumns = 3 }
 

Public Member Functions

 FGMatrix33 (void)
 Default initializer.
 
 FGMatrix33 (const FGMatrix33 &M)
 Copy constructor.
 
 FGMatrix33 (const double m11, const double m12, const double m13, const double m21, const double m22, const double m23, const double m31, const double m32, const double m33)
 Initialization by given values.
 
 ~FGMatrix33 (void)
 Destructor.
 
std::string Dump (const std::string &delimeter) const
 Prints the contents of the matrix.
 
std::string Dump (const std::string &delimiter, const std::string &prefix) const
 Prints the contents of the matrix.
 
double operator() (unsigned int row, unsigned int col) const
 Read access the entries of the matrix.
 
double & operator() (unsigned int row, unsigned int col)
 Write access the entries of the matrix.
 
double Entry (unsigned int row, unsigned int col) const
 Read access the entries of the matrix.
 
double & Entry (unsigned int row, unsigned int col)
 Write access the entries of the matrix.
 
unsigned int Rows (void) const
 Number of rows in the matrix.
 
unsigned int Cols (void) const
 Number of cloumns in the matrix.
 
FGMatrix33 Transposed (void) const
 Transposed matrix.
 
void T (void)
 Transposes this matrix.
 
void InitMatrix (void)
 Initialize the matrix.
 
void InitMatrix (const double m11, const double m12, const double m13, const double m21, const double m22, const double m23, const double m31, const double m32, const double m33)
 Initialize the matrix.
 
FGQuaternion GetQuaternion (void) const
 Returns the quaternion associated with this direction cosine (rotation) matrix.
 
FGColumnVector3 GetEuler () const
 Returns the Euler angle column vector associated with this matrix.
 
double Determinant (void) const
 Determinant of the matrix.
 
bool Invertible (void) const
 Return if the matrix is invertible.
 
FGMatrix33 Inverse (void) const
 Return the inverse of the matrix.
 
FGMatrix33operator= (const FGMatrix33 &A)
 Assignment operator.
 
FGMatrix33operator= (std::initializer_list< double > lv)
 Assignment operator.
 
FGColumnVector3 operator* (const FGColumnVector3 &v) const
 Matrix vector multiplication.
 
FGMatrix33 operator- (const FGMatrix33 &B) const
 Matrix subtraction.
 
FGMatrix33 operator+ (const FGMatrix33 &B) const
 Matrix addition.
 
FGMatrix33 operator* (const FGMatrix33 &B) const
 Matrix product.
 
FGMatrix33 operator* (const double scalar) const
 Multiply the matrix with a scalar.
 
FGMatrix33 operator/ (const double scalar) const
 Multiply the matrix with 1.0/scalar.
 
FGMatrix33operator-= (const FGMatrix33 &B)
 In place matrix subtraction.
 
FGMatrix33operator+= (const FGMatrix33 &B)
 In place matrix addition.
 
FGMatrix33operator*= (const FGMatrix33 &B)
 In place matrix multiplication.
 
FGMatrix33operator*= (const double scalar)
 In place matrix scale.
 
FGMatrix33operator/= (const double scalar)
 In place matrix scale.
 

Detailed Description

Handles matrix math operations.

Author
Tony Peden, Jon Berndt, Mathias Froelich

Definition at line 69 of file FGMatrix33.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
eRows 
eColumns 

Definition at line 73 of file FGMatrix33.h.

Constructor & Destructor Documentation

◆ FGMatrix33() [1/3]

JSBSim::FGMatrix33::FGMatrix33 ( void )

Default initializer.

Create a zero matrix.

Definition at line 58 of file FGMatrix33.cpp.

◆ FGMatrix33() [2/3]

JSBSim::FGMatrix33::FGMatrix33 ( const FGMatrix33 & M)
inline

Copy constructor.

Parameters
MMatrix which is used for initialization.

Create copy of the matrix given in the argument.

Definition at line 90 of file FGMatrix33.h.

◆ FGMatrix33() [3/3]

JSBSim::FGMatrix33::FGMatrix33 ( const double m11,
const double m12,
const double m13,
const double m21,
const double m22,
const double m23,
const double m31,
const double m32,
const double m33 )
inline

Initialization by given values.

Parameters
m11value of the 1,1 Matrix element.
m12value of the 1,2 Matrix element.
m13value of the 1,3 Matrix element.
m21value of the 2,1 Matrix element.
m22value of the 2,2 Matrix element.
m23value of the 2,3 Matrix element.
m31value of the 3,1 Matrix element.
m32value of the 3,2 Matrix element.
m33value of the 3,3 Matrix element.

Create a matrix from the doubles given in the arguments.

Definition at line 117 of file FGMatrix33.h.

◆ ~FGMatrix33()

JSBSim::FGMatrix33::~FGMatrix33 ( void )
inline

Destructor.

Definition at line 134 of file FGMatrix33.h.

Member Function Documentation

◆ Cols()

unsigned int JSBSim::FGMatrix33::Cols ( void ) const
inline

Number of cloumns in the matrix.

Returns
the number of columns in the matrix.

Definition at line 214 of file FGMatrix33.h.

◆ Determinant()

double JSBSim::FGMatrix33::Determinant ( void ) const

Determinant of the matrix.

Returns
the determinant of the matrix.

Definition at line 221 of file FGMatrix33.cpp.

◆ Dump() [1/2]

std::string JSBSim::FGMatrix33::Dump ( const std::string & delimeter) const

Prints the contents of the matrix.

Parameters
delimeterthe item separator (tab or comma)
Returns
a string with the delimeter-separated contents of the matrix

◆ Dump() [2/2]

std::string JSBSim::FGMatrix33::Dump ( const std::string & delimiter,
const std::string & prefix ) const

Prints the contents of the matrix.

Parameters
delimeterthe item separator (tab or comma, etc.)
prefixan additional prefix that is used to indent the 3X3 matrix printout
Returns
a string with the delimeter-separated contents of the matrix

◆ Entry() [1/2]

double & JSBSim::FGMatrix33::Entry ( unsigned int row,
unsigned int col )
inline

Write access the entries of the matrix.

This function is just a shortcut for the double& operator()(unsigned int row, unsigned int col) function. It is used internally to access the elements in a more convenient way.

Note that the indices given in the arguments are unchecked.

Parameters
rowRow index.
colColumn index.
Returns
a reference to the matrix entry at the given row and column indices. Indices are counted starting with 1.

Definition at line 202 of file FGMatrix33.h.

◆ Entry() [2/2]

double JSBSim::FGMatrix33::Entry ( unsigned int row,
unsigned int col ) const
inline

Read access the entries of the matrix.

This function is just a shortcut for the double& operator()(unsigned int row, unsigned int col) function. It is used internally to access the elements in a more convenient way.

Note that the indices given in the arguments are unchecked.

Parameters
rowRow index.
colColumn index.
Returns
the value of the matrix entry at the given row and column indices. Indices are counted starting with 1.

Definition at line 185 of file FGMatrix33.h.

◆ GetEuler()

FGColumnVector3 JSBSim::FGMatrix33::GetEuler ( void ) const

Returns the Euler angle column vector associated with this matrix.

Definition at line 159 of file FGMatrix33.cpp.

◆ GetQuaternion()

FGQuaternion JSBSim::FGMatrix33::GetQuaternion ( void ) const

Returns the quaternion associated with this direction cosine (rotation) matrix.

Definition at line 106 of file FGMatrix33.cpp.

◆ InitMatrix() [1/2]

void JSBSim::FGMatrix33::InitMatrix ( const double m11,
const double m12,
const double m13,
const double m21,
const double m22,
const double m23,
const double m31,
const double m32,
const double m33 )
inline

Initialize the matrix.

This function initializes a matrix to user specified values.

Definition at line 240 of file FGMatrix33.h.

◆ InitMatrix() [2/2]

void JSBSim::FGMatrix33::InitMatrix ( void )

Initialize the matrix.

This function initializes a matrix to all 0.0.

Definition at line 259 of file FGMatrix33.cpp.

◆ Inverse()

FGMatrix33 JSBSim::FGMatrix33::Inverse ( void ) const

Return the inverse of the matrix.

Computes and returns if the inverse of the matrix. It is computed by Cramers Rule. Also there are no checks performed if the matrix is invertible. If you are not sure that it really is check this with the Invertible() call before.

Definition at line 229 of file FGMatrix33.cpp.

◆ Invertible()

bool JSBSim::FGMatrix33::Invertible ( void ) const
inline

Return if the matrix is invertible.

Checks and returns if the matrix is nonsingular and thus invertible. This is done by simply computing the determinant and check if it is zero. Note that this test does not cover any instabilities caused by nearly singular matirces using finite arithmetics. It only checks exact singularity.

Definition at line 275 of file FGMatrix33.h.

◆ operator()() [1/2]

double & JSBSim::FGMatrix33::operator() ( unsigned int row,
unsigned int col )
inline

Write access the entries of the matrix.

Note that the indices given in the arguments are unchecked.

Parameters
rowRow index.
colColumn index.
Returns
a reference to the matrix entry at the given row and column indices. Indices are counted starting with 1.

Definition at line 168 of file FGMatrix33.h.

◆ operator()() [2/2]

double JSBSim::FGMatrix33::operator() ( unsigned int row,
unsigned int col ) const
inline

Read access the entries of the matrix.

Parameters
rowRow index.
colColumn index.
Returns
the value of the matrix entry at the given row and column indices. Indices are counted starting with 1.

Definition at line 155 of file FGMatrix33.h.

◆ operator*() [1/3]

FGMatrix33 JSBSim::FGMatrix33::operator* ( const double scalar) const

Multiply the matrix with a scalar.

Parameters
scalarscalar factor to multiply with.
Returns
scaled matrix.

Compute and return the product of the current matrix with the scalar value scalar given in the argument.

Definition at line 333 of file FGMatrix33.cpp.

◆ operator*() [2/3]

FGColumnVector3 JSBSim::FGMatrix33::operator* ( const FGColumnVector3 & v) const

Matrix vector multiplication.

Parameters
vvector to multiply with.
Returns
matric vector product.

Compute and return the product of the current matrix with the vector given in the argument.

Definition at line 481 of file FGMatrix33.cpp.

◆ operator*() [3/3]

FGMatrix33 JSBSim::FGMatrix33::operator* ( const FGMatrix33 & B) const

Matrix product.

Parameters
Bmatrix to add to.
Returns
product of the matrices.

Compute and return the product of the current matrix and the matrix B given in the argument.

Definition at line 380 of file FGMatrix33.cpp.

◆ operator*=() [1/2]

FGMatrix33 & JSBSim::FGMatrix33::operator*= ( const double scalar)

In place matrix scale.

Parameters
scalarscalar value to multiply with.
Returns
reference to the current matrix.

Compute the product of the current matrix and the scalar value scalar given in the argument.

Definition at line 363 of file FGMatrix33.cpp.

◆ operator*=() [2/2]

FGMatrix33 & JSBSim::FGMatrix33::operator*= ( const FGMatrix33 & B)

In place matrix multiplication.

Parameters
Bmatrix to multiply with.
Returns
reference to the current matrix.

Compute the product of the current matrix and the matrix B given in the argument.

Definition at line 399 of file FGMatrix33.cpp.

◆ operator+()

FGMatrix33 JSBSim::FGMatrix33::operator+ ( const FGMatrix33 & B) const

Matrix addition.

Parameters
Bmatrix to add to.
Returns
sum of the matrices.

Compute and return the sum of the current matrix and the matrix B given in the argument.

Definition at line 301 of file FGMatrix33.cpp.

◆ operator+=()

FGMatrix33 & JSBSim::FGMatrix33::operator+= ( const FGMatrix33 & B)

In place matrix addition.

Parameters
Bmatrix to add.
Returns
reference to the current matrix.

Compute the sum of the current matrix and the matrix B given in the argument.

Definition at line 316 of file FGMatrix33.cpp.

◆ operator-()

FGMatrix33 JSBSim::FGMatrix33::operator- ( const FGMatrix33 & B) const

Matrix subtraction.

Parameters
Bmatrix to add to.
Returns
difference of the matrices.

Compute and return the sum of the current matrix and the matrix B given in the argument.

Definition at line 269 of file FGMatrix33.cpp.

◆ operator-=()

FGMatrix33 & JSBSim::FGMatrix33::operator-= ( const FGMatrix33 & B)

In place matrix subtraction.

Parameters
Bmatrix to subtract.
Returns
reference to the current matrix.

Compute the diffence from the current matrix and the matrix B given in the argument.

Definition at line 284 of file FGMatrix33.cpp.

◆ operator/()

FGMatrix33 JSBSim::FGMatrix33::operator/ ( const double scalar) const

Multiply the matrix with 1.0/scalar.

Parameters
scalarscalar factor to divide through.
Returns
scaled matrix.

Compute and return the product of the current matrix with the scalar value 1.0/scalar, where scalar is given in the argument.

Definition at line 424 of file FGMatrix33.cpp.

◆ operator/=()

FGMatrix33 & JSBSim::FGMatrix33::operator/= ( const double scalar)

In place matrix scale.

Parameters
scalarscalar value to divide through.
Returns
reference to the current matrix.

Compute the product of the current matrix and the scalar value 1.0/scalar, where scalar is given in the argument.

Definition at line 444 of file FGMatrix33.cpp.

◆ operator=() [1/2]

FGMatrix33 & JSBSim::FGMatrix33::operator= ( const FGMatrix33 & A)
inline

Assignment operator.

Parameters
Asource matrix.

Copy the content of the matrix given in the argument into *this.

Definition at line 291 of file FGMatrix33.h.

◆ operator=() [2/2]

FGMatrix33 & JSBSim::FGMatrix33::operator= ( std::initializer_list< double > lv)
inline

Assignment operator.

Parameters
lvinitializer list of at most 9 values.

Copy the content of the list into *this.

Definition at line 310 of file FGMatrix33.h.

◆ Rows()

unsigned int JSBSim::FGMatrix33::Rows ( void ) const
inline

Number of rows in the matrix.

Returns
the number of rows in the matrix.

Definition at line 209 of file FGMatrix33.h.

◆ T()

void JSBSim::FGMatrix33::T ( void )

Transposes this matrix.

This function only transposes this matrix. Nothing is returned.

Definition at line 462 of file FGMatrix33.cpp.

◆ Transposed()

FGMatrix33 JSBSim::FGMatrix33::Transposed ( void ) const
inline

Transposed matrix.

This function only returns the transpose of this matrix. This matrix itself remains unchanged.

Returns
the transposed matrix.

Definition at line 221 of file FGMatrix33.h.


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