% create a random tensor system for testing % tensor dimensions l=40; m=10; n=2; % elements of the right-hand side t = trand(l,m,n); y=rand(m,1); z=rand(n,1); z=z/norm(z); % right-hand side b = tcontract(t,y,2)*z; % Householder-rotate the system so that b becomes (b1, 0, ..., 0)' h = house(b); t = tlefthouse(h,t,3); % could also do this along the j dimension b = lefthouse(h,b); % reduced homogeneous system tr = tgetsubtensor(t,2:l,':',':');