def inv(A: LinearOperator, alg: Auto):
    """ Auto:
        - if A is PSD and small, use Cholesky
        - if A is PSD and large, use CG
        - if A is not PSD and small, use LU
        - if A is not PSD and large, use GMRES
    """
    match (A.isa(PSD), bool(np.prod(A.shape) <= 1e6)):
        case (True, True):
            alg = Cholesky()
        case (True, False):
            alg = CG(**alg.__dict__)
        case (False, True):
            alg = LU()
        case (False, False):
            alg = GMRES(**alg.__dict__)
        case _:
            assert False
    return inv(A, alg)
 Auto:
        - if A is PSD and small, use Cholesky
        - if A is PSD and large, use CG
        - if A is not PSD and small, use LU
        - if A is not PSD and large, use GMRES
    
cola/linalg/inverse/inv.py