X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flinal%2Fmatrix.h;h=f18eb2f4cfb52504214b84015688e46d0d7be121;hb=77edbd42b918f3448ab4004dfe96b8a96621c348;hp=ff73165d02c703c0efe263b27f23a522c54b7383;hpb=b60ee0fb060790277bfc68722f85a137a58ad771;p=libs%2Fmath.git diff --git a/source/linal/matrix.h b/source/linal/matrix.h index ff73165..f18eb2f 100644 --- a/source/linal/matrix.h +++ b/source/linal/matrix.h @@ -8,7 +8,7 @@ namespace Msp { namespace LinAl { /** -A general mathematical matrix. +A general mathematical matrix with M rows and N columns. */ template class Matrix @@ -54,9 +54,11 @@ inline Matrix::Matrix(const T *d) template template -inline Matrix::Matrix(const Matrix &m) +inline Matrix::Matrix(const Matrix &other) { - std::copy(m.data, m.data+M*N, data); + for(unsigned i=0; i @@ -66,6 +68,7 @@ inline Matrix Matrix::from_columns(const Vector *v) for(unsigned i=0; i @@ -75,6 +78,7 @@ inline Matrix Matrix::from_rows(const Vector *v) for(unsigned i=0; i @@ -187,8 +191,9 @@ inline bool operator==(const Matrix &a, const Matrix &b) template inline Matrix &Matrix::exchange_rows(unsigned i, unsigned j) { + using std::swap; for(unsigned k=0; k