Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting entries to zeros #61

Open
rvuchkov opened this issue Aug 22, 2021 · 1 comment
Open

Setting entries to zeros #61

rvuchkov opened this issue Aug 22, 2021 · 1 comment

Comments

@rvuchkov
Copy link

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
Copy link
Collaborator

dolgov commented Aug 23, 2021

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants