From 7ef2d1b73dce93e08182a9a2bf9bea4a5f5753fa Mon Sep 17 00:00:00 2001 From: Jiri Pittner Date: Thu, 6 Nov 2025 16:02:09 +0100 Subject: [PATCH] tensor: tested full contractions --- t.cc | 15 ++++++++++----- tensor.cc | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/t.cc b/t.cc index 22153ab..54110cb 100644 --- a/t.cc +++ b/t.cc @@ -3976,6 +3976,7 @@ cout <>r>>n; INDEXGROUP shape; @@ -3986,13 +3987,17 @@ INDEXGROUP shape; shape.range=n; shape.offset=0; } -Tensor x(shape); -x.randomize(1.); -cout< x(shape); x.randomize(1.); Tensor xf=x.flatten(); -cout < y(shape); y.randomize(1.); +Tensor yf=y.flatten(); -cout < z = x.groupcontraction(0,y,0,1,false,true); +INDEXLIST cl(r); +for(int i=0; i zf = xf.contractions(cl,yf,cl,1,false,true); + +cout <>(std::istream &s, Tensor &x) s>>x.shape; s>>x.names; x.data.resize(x.calcsize()); x.calcrank(); +if(x.rank()==0) {s>>x.data[0]; return s;} FLATINDEX I(x.rank()); for(LA_largeindex i=0; i