Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Missing Eigenvalues and Eigenvector

    Dear Statalisters,

    I'm puzzled by a square matrix for which all eigenvalues and eigenvectors related command return null result or missing values.
    I first thought it was because of complex eigenvalues, but reading Mata's manual, I found that complex is the default type of storage of eigenvalues vectors.

    Running the same code with other square matrices doesn't face the same issue, and the eigenvalues and eigenvector of this matrix can be obtained through other softwares, so it should be possible on mata too...

    So my question is twofold :
    1) What does it mean when e.g. L=eigenvalues(A) returns a vector of missing values?

    2) How to solve it? I add that symeigenvalues(A) works fine, but my matrix isn't initially symmetric.

    Many thanks
    Charlie

    Here's the detail of the code, and the data.
    Code:
    clear
    mata mata clear
    use "S:\Sample.dta"
    set matsize 1000
    mkmat _all,matrix(mat)
    mata
    M=st_matrix("mat")
    D=rowsum(M)
    U=rowsum(M')
    
    A=(M:/D)*(M':/U)
    dim=(rows(A),cols(A))
    dim
    /*A is square*/
    eltype(A)
    mreldifre(A)
    /*A is real*/
    missing(A)
    /*no missing values in A*/
    
    L=eigenvalues(A)
    L
    eigensystem(A, X=., L=.)
    end mata
    Attached Files

  • #2
    There seems to be a problem with very small numbers. The following example may be better to illustrate it:
    Code:
    mata: B = J(129, 129, 1e-175)
    mata: eigenvalues(B)
    mata: C = J(130, 130, 1e-175)
    mata: eigenvalues(C)
    For the 129x129 matrix B, I can obtain the eigenvalues and almost all of them are displayed as exactly zero. For the 130x130 matrix C, I also just obtain missing values.

    For your matrix A, I can obtain the eigenvalues for the submatrices up to dimension 374x374, i.e.
    Code:
    mata: eigenvalues(A[|1,1 \ 374, 374|])
    but missing values result for larger submatrices.
    https://twitter.com/Kripfganz

    Comment


    • #3
      Thanks Sebastian.
      You're right, I managed to compute the eigensystem by inflating my matrix
      Code:
      mata A=A:*1e100
      So the problem occurs when we have both small values and large matrices. But why? and what are the current limits to compute eigensystems in mata?

      Comment

      Working...
      X