*** empty log message ***
This commit is contained in:
parent
f5796068ec
commit
61769dd767
12
fourindex.h
12
fourindex.h
@ -716,12 +716,12 @@ if (IJ<0 || IJ>=(unsigned int)NRSMat<T>::nn || KL<0 || KL>=(unsigned int)NRSMat<
|
|||||||
template<class T, class DUMMY>
|
template<class T, class DUMMY>
|
||||||
T& fourindex_dense<twoelectronrealmullikan,T,DUMMY>::operator() (unsigned int i, unsigned int j, unsigned int k, unsigned int l)
|
T& fourindex_dense<twoelectronrealmullikan,T,DUMMY>::operator() (unsigned int i, unsigned int j, unsigned int k, unsigned int l)
|
||||||
{
|
{
|
||||||
unsigned int I = SMat_index_1(i,j);
|
int I = SMat_index_1(i,j);
|
||||||
unsigned int J = SMat_index_1(k,l);
|
int J = SMat_index_1(k,l);
|
||||||
//I,J act as indices of a NRSmat
|
//I,J act as indices of a NRSmat
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (*NRSMat<T>::count != 1) laerror("lval (i,j,k,l) with count > 1 in fourindex_dense");
|
if (*NRSMat<T>::count != 1) laerror("lval (i,j,k,l) with count > 1 in fourindex_dense");
|
||||||
if (I<0 || I>=(unsigned int)NRSMat<T>::nn || J<0 || J>=(unsigned int)NRSMat<T>::nn) laerror("fourindex_dense index out of range");
|
if (I<0 || I>=NRSMat<T>::nn || J<0 || J>=NRSMat<T>::nn) laerror("fourindex_dense index out of range");
|
||||||
if (!NRSMat<T>::v) laerror("access to unallocated fourindex_dense");
|
if (!NRSMat<T>::v) laerror("access to unallocated fourindex_dense");
|
||||||
#endif
|
#endif
|
||||||
return NRSMat<T>::v[SMat_index(I,J)];
|
return NRSMat<T>::v[SMat_index(I,J)];
|
||||||
@ -731,11 +731,11 @@ return NRSMat<T>::v[SMat_index(I,J)];
|
|||||||
template<class T, class DUMMY>
|
template<class T, class DUMMY>
|
||||||
const T& fourindex_dense<twoelectronrealmullikan,T,DUMMY>::operator() (unsigned int i, unsigned int j, unsigned int k, unsigned int l) const
|
const T& fourindex_dense<twoelectronrealmullikan,T,DUMMY>::operator() (unsigned int i, unsigned int j, unsigned int k, unsigned int l) const
|
||||||
{
|
{
|
||||||
unsigned int I = SMat_index_1(i,j);
|
int I = SMat_index_1(i,j);
|
||||||
unsigned int J = SMat_index_1(k,l);
|
int J = SMat_index_1(k,l);
|
||||||
//I,J act as indices of a NRSmat
|
//I,J act as indices of a NRSmat
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (I<0 || I>=(unsigned int)NRSMat<T>::nn || J<0 || J>=(unsigned int)NRSMat<T>::nn) laerror("fourindex_dense index out of range");
|
if (I<0 || I>=NRSMat<T>::nn || J<0 || J>=NRSMat<T>::nn) laerror("fourindex_dense index out of range");
|
||||||
if (!NRSMat<T>::v) laerror("access to unallocated fourindex_dense");
|
if (!NRSMat<T>::v) laerror("access to unallocated fourindex_dense");
|
||||||
#endif
|
#endif
|
||||||
return NRSMat<T>::v[SMat_index(I,J)];
|
return NRSMat<T>::v[SMat_index(I,J)];
|
||||||
|
17
smat.h
17
smat.h
@ -336,6 +336,23 @@ inline T SMat_index_1ilej(T i, T j)
|
|||||||
return j*(j-1)/2+i-1;
|
return j*(j-1)/2+i-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//indexing for antisymmetric matrix (used by fourindex)
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline T ASMat_index(T i, T j)
|
||||||
|
{
|
||||||
|
if(i==j) return -1;
|
||||||
|
return (i>j) ? i*(i-1)/2+j : j*(j-1)/2+i;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline T ASMat_index_1(T i, T j)
|
||||||
|
{
|
||||||
|
if(i==j) return -1;
|
||||||
|
return (i>j)? (i-2)*(i-1)/2+j-1 : (j-2)*(j-1)/2+i-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// access the element, 2-dim array case
|
// access the element, 2-dim array case
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
Loading…
Reference in New Issue
Block a user