MxAlgebra wishlist

mspiegel's picture
Category:feature request

The following algebras would be nice to have. They are currently scheduled for completion after the 1.0 release:

ceiling, floor, trunk, round
rowMeans, colMeans


tbates's picture


Scripts often involve computing A %*% t(A) or A %*% t(B)
It would be a handy help to have an mx function return multiply by transpose
I realise that this is not (or at least I can't see) a standard, but it would make scripting more compact and quicker to type and maintain, just as %&% and cov2cor() do.

tx(A) = A %*% t(A)
tx(A,B) = A %*% t(B)

neale's picture


Er, we still don't have cov2cor() in the OpenMx backend?

Error: Unknown matrix operator or function 'cov2cor' in mxAlgebra(t(vechs(cov2cor(ACE.expCovMZ))), name = "MZexpcor")

mspiegel's picture


Oops. I checked in a change to the svn trunk that implements cov2cor in the backend.

tbates's picture


Update for the addition of vec2diag()

Can we have diag() and chol() please?

The functionality of diag() is supported by vec2diag()

Unlike diag, this function always tries to populate a square matrix from a diagonal vector. i.e., vec2diag(3) etc won't act as you expect from using diag(3)

Would still be good to support chol() in algebras

mhunter's picture


We have strayed away from diag() because R's behavior is so ambiguous. diag(3), diag(1:3), and diag(matrix(1:9, 3, 3)) are all distinct entities to OpenMx. They are mxMatrix('Diag', 3, 3, FALSE, 1), vec2diag(c(1, 2, 3)), and diag2vec(foo), respectively in OpenMx.

We currently support chol(). Mike Neale added it some time ago, I believe.

tbates's picture


ahh, chol() is in 1.3.2 (tried in a 1.3.1 install)

added chol and cov2cor to the mxAlgebra.Rd