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

TT Matrix by vector multiplication doesn't work for rectangular matrices if row and column modes are different #39

Open
ghost opened this issue Nov 21, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Nov 21, 2017

Consider the following example

M = 192;
N = 64;
tt_x = tt_tensor(reshape(randn(N,1), factor(N)), 1e-3);
tt_P = tt_matrix(rand(M,N), 1e-3, factor(M), factor(N));
tt_P2 = tt_matrix(rand(M,N), 1e-3, [4, 2,2,2,2,3], factor(N)); % mode lengths are the same
res2 = tt_P2 * tt_x; % works ok
res = tt_P * tt_x; % fails

I am not an expert in (Q)TT formats, and don't know if it is an expected behavior. If yes, I suggest you add notes on it to the documentation or matrix multiplication header.

Thanks!

@dolgov
Copy link
Collaborator

dolgov commented Nov 21, 2017

Yes, the products should have the same dimensions and core by core consistent mode sizes.
I added the corresponding remark to tt_matrix/mtimes.
The tt_matrix constructor help is already consistent, since it says " If either of N or M is shorter than another, it is expanded by ones, such that the number of TT blocks is max(length(N), length(M))"
You may use tt_reshape to adjust the mode sizes.

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

1 participant