diff --git a/t.cc b/t.cc index 0ae16fb..789de85 100644 --- a/t.cc +++ b/t.cc @@ -3715,6 +3715,16 @@ cout < ff; tensor2fourindex(t,ff); cout <<"Error = "<<(f-ff).norm()< fc(f); +const Tensor tc(t); +for(int i=1; i<=n; ++i) +for(int j=1; j<=n; ++j) +for(int k=1; k<=n; ++k) +for(int l=1; l<=n; ++l) + { + cout<< "4ind "< ff; tensor2fourindex(t,ff); cout <<"Error = "<<(f-ff).norm()< fc(f); +const Tensor tc(t); +for(int i=1; i<=n; ++i) +for(int j=1; j<=n; ++j) +for(int k=1; k<=n; ++k) +for(int l=1; l<=n; ++l) + { + cout<< "4ind "< ff; tensor2fourindex(t,ff); cout <<"Error = "<<(f-ff).norm()< fc(f); +const Tensor tc(t); +for(int i=1; i<=n; ++i) +for(int j=1; j<=n; ++j) +for(int k=1; k<=n; ++k) +for(int l=1; l<=n; ++l) + { + cout<< "4ind "< ff; tensor2fourindex(t,ff); cout <<"Error = "<<(f-ff).norm()< fc(f); +const Tensor tc(t); +for(int i=1; i<=n+1; ++i) +for(int j=1; j<=n; ++j) +for(int k=1; k<=n+3; ++k) +for(int l=1; l<=n+2; ++l) + { + cout<< "4ind "< ff; tensor2fourindex(t,ff); cout <<"Error = "<<(f-ff).norm()< fc(f); +const Tensor tc(t); +for(int i=1; i<=n; ++i) +for(int j=1; j<=n; ++j) +for(int k=1; k<=n+2; ++k) +for(int l=1; l<=n+2; ++l) + { + cout<< "4ind "< ff; tensor2fourindex(t,ff); cout <<"Error = "<<(f-ff).norm()< fc(f); +const Tensor tc(t); +for(int i=1; i<=n; ++i) +for(int j=1; j<=n; ++j) +for(int k=1; k<=n; ++k) +for(int l=1; l<=n; ++l) + { + cout<< "4ind "< ff; tensor2fourindex(t,ff); cout <<"Error = "<<(f-ff).norm()< fc(f); +const Tensor tc(t); +for(int i=1; i<=n; ++i) +for(int j=1; j<=n; ++j) +for(int k=1; k<=n; ++k) +for(int l=1; l<=n; ++l) + { + cout<< "4ind "< &t, fourindex_dense &f); //conversions from/to fourindex specialized by symmetry type //NOTE also different index order due to tensor's leftmost index being the least significant +// +//operator() : (i,j,k,l) in fourindex -> (k,l,i,j) in tensor template Tensor fourindex2tensor(const fourindex_dense &f) { @@ -307,6 +309,7 @@ f=fourindex_dense(range,NRMat(t.data,range*range,range*range) } +//operator() : (i,j,k,l) in fourindex -> (k,l,i,j)=(l,k,j,i) in tensor template Tensor fourindex2tensor(const fourindex_dense &f) { @@ -340,6 +343,7 @@ f=fourindex_dense(NRMat(t.data,range*(range+1) } +//operator() : (i,j,k,l) in fourindex -> (i,j,k,l)=(l,k,j,i) in tensor template Tensor fourindex2tensor(const fourindex_dense &f) { @@ -375,6 +379,7 @@ f=fourindex_dense(NRSMat(mat)); //symmetrize mat } +//operator() : (i,j,k,l) in fourindex -> (k,l,i,j) in tensor template Tensor fourindex2tensor(const fourindex_dense &f) { @@ -385,10 +390,10 @@ for(int i=0; i<4; ++i) shape[i].symmetry=0; shape[i].offset=1; } -shape[3].range=f.noca; -shape[2].range=f.nocb; -shape[1].range=f.nvra; -shape[0].range=f.nvrb; +shape[2].range=f.noca; +shape[3].range=f.nocb; +shape[0].range=f.nvra; +shape[1].range=f.nvrb; NRVec data(f); return Tensor(shape,data); } @@ -397,10 +402,10 @@ template void tensor2fourindex(const Tensor &t, fourindex_dense &f) { if(t.rank()!=4 ||t.shape.size()!=4) laerror("wrong rank/shape in tensor2fourindex"); -int noca = t.shape[3].range; -int nocb = t.shape[2].range; -int nvra = t.shape[1].range; -int nvrb = t.shape[0].range; +int noca = t.shape[2].range; +int nocb = t.shape[3].range; +int nvra = t.shape[0].range; +int nvrb = t.shape[1].range; int offset=t.shape[0].offset; for(int i=0; i(noca,nocb,nvra,nvrb,mat); } - +//operator() : (i,j,k,l) in fourindex -> (k,l,i,j) in tensor template Tensor fourindex2tensor(const fourindex_dense &f) { @@ -424,8 +429,8 @@ for(int i=0; i<2; ++i) shape[i].symmetry= -1; shape[i].offset=1; } -shape[1].range=f.nocc; shape[0].range=f.nvrt; +shape[1].range=f.nocc; NRVec data(f); return Tensor(shape,data); } @@ -448,7 +453,7 @@ f=fourindex_dense(nocc,nvrt,mat); } - +//operator() : (i,j,k,l) in fourindex -> (k,l,i,j)=(i,j,k,l) in tensor template Tensor fourindex2tensor(const fourindex_dense &f) { @@ -483,7 +488,7 @@ f=fourindex_dense(range,NRSMat(mat)); } - +//operator() : (i,j,k,l) in fourindex -> (k,l,i,j)=(i,j,k,l) in tensor template Tensor fourindex2tensor(const fourindex_dense &f) {