Dear Statalisters,
I ran
matrix symeigen X L = newA
in stata13, and see the results in matrix form in output window.
I want to save the results of vector X and L as stata data.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
as a reference: I posted earlier this message,
http://www.statalist.org/forums/foru...-stata-dataset
then it occurs to me, my matrix symeigen is not executed using mata, so I ask this question here. I hope it is not against the posting etiquette.
By the way, another part of my program where I generate a symmetric matrix in mata, I try to save the symmetric matrix as a stata dataset using getmata, I got error code" invalid lval
r(3000);"
here is the code:
~~~~~~~~~~~~~~~
mata
M = st_matrix("A")
void function makesym(matrix M) {
if (rows(M)!=cols(M)) {
exit(error(1))
}
for(i=1;i<=rows(M);i++) {
for(j=1;j<i;j++) {
mx=max(M[i,j] \ M[j,i])
M[i,j]=mx
M[j,i]=mx
}
}
}
makesym(M)
getmata (myvar*) = M
end
~~~~~~~~~~~~~~~
thanks for your consideration ,
Rochelle
I ran
matrix symeigen X L = newA
in stata13, and see the results in matrix form in output window.
I want to save the results of vector X and L as stata data.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
as a reference: I posted earlier this message,
http://www.statalist.org/forums/foru...-stata-dataset
then it occurs to me, my matrix symeigen is not executed using mata, so I ask this question here. I hope it is not against the posting etiquette.
By the way, another part of my program where I generate a symmetric matrix in mata, I try to save the symmetric matrix as a stata dataset using getmata, I got error code" invalid lval
r(3000);"
here is the code:
~~~~~~~~~~~~~~~
mata
M = st_matrix("A")
void function makesym(matrix M) {
if (rows(M)!=cols(M)) {
exit(error(1))
}
for(i=1;i<=rows(M);i++) {
for(j=1;j<i;j++) {
mx=max(M[i,j] \ M[j,i])
M[i,j]=mx
M[j,i]=mx
}
}
}
makesym(M)
getmata (myvar*) = M
end
~~~~~~~~~~~~~~~
thanks for your consideration ,
Rochelle
Comment