Ceylan::Maths::Linear::Matrix2 Class Reference

#include <CeylanMatrix2.h>

Inheritance diagram for Ceylan::Maths::Linear::Matrix2:

Inheritance graph
[legend]
Collaboration diagram for Ceylan::Maths::Linear::Matrix2:

Collaboration graph
[legend]

List of all members.

Public Types

enum  TextOutputFormat { rawText, html }
 Defines what text output formats for TextDisplayable instances are available. More...

Public Member Functions

 Matrix2 (Real x0=0, Real x1=0, Real y0=0, Real y1=0)
 Constructs a new 2x2 matrix with specified elements.
 Matrix2 (const Matrix2 &source)
 Copy constructor.
virtual ~Matrix2 () throw ()
 Basic virtual destructor.
virtual void setTo (Real x0=0, Real x1=0, Real y0=0, Real y1=0)
 Reassigns all matrix elements.
virtual void setColumn (MatrixIndex columnNumber, const Vector2 &newColumn)
 Reassigns specified column of this matrix.
virtual void setAllElementsTo (Real commonValue)
 Sets this matrix so that all its elements equal commonValue.
virtual Real getElementAt (MatrixIndex abscissa, MatrixIndex ordinate) const
 Returns indexed element.
virtual void setElementAt (MatrixIndex abscissa, MatrixIndex ordinate, Real newValue)
 Sets indexed element to specified value.
virtual void setToIdentity ()
 Sets this matrix to the identity matrix.
virtual void setToDiagonal (Real diagonalTerm)
 Sets this matrix to the a diagonal matrix whose diagonal term is diagonalTerm.
virtual void transpose ()
 Tranposes this matrix.
virtual Real trace () const
 Computes this matrix's trace.
virtual Real determinant () const
 Computes this matrix's determinant.
virtual const std::string toString (VerbosityLevels level=high) const
 Returns a user-friendly description of the state of this object.
virtual void nullify ()
 Sets this matrix to the null matrix (all elements zeroed).

Static Public Member Functions

static Matrix2 Cofactor (const Matrix2 &m)
 Returns the cofactor matrix.
static Matrix2 Adjoint (const Matrix2 &m)
 Returns the adjoint matrix.
static Matrix2 CreateFromRotation (AngleInDegrees angle)
 Returns the matrix corresponding to the specified rotation.
template<typename T >
static Matrix2 CreateFrom (T endomorphism)
 Returns the matrix corresponding to specified endomorphism.
static const std::string ToString (std::list< TextDisplayable * > displayables, Ceylan::VerbosityLevels level=Ceylan::high)
 Returns a user-friendly description of this list of pointers to text displayable instances.
static TextOutputFormat GetOutputFormat ()
 Returns the current overall text format to be used by TextDisplayable instances.
static void SetOutputFormat (TextOutputFormat newOutputFormat)
 Sets the current overall text format to be used by TextDisplayable instances.

Static Public Attributes

static const MatrixIndex Dimensions = 2
 Tells what is the dimension for this Matrix.

Protected Attributes

Real _mat [Dimensions][Dimensions]
 The nine coordinates of this matrix.

Static Protected Attributes

static TextOutputFormat _OutputFormat = rawText
 The text format to be used currently by TextDisplayable instances.

Friends

class Bipoint
 Must access to each other's coordinates.
class Vector2
 Must access to each other's coordinates.
CEYLAN_DLL friend bool operator== (const Matrix2 &m1, const Matrix2 &m2)
 Tells whether the two matrices have the same elements.
CEYLAN_DLL friend bool operator!= (const Matrix2 &m1, const Matrix2 &m2)
 Tells whether the two matrices are different.
CEYLAN_DLL friend Matrix2 operator+ (const Matrix2 &m1, const Matrix2 &m2)
 Adds two matrices: result = m1 + m2.
CEYLAN_DLL friend Matrix2 operator- (const Matrix2 &m1, const Matrix2 &m2)
 Substracts two matrices: result = m1 - m2.
CEYLAN_DLL friend Matrix2 operator* (const Matrix2 &m1, const Matrix2 &m2)
 Multiplies two matrices: result = m1 * m2.
CEYLAN_DLL friend Matrix2 operator* (Real lambda, const Matrix2 &m)
 Multiplies a matrix by a scalar: result = lambda * m.
CEYLAN_DLL friend Matrix2 operator! (const Matrix2 &m)
 Returns the inverse (reciproqual) of specified matrix, if possible.
CEYLAN_DLL friend Matrix2 operator~ (const Matrix2 &m)
 Returns the transposed matrix corresponding to this matrix.
CEYLAN_DLL friend Vector2 operator* (const Matrix2 &m, const Vector2 &v)
 Multiplies a matrix by a vector: result = m * v.


Detailed Description

Definition at line 78 of file CeylanMatrix2.h.


Member Enumeration Documentation

Defines what text output formats for TextDisplayable instances are available.

Enumerator:
rawText 
html 

Definition at line 124 of file CeylanTextDisplayable.h.


Constructor & Destructor Documentation

Matrix2::Matrix2 ( Real  x0 = 0,
Real  x1 = 0,
Real  y0 = 0,
Real  y1 = 0 
) [explicit]

