oseledets / TT-Toolbox

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

Removing a a column from a tt_tensor in an efficient way #59

Closed rvuchkov closed 3 years ago

rvuchkov commented 3 years ago

Hello

I am new to using this library (in Matlab) and would really appreciate a bit of help. I have read the quick start guide, but I could not find how to solve my problem;

What I am trying to do is a bit basic in nature, I want to forget a specific col of the full tt_tensor, while in the tt format. Something of the sort B = A(:,2:end)

because I could not find how to directly manipulate the col I was thinking I can do it via matrix multiplication.

[k1,k2] = size(M) A = tt_tensor(M) G= eye(k2) G = G(:,2:end) G = tt_tensor(G) B = A*G This is for 2d and I was thinking if I am doing this in higher dim I can appropriately pat the G matrix with identity in the dimensions I do not want to lose col. So my question is twofold: 1) When I do this I get that an error about the dim (I read there was a thread about that but I am not sure I follow the solution). I am adding a picture with the issue

Screen Shot 2021-07-27 at 2 50 52 PM

2) Just more generally is there more efficient way to remove a col from the tensor?

Thank you for your time and consideration in advance !

dolgov commented 3 years ago

Hi, you can extract any core from a tt_tensor, manipulate it and write back. For example, a = tt_rand(5,6,7) a{6} = a{6}(:,2:end,:)

rvuchkov commented 3 years ago

Thank you