X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Flinal%2Fsquarematrix.h;fp=source%2Flinal%2Fsquarematrix.h;h=0000000000000000000000000000000000000000;hb=60caa19c84877c89d750140a90e5d891bce30ee7;hp=5b9415a0e22bcddff7f738284b455a7a5a7cb76c;hpb=ff8619c1c440fd1a7c8deaca763a33b8e1d53b5e;p=libs%2Fmath.git diff --git a/source/linal/squarematrix.h b/source/linal/squarematrix.h deleted file mode 100644 index 5b9415a..0000000 --- a/source/linal/squarematrix.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef MSP_LINAL_SQUAREMATRIX_H_ -#define MSP_LINAL_SQUAREMATRIX_H_ - -#include -#include "matrix.h" -#include "matrixops.h" - -namespace Msp { -namespace LinAl { - -/** -A mathematical matrix with S rows and columns. Some operations are provided -here that are only possible for square matrices. -*/ -template -class SquareMatrix: public Matrix -{ -public: - SquareMatrix() { } - SquareMatrix(const T *d): Matrix(d) { } - template - SquareMatrix(const Matrix &m): Matrix(m) { } - - static SquareMatrix identity(); - - SquareMatrix &operator*=(const SquareMatrix &); - using Matrix::operator*=; - - SquareMatrix &invert(); -}; - -template -inline SquareMatrix SquareMatrix::identity() -{ - SquareMatrix m; - for(unsigned i=0; i -SquareMatrix &SquareMatrix::operator*=(const SquareMatrix &m) -{ - return *this = *this*m; -} - -template -SquareMatrix &SquareMatrix::invert() -{ - SquareMatrix r = identity(); - gauss_jordan(*this, r); - return *this = r; -} - -template -inline SquareMatrix invert(const SquareMatrix &m) -{ - SquareMatrix temp = m; - SquareMatrix r = SquareMatrix::identity(); - return gauss_jordan(temp, r); -} - -} // namespace LinAl -} // namespace Msp - -#endif