Constructs a new 2x2 matrix with specified elements.

Note:
If no argument is specified, constructs the null matrix.

Definition at line 66 of file CeylanMatrix2.cc.

References _mat.

Matrix2::Matrix2 ( const Matrix2 source  ) 

Copy constructor.

Note:
Cannot be 'explicit', as it would prevent the multiply operator Matrix2 m = m1 * m2. to return a Matrix2 on the stack.

Definition at line 78 of file CeylanMatrix2.cc.

References _mat, and Dimensions.

Matrix2::~Matrix2 (  )  throw () [virtual]

Basic virtual destructor.

Definition at line 90 of file CeylanMatrix2.cc.


Member Function Documentation

Matrix2 Matrix2::Adjoint ( const Matrix2 m  )  [static]

Returns the adjoint matrix.

Definition at line 313 of file CeylanMatrix2.cc.

References Cofactor(), and transpose().

Matrix2 Matrix2::Cofactor ( const Matrix2 m  )  [static]

Returns the cofactor matrix.

Definition at line 297 of file CeylanMatrix2.cc.

References _mat.

Referenced by Adjoint().

template<typename T >
static Matrix2 Ceylan::Maths::Linear::Matrix2::CreateFrom ( endomorphism  )  [inline, static]

Returns the matrix corresponding to specified endomorphism.

Parameters:
endomorphism can be a functor (ex: Endomorphism2DFunctor) or a simple function: Vector2 -> Vector.
Note:
C++ does not allow virtual template method.

Definition at line 365 of file CeylanMatrix2.h.

References setColumn(), and Ceylan::Maths::Linear::Vector2::setTo().

Referenced by CreateFromRotation().

Matrix2 Matrix2::CreateFromRotation ( AngleInDegrees  angle  )  [static]

Returns the matrix corresponding to the specified rotation.

Parameters:
angle in degrees

Definition at line 326 of file CeylanMatrix2.cc.

References CreateFrom().

Referenced by Ceylan::Maths::Linear::HomogeneousMatrix3::HomogeneousMatrix3().

Real Matrix2::determinant (  )  const [virtual]

Computes this matrix's determinant.

Implements Ceylan::Maths::Linear::Matrix.

Definition at line 224 of file CeylanMatrix2.cc.

References _mat.

Referenced by Ceylan::Maths::Linear::operator!().

Real Matrix2::getElementAt ( MatrixIndex  abscissa,
MatrixIndex  ordinate 
) const [virtual]

Returns indexed element.

Index ranges from 0 to Dimensions-1 for both dimensions.

Exceptions:
MathsException if index is out of bounds and if in debug mode.

Implements Ceylan::Maths::Linear::Matrix.

Definition at line 130 of file CeylanMatrix2.cc.

References _mat, and Dimensions.

Referenced by Ceylan::Maths::Linear::HomogeneousMatrix3::setRotationMatrix().

TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat (  )  [static, inherited]

void Matrix::nullify (  )  [virtual, inherited]

Sets this matrix to the null matrix (all elements zeroed).

Definition at line 53 of file CeylanMatrix.cc.

References Ceylan::Maths::Linear::Matrix::setAllElementsTo().

void Matrix2::setAllElementsTo ( Real  commonValue  )  [virtual]

Sets this matrix so that all its elements equal commonValue.

Implements Ceylan::Maths::Linear::Matrix.

Definition at line 119 of file CeylanMatrix2.cc.

References _mat, and Dimensions.

void Matrix2::setColumn ( MatrixIndex  columnNumber,
const Vector2 newColumn 
) [virtual]

Reassigns specified column of this matrix.

Note:
Column numbers range from 0 to 2 (included).

Definition at line 109 of file CeylanMatrix2.cc.

References _mat, Ceylan::Maths::Linear::Vector2::_vec, and Dimensions.

Referenced by CreateFrom().

void Matrix2::setElementAt ( MatrixIndex  abscissa,
MatrixIndex  ordinate,
Real  newValue 
) [virtual]

Sets indexed element to specified value.

Index ranges from 0 to Dimensions-1 for both dimensions.

Exceptions:
MathsException if index is out of bounds and if in debug mode.

Implements Ceylan::Maths::Linear::Matrix.

Definition at line 146 of file CeylanMatrix2.cc.

References _mat, and Dimensions.

void TextDisplayable::SetOutputFormat ( TextOutputFormat  newOutputFormat  )  [static, inherited]

Sets the current overall text format to be used by TextDisplayable instances.

Parameters:
newOutputFormat the new output format.

Definition at line 72 of file CeylanTextDisplayable.cc.

References Ceylan::TextDisplayable::_OutputFormat.

Referenced by Ceylan::Log::LogHolder::LogHolder().

void Matrix2::setTo ( Real  x0 = 0,
Real  x1 = 0,
Real  y0 = 0,
Real  y1 = 0 
) [virtual]

Reassigns all matrix elements.

Definition at line 97 of file CeylanMatrix2.cc.

References _mat.

void Matrix2::setToDiagonal ( Real  diagonalTerm  )  [virtual]

