Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple_pdinv does NOT return inverses #12

Open
mathDR opened this issue Sep 22, 2016 · 0 comments
Open

multiple_pdinv does NOT return inverses #12

mathDR opened this issue Sep 22, 2016 · 0 comments

Comments

@mathDR
Copy link

mathDR commented Sep 22, 2016

Hi. In the utilities.py file, the function multiple_pdinv is described as:

def multiple_pdinv(A):
    """
    Arguments
    ---------
    A : A DxDxN numpy array (each A[:,:,i] is pd)

    Returns
    -------
    invs : the inverses of A
    hld: 0.5* the log of the determinants of A
    """

but when I call the function with random PD matrices, I don't always return the inverse.

In particular, calling the function with the PD matrix

A = np.asarray([[2.,-1.,0.],[-1.,2.,-1.],[0.,-1.,2.]])[:,:,None]

returns the correct

[[ 0.75  0.5   0.25]
 [ 0.5   1.    0.5 ]
 [ 0.25  0.5   0.75]]

but calling it with a random matrix, say

A = [[[ 1.00487128]
  [ 0.10450152]
  [ 0.78902973]]
 [[ 0.64999066]
  [ 1.92596954]
  [ 0.08218574]]
 [[ 0.59447227]
  [ 0.43842888]
  [ 1.17832435]]]

returns

invs[:,:,0] = [[ 1.4981143   0.14944808 -1.01359122]
 [-0.48097944  0.47961461  0.28862138]
 [-0.57684638 -0.2538517   1.25263636]]

but the inverse is

np.linalg.inv(A) = [[ 1.66485487 -0.40496621 -0.68925095]
 [-0.40496621  0.66577222 -0.04341129]
 [-0.68925095 -0.04341129  1.21254673]]

Am I missing an assumption on what types of tensors go into multiple_pdinv?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant