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.
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
Comment