Announcement

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

  • Mata gives complex eigenvalues

    Mata gives me complex eigenvalues when I think they should be real.
    I have a real matrix G. eigenvalues(G'*G) returns some complex numbers, which I believe is wrong since G'*G is symmetric by definition. Has anyone experienced something similar, or am I missing something? Thanks

  • #2
    Kristoffer --

    I don't know if this applies to your situation, but hopefully it helps a bit. I believe that the eigenvalues() function returns complex numbers as a matter of course. That is, something like:
    Code:
    mata: 
    G=runiform(10,10)
    G=G'G
    g=eigenvalues(G)
    eltype(g)
    will always return the result complex. What you probably want to use is the function symeigenvalues() if your matrix is symmetric. I think that this will return real numbers (so long as there isn't something wrong with your matrix. This is documented in the help file (help mata eigensystem()).

    Best,

    Matt Baker













    Comment

    Working...
    X