Added some more functions for convenience
This commit is contained in:
parent
86643012e2
commit
548de30100
|
@ -50,6 +50,8 @@ public:
|
|||
|
||||
void Transpose();
|
||||
void Invert();
|
||||
friend Matrix Transpose(const Matrix& mat);
|
||||
friend Matrix Invert(const Matrix& mat);
|
||||
void MultiplyRow(uint row, double factor);
|
||||
void SwapRows(uint left, uint right);
|
||||
void AddMultiplesToRow(uint base, uint target, double factor);
|
||||
|
@ -87,7 +89,7 @@ private:
|
|||
bool DimensionsFitting(const Matrix& left, const Matrix& right);
|
||||
void Resize(uint rows, uint cols, doubleMatrix& matrix);
|
||||
|
||||
|
||||
Matrix _transpose(const Matrix& mat);
|
||||
};
|
||||
|
||||
|
||||
|
@ -269,6 +271,25 @@ inline void Matrix::Transpose()
|
|||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// \brief Transposes the matrix (friend function)
|
||||
///
|
||||
////////////////////////////////////////////////////
|
||||
inline Matrix Transpose(const Matrix& mat)
|
||||
{
|
||||
Matrix transposed = mat;
|
||||
transposed.Transpose();
|
||||
return transposed;
|
||||
}
|
||||
|
||||
Matrix Matrix::_transpose(const Matrix& mat)
|
||||
{
|
||||
Matrix transposed = mat;
|
||||
transposed.Transpose();
|
||||
return transposed;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// \brief Inverts the matrix
|
||||
///
|
||||
|
@ -291,6 +312,18 @@ inline void Matrix::Invert()
|
|||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// \brief Invertss the matrix (friend function)
|
||||
///
|
||||
////////////////////////////////////////////////////
|
||||
inline Matrix Invert(const Matrix& mat)
|
||||
{
|
||||
Matrix inverse = mat;
|
||||
inverse.Invert();
|
||||
return inverse;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// \brief Multiplies each value of a given row by a given factor
|
||||
|
|
Loading…
Reference in a new issue