#ifndef MSP_LINAL_SQUAREMATRIX_H_
#define MSP_LINAL_SQUAREMATRIX_H_
+#include <cmath>
#include <stdexcept>
#include "matrix.h"
virtual ~not_invertible() throw() { }
};
+/**
+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>
{
template<typename T, unsigned S>
SquareMatrix<T, S> &SquareMatrix<T, S>::operator*=(const SquareMatrix<T, S> &m)
{
- Matrix<T, S, S>::operator*=(m);
- return *this;
+ return *this = *this*m;
}
template<typename T, unsigned S>
SquareMatrix<T, S> &SquareMatrix<T, S>::invert()
{
+ using std::abs;
+
SquareMatrix<T, S> r = identity();
for(unsigned i=0; i<S; ++i)
{