]> git.tdb.fi Git - libs/math.git/blobdiff - source/linal/matrix.h
Move some simple function definitions inside the class declarations
[libs/math.git] / source / linal / matrix.h
index 94a6e0991b2d13502e2f998107d5e26f5831ad04..ff73165d02c703c0efe263b27f23a522c54b7383 100644 (file)
@@ -25,10 +25,10 @@ public:
        static Matrix from_columns(const Vector<T, M> *);
        static Matrix from_rows(const Vector<T, N> *);
 
-       T &element(unsigned, unsigned);
-       const T &element(unsigned, unsigned) const;
-       T &operator()(unsigned, unsigned);
-       const T &operator()(unsigned, unsigned) const;
+       T &element(unsigned i, unsigned j) { return data[i+M*j]; }
+       const T &element(unsigned i, unsigned j) const { return data[i+M*j]; }
+       T &operator()(unsigned i, unsigned j) { return element(i, j); }
+       const T &operator()(unsigned i, unsigned j) const { return element(i, j); }
 
        Matrix &operator*=(T);
        Matrix &operator/=(T);
@@ -77,30 +77,6 @@ inline Matrix<T, M, N> Matrix<T, M, N>::from_rows(const Vector<T, N> *v)
                        m(i, j) = v[i][j];
 }
 
-template<typename T, unsigned M, unsigned N>
-inline T &Matrix<T, M, N>::element(unsigned i, unsigned j)
-{
-       return data[i+M*j];
-}
-
-template<typename T, unsigned M, unsigned N>
-inline const T &Matrix<T, M, N>::element(unsigned i, unsigned j) const
-{
-       return data[i+M*j];
-}
-
-template<typename T, unsigned M, unsigned N>
-inline T &Matrix<T, M, N>::operator()(unsigned i, unsigned j)
-{
-       return element(i, j);
-}
-
-template<typename T, unsigned M, unsigned N>
-inline const T &Matrix<T, M, N>::operator()(unsigned i, unsigned j) const
-{
-       return element(i, j);
-}
-
 template<typename T, unsigned M, unsigned N>
 inline Matrix<T, M, N> &Matrix<T, M, N>::operator*=(T s)
 {