JaxGaussianProcesses / GPJax

Gaussian processes in JAX.
https://docs.jaxgaussianprocesses.com/
Apache License 2.0
453 stars 52 forks source link

docs: Add triangular solve figure #268

Closed thomaspinder closed 1 month ago

thomaspinder commented 1 year ago

In our sharp bits doc, we acknowledge that solving a system of equations using the Cholesky factor is faster than using the dense covariance matrix. It would be nice to have a figure that depicts why this is true.

ya-sh-vardh-an commented 1 year ago

Hi, this is my first issue but I am really interested in it. How can I apply?

thomaspinder commented 1 year ago

Hi @Yash5675, thanks for the interest. For this section in our sharp bits doc, it would be nice to have an example of solving a small (3x3) system of equations using Cholesky factors.

If I have a PSD matrix $A=LL^{\top}$ and I want to solve $Ax=y$, then I can first solve $Lx=b$ and then $L^{\top}x=b$. These two operations both involve triangular matrices and are, therefore, faster than brute force solving $Ax=y$. If this is new to you, then there are some nice details on this in Chapter 26 of Numerical linear algebra.

It would be nice to have something that elucidates this idea. Ideally, this would be a figure, but also a toy math example would be fine too. You can include this into the sharp bits doc and open a PR. If you have any questions, then please don't hesitate to message. We do also have a Slack channel.

ya-sh-vardh-an commented 1 year ago

@thomaspinder thank you for the great explanation and materials for more information. I have some questions. Shall I ask them here or on slack? I am fine with either.

thomaspinder commented 1 year ago

Wherever you prefer. If your questions are package-specific, then posting here may be better for transparency. Otherwise, Slack is fine :)

ya-sh-vardh-an commented 1 year ago

Ok, I will just ask them here. So, what I have to do is add an illustration into docs/sharp_bits.md at the end of the Positive-definiteness section. Please correct me if I am wrong. About the illustration, it should show Cholesky factorisation steps:

  1. Cholesky Decomposition
  2. Forward Substitution
  3. Backward Substitution

through an example of 3x3 system of equations? (should I also include the operation count?). And ideally it should be a figure (should I add the figure into the docs/_static/ and use the link from there?).

PS: I have no idea what I am saying. Please correct me if any of the information is wrong or needs more improvement.

thomaspinder commented 1 year ago

Correct. If you are able to include the operation count, then that would be excellent! A figure would be ideal and yes, it can go under docs/_static/ for now.

Feel free to exercise your creativity here - if, whilst doing this, you feel there's a better way to illustrate the point, then you should free to do this. We can manage any imperfections or areas for improvement through the PR.

ya-sh-vardh-an commented 1 year ago

Sorry for the late reply. I have opened a PR. Please let me know what changes I need to make. Thank you very much.

ya-sh-vardh-an commented 7 months ago

Hello @thomaspinder, I have made an animated version of the example. (the preview is posted in the PR #276 ) Should I open a new PR or reopen the previous one.

PS. I am really sorry for the late reply !

github-actions[bot] commented 1 month ago

There has been no recent activity on this issue. To keep our issues log clean, we remove old and inactive issues. Please update to the latest version of GPJax and check if that resolves the issue. Let us know if that works for you by leaving a comment. This issue is now marked as stale and will be closed if no further activity occurs. If you believe that this is incorrect, please comment. Thank you!

github-actions[bot] commented 1 month ago

There has been no activity on this PR for some time. Therefore, we will be automatically closing the PR if no new activity occurs within the next seven days. Thank you for your contributions.