An mxAlgebra to resize a matrix

mhunter's picture
Project:OpenMx
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Duplicate the R behavior of matrix(1:12, 3, 4) as an OpenMx algebra.

Comments

tbates's picture

#1

Is the innovation here not so much resize, but allowing the creation of greater than 1×1 matrices in algebra (we've only allow automatic up-shifting of number into a 1×1 matrix till now?

This would allow creation of arbitrary matrices (which is useful), but I think was decided against in the past?

perhaps supporting matrix in an algebra would be enough...

  mxMatrix(name="a", values = 1:12, nrow=3,ncol=4)
  mxAlgebra(matrix(a,1,12), name = "vector")

mhunter's picture

#2

mxAlgebras can currently evaluate to any arbitrary size matrix, e.g. solve(I-A) %*% S %*% t(solve(I-A)) often is an NxN matrix. The innovation is mostly that you could take a vector, restructure it as a matrix, and then use matrix operations on the new matrix.

tbates's picture

#3

Yes, I was meaning not that algebras can't output arbitrary matrices, but that these are all illegal, no?

	mxAlgebra(mxMatrix("Full",3,4,values=c(1:12)), name="a"),
	mxAlgebra(matrix(c(1:12),3,4), name="b"),
	mxAlgebra(c(1:12), name="c"),