Sets this matrix to the a diagonal matrix whose diagonal term is diagonalTerm.

Implements Ceylan::Maths::Linear::Matrix.

Definition at line 171 of file CeylanMatrix2.cc.

References _mat, and Dimensions.

Referenced by setToIdentity().

void Matrix2::setToIdentity (  )  [virtual]

Sets this matrix to the identity matrix.

Reimplemented from Ceylan::Maths::Linear::Matrix.

Definition at line 163 of file CeylanMatrix2.cc.

References setToDiagonal().

const std::string TextDisplayable::ToString ( std::list< TextDisplayable * >  displayables,
Ceylan::VerbosityLevels  level = Ceylan::high 
) [static, inherited]

Returns a user-friendly description of this list of pointers to text displayable instances.

Parameters:
displayables a list of pointers to TextDisplayable instances/
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
toString, Ceylan::VerbosityLevels

Definition at line 45 of file CeylanTextDisplayable.cc.

References Ceylan::formatStringList().

const string Matrix2::toString ( VerbosityLevels  level = high  )  const [virtual]

Returns a user-friendly description of the state of this object.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
TextDisplayable

Reimplemented from Ceylan::Maths::Linear::Matrix.

Definition at line 234 of file CeylanMatrix2.cc.

References _mat, Ceylan::DigitOutputPrecision, Dimensions, Ceylan::Log::LogPlug::error(), Ceylan::TextDisplayable::GetOutputFormat(), Ceylan::TextDisplayable::html, and Ceylan::toString().

Real Matrix2::trace (  )  const [virtual]

Computes this matrix's trace.

Implements Ceylan::Maths::Linear::Matrix.

Definition at line 210 of file CeylanMatrix2.cc.

References _mat, and Dimensions.

void Matrix2::transpose (  )  [virtual]

Tranposes this matrix.

Implements Ceylan::Maths::Linear::Matrix.

Definition at line 182 of file CeylanMatrix2.cc.

References _mat, Dimensions, and generalUtils::temp.

Referenced by Adjoint().


Friends And Related Function Documentation

friend class Bipoint [friend]

Must access to each other's coordinates.

Definition at line 86 of file CeylanMatrix2.h.

CEYLAN_DLL friend Matrix2 operator! ( const Matrix2 m  )  [friend]

Returns the inverse (reciproqual) of specified matrix, if possible.

Exceptions:
LinearException if the matrix is singuler.

CEYLAN_DLL friend bool operator!= ( const Matrix2 m1,
const Matrix2 m2 
) [friend]

Tells whether the two matrices are different.

Note:
Exact comparison of floating point values is meaningless on most cases, hence strict equality is replaced here by relative equality.
See also:
Maths::AreRelativelyEqual.

CEYLAN_DLL friend Vector2 operator* ( const Matrix2 m,
const Vector2 v 
) [friend]

Multiplies a matrix by a vector: result = m * v.

CEYLAN_DLL friend Matrix2 operator* ( Real  lambda,
const Matrix2 m 
) [friend]

Multiplies a matrix by a scalar: result = lambda * m.

CEYLAN_DLL friend Matrix2 operator* ( const Matrix2 m1,
const Matrix2 m2 
) [friend]

Multiplies two matrices: result = m1 * m2.

CEYLAN_DLL friend Matrix2 operator+ ( const Matrix2 m1,
const Matrix2 m2 
) [friend]

Adds two matrices: result = m1 + m2.

CEYLAN_DLL friend Matrix2 operator- ( const Matrix2 m1,
const Matrix2 m2 
) [friend]

Substracts two matrices: result = m1 - m2.

CEYLAN_DLL friend bool operator== ( const Matrix2 m1,
const Matrix2 m2 
) [friend]

Tells whether the two matrices have the same elements.

Note:
Exact comparison of floating point values is meaningless on most cases, hence strict equality is replaced here by relative equality.
See also:
Maths::AreRelativelyEqual.

CEYLAN_DLL friend Matrix2 operator~ ( const Matrix2 m  )  [friend]

Returns the transposed matrix corresponding to this matrix.

friend class Vector2 [friend]

Must access to each other's coordinates.

Definition at line 90 of file CeylanMatrix2.h.


Member Data Documentation

The nine coordinates of this matrix.

Definition at line 395 of file CeylanMatrix2.h.

Referenced by Cofactor(), determinant(), getElementAt(), Matrix2(), setAllElementsTo(), setColumn(), setElementAt(), setTo(), setToDiagonal(), toString(), trace(), and transpose().

TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited]

The text format to be used currently by TextDisplayable instances.

Note:
Defaults to raw text.

Definition at line 158 of file CeylanTextDisplayable.h.

Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().

Tells what is the dimension for this Matrix.

Reimplemented from Ceylan::Maths::Linear::Matrix.

Definition at line 387 of file CeylanMatrix2.h.

Referenced by getElementAt(), Matrix2(), setAllElementsTo(), setColumn(), setElementAt(), setToDiagonal(), toString(), trace(), and transpose().


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

Generated on Thu Jun 4 20:40:32 2009 for Ceylan by  doxygen 1.5.8