oseledets / TT-Toolbox

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

ALS-solver #46

Closed rkuoyemnbeek closed 4 years ago

rkuoyemnbeek commented 4 years ago

Hi,

I am trying to use TT for solving tensor linear equations. If I look in the code for ALS (als_solve_rx_2 and als_solve_rx) it seems like they use the old way (with cells) of representing tensor trains. Is there an implementation of als that uses the new way of representing tensor-trains.

This is a small piece of code in als_solve_rx for which I have difficulties of knowing what it is trying to do:

a1 = mat{1}; a2 = mat{2}; n1 = size(a1,1); m1 = size(a1,2); n2 = size(a2,1); m2 = size(a2,2); ra = size(a1,3);

dolgov commented 4 years ago

Hi,

these als codes look really retired, I'm not even sure what they do exactly. It seems the only linear solver that was maintained recently is amen_solve2. It is rank adaptive, and the minimal interface with default parameters is x = amen_solve2(A,b,tol), where tol is both truncation and stopping tolerance. However, you can instruct it to behave like a fixed-rank ALS: x = amen_solve2(A,b,0, 'kickrank', 0, 'trunc_norm', 'fro', 'x0', x0, 'tol_exit', tol); Here, the 3d argument is the rank truncation tolerance - must be 0 to prevent rank truncation in simple ALS. 'kickrank', 0 turns off the rank increase too. 'trunc_norm', 'fro' turns off using residual for rank truncation, switching back to the simple SVD which is now void due to 0 in the 3d argument. 'x0', x0 initial guess that must now bear reasonable TT ranks 'tol_exit', tol the actual stopping tolerance goes here since the 3d argument is now 0.

rkuoyemnbeek commented 4 years ago

Hi, I was wondering if there is any other solver than amen_solve2 for tensor linear equations that is still working with the current way of representing tensor-trains? I am somehow confused how to configure the amen_solve2 the best (as I just want to solve my equation and I am not an expert in solving tensor-linear equations) I particular I would want to have a solver which gives me the best low-rank solution of the equation, despite the actual solution can have high ranks. In my algorithm, if iterations proceed, the solution of my equations become of rank 1

dolgov commented 4 years ago

I thought you wanted to reproduce specifically the ALS. If you "just want to solve your equation", amen_solve2 is probably the best method we have in TT-Toolbox for this task. In this case you can start with the three compulsory inputs as shown above. If it still gives a solution of rank 1, most likely it is actually rank-1.

...unless the matrix is indefinite. ALS/AMEn/DMRG are symmetric projection methods, and like any such methods (e.g. FOM) they may render the projection of an indefinite matrix degenerate. If there is no further (e.g. block) structure in the matrix, try solving the normal equations instead.

rkuoyemnbeek commented 4 years ago

Thanks for the quick response. I have difficulties with interpreting the results of the ALS-solver. The solver stops when max_res < tol, but I is strange that despite the ALS-solver tells me it is converged, it still gives a high residua.l. It seems to me that the ALS-solver is not searching for the solution that best minimized the residual. Attached is a printscreen, I can send you code if you want it.

image