eigenvalues
Posted on

Forums
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'
Unfortunately, not all
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.
Log in or register to post comments
In reply to Unfortunately, not all by Steve
Yeah. This functionality is
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
and another that does
Log in or register to post comments
In reply to Yeah. This functionality is by mspiegel
That seems like a good
That seems like a good solution. Does that work for you, Han?
Log in or register to post comments
In reply to That seems like a good by Steve
Steve and mspiegel, Could you
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
Log in or register to post comments
In reply to Steve and mspiegel, Could you by HanOud
That sounds like a good idea
That sounds like a good idea to me. The imaginary parts are also in Mx 1.0 (they are \ival() and \ivec()), so we should support them.
Log in or register to post comments
In reply to That sounds like a good idea by mspiegel
eigen()
Is eigen() still on the list of things to do?
Log in or register to post comments
In reply to eigen() by pdeboeck
eigenvec, eigenval, ieigenvec, ieigenval
?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.
Log in or register to post comments
In reply to eigenvec, eigenval, ieigenvec, ieigenval by tbrick
Thanks
Thanks! Sorry for the silly question --- I didn't see them under ?mxAlgebra, so I missed them.
Log in or register to post comments
In reply to Unfortunately, not all by Steve
Dear all, just to make sure I
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!
Log in or register to post comments
In reply to Dear all, just to make sure I by manu
That is correct, an analogous
That is correct, an analogous function for classic Mx eval() and evec() have not been implemented. The earliest we can implement them is sometime in March.
Log in or register to post comments
In reply to That is correct, an analogous by mspiegel
thank you for your fast
thank you for your fast reply. March would be great - we are desperately looking forward to these functions!
Log in or register to post comments
In reply to thank you for your fast by manu
As of OpenMx 0.3.0, the
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.
Log in or register to post comments
Dear mspiegel, Just out of
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
Log in or register to post comments
In reply to Dear mspiegel, Just out of by HanOud
Ah. So each matrix operator
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.
Log in or register to post comments
only.values
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!
Log in or register to post comments
In reply to only.values by jdellava
The OpenMx functions are
The OpenMx functions are named eigenval, eigenvec, ieigenval, and ieigenvec. See
.
Log in or register to post comments