1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Why the left matrix of single value decomposition obtained by scipy.linalg.svd() and...

Discussão em 'Python' iniciado por Stack, Setembro 15, 2024.

  1. Stack

    Stack Membro Participativo

    I tried to get eigen vectors by single value decomposition using scipy.linalg.svd() which gives me three outputs the left matrix U, diagonal matrix S, right matrix Vh. Where U is supposed to be eigenvectors for symmetric positive definite matrix.
    But eigenvectors obtained from scipy.linalg.eig() are different from U or the left matrix. Different in a sense that they have same absolute values but different signs for some of the values.

    import scipy
    import numpy as np
    mat = np.array([[3,2],[2,3]])
    U, S, Vh = scipy.linalg.svd(mat)
    eigenvalues, eigenvectors = scipy.linalg.eig(mat)

    print(U)
    >>> [[-0.70710678 -0.70710678]
    [-0.70710678 0.70710678]]
    print(eigenvectors)
    >>> [[ 0.70710678 -0.70710678]
    [ 0.70710678 0.70710678]]


    Maybe I am missing some mathematical point. It would be very helpful if someone explain it to me why this happens.

    Continue reading...

Compartilhe esta Página