From 225efeab4a0e44678d6009cac2116d697180a55e Mon Sep 17 00:00:00 2001 From: jiri Date: Tue, 20 Jan 2009 14:39:50 +0000 Subject: [PATCH] *** empty log message *** --- mat.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mat.h b/mat.h index 13b3fcc..1fd2b11 100644 --- a/mat.h +++ b/mat.h @@ -44,9 +44,9 @@ public: inline NRMat(const NRMat &rhs); explicit NRMat(const NRSMat &rhs); #ifdef MATPTR - explicit NRMat(const NRVec &rhs, const int n, const int m) :NRMat(&rhs[0][0],n,m) {}; + explicit NRMat(const NRVec &rhs, const int n, const int m, const int offset=0) :NRMat(&rhs[0][0] + offset ,n,m) {if (offset < 0 || n*m + offset > rhs.nn) laerror("matrix dimensions and offset incompatible with vector length");}; #else - explicit NRMat(const NRVec &rhs, const int n, const int m); + explicit NRMat(const NRVec &rhs, const int n, const int m, const int offset=0); #endif ~NRMat(); #ifdef MATPTR @@ -227,15 +227,14 @@ NRMat::NRMat(const NRSMat &rhs) #ifndef MATPTR template -NRMat::NRMat(const NRVec &rhs, const int n, const int m) +NRMat::NRMat(const NRVec &rhs, const int n, const int m, const int offset) { -#ifdef DEBUG - if (n*m != rhs.nn) laerror("matrix dimensions incompatible with vector length"); -#endif + if (offset < 0 || n*m + offset > rhs.nn) laerror("matrix dimensions and offset incompatible with vector length"); + nn = n; mm = m; count = rhs.count; - v = rhs.v; + v = rhs.v + offset; (*count)++; } #endif