added debug diagnostics to operator()
This commit is contained in:
2
mat.h
2
mat.h
@@ -758,6 +758,7 @@ inline const NRMat<T> NRMat<T>::operator-(const NRSMat<T> &rhs) const {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
inline T* NRMat<T>::operator[](const int i) {
|
inline T* NRMat<T>::operator[](const int i) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
if(nn==0||mm==0) laerror("operator[] on unallocated matrix");
|
||||||
if (_LA_count_check && *count != 1) laerror("matrix with *count>1 used as l-value");
|
if (_LA_count_check && *count != 1) laerror("matrix with *count>1 used as l-value");
|
||||||
if(i<0||i>=nn) std::cout<<"INDEX PROBLEM "<<0<<" "<<i<<" "<<nn-1<<std::endl;
|
if(i<0||i>=nn) std::cout<<"INDEX PROBLEM "<<0<<" "<<i<<" "<<nn-1<<std::endl;
|
||||||
if (i < 0) laerror("Mat [] out of range - low");
|
if (i < 0) laerror("Mat [] out of range - low");
|
||||||
@@ -801,6 +802,7 @@ inline const T* NRMat<T>::operator[](const int i) const {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
inline T& NRMat<T>::operator()(const int i, const int j){
|
inline T& NRMat<T>::operator()(const int i, const int j){
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
if(nn==0||mm==0) laerror("operator() of unallocated matrix");
|
||||||
if (_LA_count_check && *count != 1) laerror("NRMat::operator(,) used as l-value for a matrix with count > 1");
|
if (_LA_count_check && *count != 1) laerror("NRMat::operator(,) used as l-value for a matrix with count > 1");
|
||||||
if(i<0||i>=nn||j<0||j>mm) std::cout<<"INDEX PROBLEM "<<0<<" "<<i<<" "<<nn-1<<" "<<0<<" "<<j<<" "<<mm-1<<std::endl;
|
if(i<0||i>=nn||j<0||j>mm) std::cout<<"INDEX PROBLEM "<<0<<" "<<i<<" "<<nn-1<<" "<<0<<" "<<j<<" "<<mm-1<<std::endl;
|
||||||
if (i < 0) laerror("first index out of range - low");
|
if (i < 0) laerror("first index out of range - low");
|
||||||
|
|||||||
1
smat.h
1
smat.h
@@ -770,6 +770,7 @@ return (i>j)? (i-2)*(i-1)/2+j-1 : (j-2)*(j-1)/2+i-1;
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
inline T & NRSMat<T>::operator()(const int i, const int j) {
|
inline T & NRSMat<T>::operator()(const int i, const int j) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
if(nn==0) laerror("operator() of unallocated smatrix");
|
||||||
if(_LA_count_check && *count != 1) laerror("T & NRSMat<T>::operator()(const int, const int) used for matrix with count > 1");
|
if(_LA_count_check && *count != 1) laerror("T & NRSMat<T>::operator()(const int, const int) used for matrix with count > 1");
|
||||||
if(i<0||i>=nn||j<0||j>=nn) std::cout<<"INDEX PROBLEM "<<0<<" "<<i<<" "<<nn-1<<" "<<0<<" "<<j<<" "<<nn-1<<std::endl;
|
if(i<0||i>=nn||j<0||j>=nn) std::cout<<"INDEX PROBLEM "<<0<<" "<<i<<" "<<nn-1<<" "<<0<<" "<<j<<" "<<nn-1<<std::endl;
|
||||||
if(i<0) laerror("T & NRSMat<T>::operator()(const int, const int) first index out of range - low");
|
if(i<0) laerror("T & NRSMat<T>::operator()(const int, const int) first index out of range - low");
|
||||||
|
|||||||
1
vec.h
1
vec.h
@@ -1101,6 +1101,7 @@ inline const T NRVec<T>::dot(const T *a, const int stride , bool conjugate) cons
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
inline T& NRVec<T>::operator[](const int i) {
|
inline T& NRVec<T>::operator[](const int i) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
if(nn==0) laerror("operator[] of unallocated vector");
|
||||||
if(_LA_count_check && *count != 1) laerror("possible use of NRVec[] with count>1 as l-value");
|
if(_LA_count_check && *count != 1) laerror("possible use of NRVec[] with count>1 as l-value");
|
||||||
if(i<0||i >= nn) std::cout<<"INDEX PROBLEM "<<0<<" "<<i<<" "<<nn-1<<std::endl;
|
if(i<0||i >= nn) std::cout<<"INDEX PROBLEM "<<0<<" "<<i<<" "<<nn-1<<std::endl;
|
||||||
if(i < 0) laerror("out of range - low");
|
if(i < 0) laerror("out of range - low");
|
||||||
|
|||||||
Reference in New Issue
Block a user