tensor: improved diagnostics
This commit is contained in:
1
t.cc
1
t.cc
@@ -4497,6 +4497,7 @@ for(int i=0; i<n+2; ++i) for(int j=0; j<n+2; ++j) for(int k=0; k<n+2; ++k) for(i
|
|||||||
y.lhs(i,j,k,l) += x(ii,jj,kk,ll) * t[0](i,ii) * t[0](j,jj) * t[0](k,kk) * t[1](l,ll) ;
|
y.lhs(i,j,k,l) += x(ii,jj,kk,ll) * t[0](i,ii) * t[0](j,jj) * t[0](k,kk) * t[1](l,ll) ;
|
||||||
}
|
}
|
||||||
cout <<"Error = "<<(xt-y).norm()<<endl;
|
cout <<"Error = "<<(xt-y).norm()<<endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}//main
|
}//main
|
||||||
|
|||||||
8
tensor.h
8
tensor.h
@@ -84,10 +84,16 @@ if(LA_traits<T>::is_complex()) //condition known at compile time
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool didwarn=false;
|
||||||
static inline bool ptr_ok(void *ptr)
|
static inline bool ptr_ok(void *ptr)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if(ptr==NULL) std::cout<<"Warning: write to nonexistent tensor element ignored\n";
|
if(ptr==NULL && !didwarn)
|
||||||
|
{
|
||||||
|
std::cout<<"Warning: write to zero element of antisym tensor ignored\n";
|
||||||
|
std::cerr<<"Warning: write to zero element of antisym tensor ignored\n";
|
||||||
|
didwarn=true;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return (bool)ptr;
|
return (bool)ptr;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user