tensor: inverse_index

This commit is contained in:
2024-04-08 16:57:09 +02:00
parent e09171467b
commit ec468f2db2
3 changed files with 77 additions and 8 deletions

19
t.cc
View File

@@ -3176,7 +3176,7 @@ for(int l=1; l<k; ++l)
cout <<count<<" "<<binom(n,4)<<endl;
}
if(1)
if(0)
{
int d,n;
cin>>d>>n;
@@ -3200,17 +3200,30 @@ cout <<d;
}
if(0)
if(1)
{
INDEXGROUP g;
g.number=3;
g.symmetry= -1;
g.offset=1;
g.range=3;
g.range=10;
Tensor<double> epsilon(g);
cout <<epsilon.size()<<endl;
for(LA_largeindex s=0; s<epsilon.size(); ++s)
{
SUPERINDEX I = epsilon.inverse_index(s);
int sign;
LA_largeindex ss=epsilon.index(&sign,I);
if(ss!=s || sign!=1)
{
cout <<"offset = "<<s<<endl;
cout <<"index = "<<I<<endl;
laerror("Internal error in tensor index calculation");
}
}
NRVec<LA_index> I({1,2,3});
NRVec<NRVec<LA_index> > II(I,1);
epsilon.lhs(II)=1;