JX Application Framework
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Friends | List of all members
JMatrix Class Reference

#include <JMatrix.h>

Public Member Functions

 JMatrix (const JSize rowCount, const JSize colCount, const JFloat fillValue=0.0)
 
 JMatrix (const JVector &)
 
 JMatrix (const JMatrix &)
 
 ~JMatrix ()
 
JMatrixoperator= (const JMatrix &)
 
JMatrixoperator+= (const JMatrix &)
 
JMatrixoperator-= (const JMatrix &)
 
JMatrixoperator*= (const JFloat)
 
JMatrixoperator/= (const JFloat)
 
JMatrix operator- () const
 
JSize GetRowCount () const
 
JSize GetColCount () const
 
JSize GetElementCount () const
 
JFloat GetElement (const JIndex rowIndex, const JIndex colIndex) const
 
void SetElement (const JIndex rowIndex, const JIndex colIndex, const JFloat value)
 
void IncrementElement (const JIndex rowIndex, const JIndex colIndex, const JFloat delta)
 
void SetAllElements (const JFloat value)
 
void SetRow (const JIndex rowIndex, const JFloat v1,...)
 
void SetCol (const JIndex colIndex, const JFloat v1,...)
 
void SetElements (const JFloat v1,...)
 
JVector GetRowVector (const JIndex rowIndex) const
 
void SetRowVector (const JIndex rowIndex, const JVector &rowVector)
 
JVector GetColVector (const JIndex colIndex) const
 
void SetColVector (const JIndex colIndex, const JVector &colVector)
 
JMatrix Transpose () const
 
bool Invert (JMatrix *inverse) const
 
JFloat Determinant () const
 
void Print (std::ostream &output) const
 
bool RowIndexValid (const JIndex rowIndex) const
 
bool ColIndexValid (const JIndex colIndex) const
 

Protected Member Functions

void SwapRows (const JIndex index1, const JIndex index2)
 
void ScaleRow (const JIndex rowIndex, const JFloat scaleFactor)
 
void AddRowToRow (const JIndex sourceIndex, const JFloat scaleFactor, const JIndex destIndex)
 
JIndex FindPivotRow (const JIndex rowIndex) const
 

Friends

bool JGaussianElimination (const JMatrix &A, const JVector &b, JVector *x)
 
bool JGaussianElimination (const JMatrix &A, const JMatrix &b, JMatrix *x)
 
bool JGaussianElimination (JMatrix *A, JMatrix *x)
 

Detailed Description

This class was not designed to be a base class!  If you need to override it,
be sure to make the destructor virtual.

Constructor & Destructor Documentation

◆ JMatrix() [1/3]

JMatrix::JMatrix ( const JSize  rowCount,
const JSize  colCount,
const JFloat  fillValue = 0.0 
)

◆ JMatrix() [2/3]

JMatrix::JMatrix ( const JVector v)

◆ JMatrix() [3/3]

JMatrix::JMatrix ( const JMatrix source)

◆ ~JMatrix()

JMatrix::~JMatrix ( )

Member Function Documentation

◆ AddRowToRow()

void JMatrix::AddRowToRow ( const JIndex  sourceIndex,
const JFloat  scaleFactor,
const JIndex  destIndex 
)
protected

◆ ColIndexValid()

bool JMatrix::ColIndexValid ( const JIndex  colIndex) const
inline

◆ Determinant()

JFloat JMatrix::Determinant ( ) const

◆ FindPivotRow()

JIndex JMatrix::FindPivotRow ( const JIndex  rowIndex) const
protected

Given the diagonal element that is under consideration, search all the elements in this column below the diagonal to find the largest one.

◆ GetColCount()

JSize JMatrix::GetColCount ( ) const
inline

◆ GetColVector()

JVector JMatrix::GetColVector ( const JIndex  colIndex) const

Return the specified column as a JVector.

◆ GetElement()

JFloat JMatrix::GetElement ( const JIndex  rowIndex,
const JIndex  colIndex 
) const

◆ GetElementCount()

JSize JMatrix::GetElementCount ( ) const
inline

◆ GetRowCount()

JSize JMatrix::GetRowCount ( ) const
inline

◆ GetRowVector()

JVector JMatrix::GetRowVector ( const JIndex  rowIndex) const

Return the specified row as a JVector.

◆ IncrementElement()

void JMatrix::IncrementElement ( const JIndex  rowIndex,
const JIndex  colIndex,
const JFloat  delta 
)

Adds the given value to the specified element.

◆ Invert()

bool JMatrix::Invert ( JMatrix inverse) const

Returns true if we were able to calculate an inverse.

◆ operator*=()

JMatrix & JMatrix::operator*= ( const JFloat  s)

◆ operator+=()

JMatrix & JMatrix::operator+= ( const JMatrix mx)

◆ operator-()

JMatrix JMatrix::operator- ( ) const

◆ operator-=()

JMatrix & JMatrix::operator-= ( const JMatrix mx)

◆ operator/=()

JMatrix & JMatrix::operator/= ( const JFloat  s)

◆ operator=()

JMatrix & JMatrix::operator= ( const JMatrix source)

◆ Print()

void JMatrix::Print ( std::ostream &  output) const

◆ RowIndexValid()

bool JMatrix::RowIndexValid ( const JIndex  rowIndex) const
inline

◆ ScaleRow()

void JMatrix::ScaleRow ( const JIndex  rowIndex,
const JFloat  scaleFactor 
)
protected

◆ SetAllElements()

void JMatrix::SetAllElements ( const JFloat  value)

◆ SetCol()

void JMatrix::SetCol ( const JIndex  colIndex,
const JFloat  v1,
  ... 
)

Replace the specified column with the given values.

◆ SetColVector()

void JMatrix::SetColVector ( const JIndex  colIndex,
const JVector colVector 
)

Replace the specified column with the given JVector.

◆ SetElement()

void JMatrix::SetElement ( const JIndex  rowIndex,
const JIndex  colIndex,
const JFloat  value 
)

◆ SetElements()

void JMatrix::SetElements ( const JFloat  v1,
  ... 
)

Fills the matrix with the given values in row major order.

◆ SetRow()

void JMatrix::SetRow ( const JIndex  rowIndex,
const JFloat  v1,
  ... 
)

Replace the specified row with the given values.

◆ SetRowVector()

void JMatrix::SetRowVector ( const JIndex  rowIndex,
const JVector rowVector 
)

Replace the specified row with the given JVector.

◆ SwapRows()

void JMatrix::SwapRows ( const JIndex  index1,
const JIndex  index2 
)
protected

◆ Transpose()

JMatrix JMatrix::Transpose ( ) const

Friends And Related Symbol Documentation

◆ JGaussianElimination [1/3]

bool JGaussianElimination ( const JMatrix A,
const JMatrix b,
JMatrix x 
)
friend

◆ JGaussianElimination [2/3]

bool JGaussianElimination ( const JMatrix A,
const JVector b,
JVector x 
)
friend

Returns true if we were able to perform Gaussian elimination on A|b to reduce A to the identity. The result of b is stored in x.

A does not have to be square. A, b, x must all have the same number of rows. b and x must have the same number of columns.

◆ JGaussianElimination [3/3]

bool JGaussianElimination ( JMatrix A,
JMatrix x 
)
friend

Returns true if we were able to perform Gaussian elimination on A|x. A and x are both modified. If the process fails, the partial results are returned.

A does not have to be square. A and x must all have the same number of rows.


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