eigenvalues

Posted on
Picture of user. HanOud Joined: 12/20/2009
Could anybody tell how to correct the following mxAlgebra statement to get the real eigenvalue parts of a matrix A
eigen<-mxAlgebra(Re(eigen(A,only.values=TRUE)$values),"eigen")
When running the model I get the error message:
Error: Unknown reference 'TRUE' detected in the entity 'eigen' in model 'eigen-example'
Replied on Wed, 12/23/2009 - 18:49
Picture of user. Steve Joined: 07/30/2009

Unfortunately, not all operations in R are implemented in our computational backend. The operations that are currently defined are listed in the OpenMx wiki page Matrix Operators and Functions.

I'd be happy to add Re() and eigen() to the list of requested functions.

Replied on Thu, 12/24/2009 - 06:57
Picture of user. mspiegel Joined: 07/31/2009

In reply to by Steve

Yeah. This functionality is in Mx 1.0 using the functions \eval() and \evec(). We should get around to implementing them in OpenMx. We will probably implement a subset of the R function eigen() that does not use either named arguments or boolean arguments, since OpenMx does not support either of these constructs. I think we'll write one function in R that does

Re(eigen(foo, only.values = TRUE)$values)   # omxEigenRealVal?

and another that does

Re(eigen(foo)$vectors)   # omxEigenRealVec? 
Replied on Thu, 12/24/2009 - 13:24
Picture of user. HanOud Joined: 12/20/2009

In reply to by Steve

Steve and mspiegel,
Could you also implement the imaginary parts
Im(eigen(foo, only.values = TRUE)$values) # omxEigenRealVal?
and
Im(eigen(foo)$vectors) # omxEigenRealVec?
as well as the exponential function exp()? All three are announced in the OpenMx reference Manual and are for me the main reason to change from Mx to openMx. I would be happy to be able to take the exponential function of complex eigenvalues as it is possible in R. Thanks. Han
Replied on Tue, 04/12/2011 - 09:06
Picture of user. tbrick Joined: 07/31/2009

In reply to by pdeboeck

?eigenvec for details.

There are different functions for real and imaginary parts, and different functions for eigenvectors and eigenvalues.

Just a note, these are pretty slow right now. But they work, and are implemented in both the 1.0 release and the developer's trunk.

Replied on Tue, 02/16/2010 - 17:17
No user picture. manu Joined: 10/08/2009

In reply to by Steve

Dear all,
just to make sure I understand things correctly: There is currently no way to compute a matrix exponential in openMx, right? In Mx this was possible via the eval() and evec() functions, but both are not (yet) implemented in openMx, right? Are you planning to implement these functions soon? Thank you so much for your help!
Replied on Fri, 04/30/2010 - 14:52
Picture of user. tbrick Joined: 07/31/2009

In reply to by manu

As of OpenMx 0.3.0, the eigenvec and eigenval (as well as ieigenvec and ieigenval, for the imaginary parts) have been implemented for eigenvector and eigenvalue decomposition.

Please give them a try--we welcome your comments.

Replied on Sat, 12/26/2009 - 10:32
Picture of user. HanOud Joined: 12/20/2009

Dear mspiegel,
Just out of curiosity. Your implementations of Mx algebra functions are also in R? Where can I find e.g. how function mxAlgebra(sin(),name="") looks like in R?
Han
Replied on Sat, 12/26/2009 - 15:23
Picture of user. mspiegel Joined: 07/31/2009

In reply to by HanOud

Ah. So each matrix operator or function that is supported by OpenMx is implemented twice. One of these implementations is the operator/function as supported in the R language. So the sin() function is the R primitive for the trigonometric function. The implementation of the R primitive is available in the R source code. But each matrix operator or function is also implemented by the OpenMx developers in C. This is because we use a FORTRAN numeric optimizer and compute the algebra expression in C without any callbacks to the R interpreter. To see our implementation of the matrix functions you can look at http://openmx.psyc.virginia.edu/repoview/1/trunk/src/omxAlgebraFunctions.c. To see the mapping of names look at http://openmx.psyc.virginia.edu/repoview/1/trunk/data/omxSymbolTable.tab. The 3rd column is the name in R, and the 5th column is the function name in C.
Replied on Wed, 04/27/2011 - 10:58
Picture of user. jdellava Joined: 10/14/2009

I am trying to run a statement: mxAlgebra(cbind(min(Re(eigen(mzmef, only.values=T)$values)), min(Re(eigen(corDZM, only.values=T)$values))), name =xy). First I got an unknown reference to T; I changed it to mxAlgebra(cbind(min(Re(eigen(mzmef, only.values==T)$values)), min(Re(eigen(corDZM, only.values==T)$values))), name =xy) and got an unknown reference to only.values. I was wondering if there is a work around.

Thank you!