PGelss / scikit_tt

Tensor Train Toolbox
GNU Lesser General Public License v3.0
104 stars 25 forks source link

Simplifying example for solving linear system of equations #7

Closed mdrpanwar closed 4 years ago

mdrpanwar commented 5 years ago

Hi Dr. Gelß, Thanks a lot for this awesome library. I just wanted to ask if you could provide some sort of a basic example describing how to use your library to solve a system of linear equations and/or ODE. I am having doubts regarding how should such problems be inputted and how to interpret the output in TT format. An example would be of much help.

Thanks.

PGelss commented 4 years ago

Hello,

I'm happy to hear about your interest in our toolbox. You can find many different applications of the implemented methods in the directory examples. For instance, an ODE is solved in _signalingcascade.py at line 91:

solution = ode.trapezoidal_rule(operator, initial_distribution, initial_guess, step_sizes)

Here, operator is a tensor-train operator of a Markovian master equation for a 20-dimensional signaling cascade. If you specifically want to solve a system of linear equations, take a look at the file sle.py in the directory solvers. Given a TT operator and a right-hand side (also in TT format), you could apply

solution = als(operator, initial_guess, right_hand_side)

where initial_guess is your first guess for the solution (e.g., a random tensor).

Can you describe what kind of problems you are interested in, then it is probably easier to describe how to construct TT operators and systems of linear equations in this case.

Best regards, Patrick