I implemented the square bracket operator for MxAlgebra expressions. In an algebra it is now possible to write A[x, y] or A[,y] or A[x,] or A[,]. x and y must be either numeric literal values, or they can also be an arbitrary 1 x 1 matrices if you want to get fancy. A lion's share of the credit should be attributed to Tim Brick. The matrix operator and function interface that we designed made it fairly easy to implement this operator. It seemed like the square-bracket operator might be useful. See models/passing/AlgebraComputePassing.R for some examples.

For developers: in R the expression A[x,] is parsed as a function with three arguments. The three arguments are A, x, and "". The OpenMx library will now translate any "" it sees inside an algebra expression into a 0 x 0 constant matrix. This is legitimate because we have forbidden the use of "" as either a free/fixed parameter label or the name of an entity. I don't know if this trick will be recycled for other uses, but feel free to use it.

One comment on the current changes: I decided that A[x,] should return a row matrix and A[,y] should return a column matrix. This is different from the behavior in R. R will return a vector in either case (not a matrix). It would appear that when vector and matrix are used in R in an operation, the vector is converted to the "correct" dimensions to make the operation succeed. Thoughts on my implementation? Should both cases return a row matrix? Should both cases return a column matrix? Currently conformability testing will succeed on some error conditions because R is flexible with vectors and matrices. I believe I can convert the A[x,] expressions into the correct as.matrix() expressions inside the mxEval(compute=TRUE) call. Any problems with this approach?