]> git.tdb.fi Git - libs/math.git/blobdiff - source/linal/matrix.h
Add missing return statements
[libs/math.git] / source / linal / matrix.h
index 83a64f50dd767ff1497804378be48160e8691ed0..f18eb2f4cfb52504214b84015688e46d0d7be121 100644 (file)
@@ -8,7 +8,7 @@ namespace Msp {
 namespace LinAl {
 
 /**
-A general mathematical matrix.
+A general mathematical matrix with M rows and N columns.
 */
 template<typename T, unsigned M, unsigned N>
 class Matrix
@@ -68,6 +68,7 @@ inline Matrix<T, M, N> Matrix<T, M, N>::from_columns(const Vector<T, M> *v)
        for(unsigned i=0; i<M; ++i)
                for(unsigned j=0; j<N; ++j)
                        m(i, j) = v[j][i];
+       return m;
 }
 
 template<typename T, unsigned M, unsigned N>
@@ -77,6 +78,7 @@ inline Matrix<T, M, N> Matrix<T, M, N>::from_rows(const Vector<T, N> *v)
        for(unsigned i=0; i<M; ++i)
                for(unsigned j=0; j<N; ++j)
                        m(i, j) = v[i][j];
+       return m;
 }
 
 template<typename T, unsigned M, unsigned N>
@@ -189,8 +191,9 @@ inline bool operator==(const Matrix<T, M, N> &a, const Matrix<T, M, N> &b)
 template<typename T, unsigned M, unsigned N>
 inline Matrix<T, M, N> &Matrix<T, M, N>::exchange_rows(unsigned i, unsigned j)
 {
+       using std::swap;
        for(unsigned k=0; k<N; ++k)
-               std::swap(element(i, k), element(j, k));
+               swap(element(i, k), element(j, k));
        return *this;
 }