Skip to content
Discussion options

You must be logged in to vote

It's expected but surprising. It comes down to whether you think cholesky represents a function on symmetric square matrices, or on the upper triangles of any square matrices. JAX's default convention is to choose the former. See this comment on #10815.

One way to make them agree is to make the functions you're calling functions on symmetric matrices (via orthogonal projection onto that subspace):

from jax import jacfwd, random

import jax.numpy as jnp
import jax.scipy as jsp


def solve_chol(A, b):
    A = (A + A.T) / 2.  # NEW
    L = jsp.linalg.cho_factor(A)
    return jsp.linalg.cho_solve(L, b)


def solve_lu(A, b):
    A = (A + A.T) / 2.  # NEW
    LU = jsp.linalg.lu_factor(A)
    re…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@GianmarcoCallegher
Comment options

Answer selected by GianmarcoCallegher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants