tensor: subtensor1()

This commit is contained in:
2026-03-09 17:10:58 +01:00
parent 9b5372fcae
commit 302055db86
3 changed files with 44 additions and 1 deletions

22
t.cc
View File

@@ -1084,7 +1084,7 @@ NRMat<complex<double> > b=exp(a);
cout <<b;
}
if(1)
if(0)
{
int n;
double d;
@@ -4746,5 +4746,25 @@ cout <<aa;
cout <<"Error = "<<(ax-aa).norm()<<endl;
}
if(1)
{
int n=3;
NRVec<INDEXGROUP> s(4);
for(int i=0; i<4; ++i)
{
s[i].number=1;
s[i].symmetry=0;
s[i].offset=0;
s[i].range=n;
}
Tensor<double> t(s);
t.randomize(1.);
INDEXNAME list[4]={"i","j","k","l"};
t.names=list;
cout <<t;
Tensor<double> t1 = t.subtensor1(2);
cout <<t1;
}
}//main