]> git.tdb.fi Git - libs/math.git/blobdiff - source/linal/squarematrix.h
Remove SquareMatrix and instead use static_assert to check squareness
[libs/math.git] / source / linal / squarematrix.h
diff --git a/source/linal/squarematrix.h b/source/linal/squarematrix.h
deleted file mode 100644 (file)
index 5b9415a..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef MSP_LINAL_SQUAREMATRIX_H_
-#define MSP_LINAL_SQUAREMATRIX_H_
-
-#include <cmath>
-#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<typename T, unsigned S>
-class SquareMatrix: public Matrix<T, S, S>
-{
-public:
-       SquareMatrix() { }
-       SquareMatrix(const T *d): Matrix<T, S, S>(d) { }
-       template<typename U>
-       SquareMatrix(const Matrix<U, S, S> &m): Matrix<T, S, S>(m) { }
-
-       static SquareMatrix identity();
-
-       SquareMatrix &operator*=(const SquareMatrix &);
-       using Matrix<T, S, S>::operator*=;
-
-       SquareMatrix &invert();
-};
-
-template<typename T, unsigned S>
-inline SquareMatrix<T, S> SquareMatrix<T, S>::identity()
-{
-       SquareMatrix<T, S> m;
-       for(unsigned i=0; i<S; ++i)
-               m(i, i) = T(1);
-       return m;
-}
-
-template<typename T, unsigned S>
-SquareMatrix<T, S> &SquareMatrix<T, S>::operator*=(const SquareMatrix<T, S> &m)
-{
-       return *this = *this*m;
-}
-
-template<typename T, unsigned S>
-SquareMatrix<T, S> &SquareMatrix<T, S>::invert()
-{
-       SquareMatrix<T, S> r = identity();
-       gauss_jordan(*this, r);
-       return *this = r;
-}
-
-template<typename T, unsigned S>
-inline SquareMatrix<T, S> invert(const SquareMatrix<T, S> &m)
-{
-       SquareMatrix<T, S> temp = m;
-       SquareMatrix<T, S> r = SquareMatrix<T, S>::identity();
-       return gauss_jordan(temp, r);
-}
-
-} // namespace LinAl
-} // namespace Msp
-
-#endif