Replies: 4 comments 1 reply
-
Thanks for the question! Would you be willing to concatenate all the blocks together into a big 2D array, apply direct methods there, and then take it back apart into the pytree-of-pytrees-of-blocks representation? If so, you could use the If you want to keep things organized as pytrees-of-pytrees-of-blocks, then JAX doesn't offer any functions for operating on those matrix representations. You'd have to write the direct method algorithm yourself, e.g. operating on lists-of-lists-of-Arrays, though you could call What do you think? |
Beta Was this translation helpful? Give feedback.
-
concatenating everything into a big 2d array would certainly work as a first pass. It seems like |
Beta Was this translation helpful? Give feedback.
-
Try Lineax, which in particular offers way to represent pytree linear operators. For what it's worth, for your particular problem, this is mostly a convenience: with a direct method (e.g. an LU solver), then it still calls out to JAX's underlying routines, doing a |
Beta Was this translation helpful? Give feedback.
-
wow, Lineax seems really cool! What would be the best way to do a Hessian of a scalar function? As something like |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to implement some Newton type methods for pytrees. I know there are several implementations that use iterative linear algebra (like
cg
orgmres
) to solve for the Newton step, but I'm trying to get it to work with direct methods which are faster and more accurate for my applications.Basically, I have a function
f
whose argument is a pytree and outputs a scalar. I can get the Hessian off
which is then a pytree of pytrees of matrices. How can I invert this matrix or do something likejnp.linalg.solve
?Relatedly would be doing least squares with the Jacobian of a vector valued function using
jnp.linalg.qr
orjnp.linalg.svd
Beta Was this translation helpful? Give feedback.
All reactions