oseledets / TT-Toolbox

The git repository for the TT-Toolbox
Other
193 stars 73 forks source link

Setting entries to zeros #61

Open rvuchkov opened 3 years ago

rvuchkov commented 3 years ago

Hi Prof. Doglov,

I am trying to preserve one sheet of a tensor and set the other entries to zero. Below there is an example code of what I am trying to do A = rand(nx,ny,nz) for ix = 2:nx for jy=1:ny for kz=1:nz A(ix, jy, kz) = 0; end end end I have experimented with using cell2core to override cores to zero, but I am having a hard time visualizing. I would really appreciate any help.

dolgov commented 3 years ago

Sorry, what do you mean by "visualizing"? To set all but one slices of a tensor to zero you can use A(2:end, :, :) = 0; Same can be done for a TT core, e.g. A = tt{5}; A(2:end,:,:) = 0; tt{5} = A;