There has been some talk recently of simplifying the MxAlgebra interface in two regards. It would be convenient to specify constant values or matrices in an MxAlgebra statement, without having to explicitly declare a separate MxMatrix that contains constant values. It would also be convenient to specify free parameters in an MxAlgebra statment, without having to explicitly declare a separate 1 x 1 MxMatrix that contains the free parameter. We have been referring to these proposed changes as constant substitution and free parameter substitution, respectively.
So here's how these substitutions are actually going to work. Assume 'foo' is either an argument to some function inside an MxAlgebra expression, or 'foo' is an operand to some operator inside an MxAlgebra expression. In the following order, check the following cases:
(1) Is 'foo' a constant scalar or matrix? If yes, then perform constant substitution.
(2) Otherwise is 'foo' a named entity or a free parameter? By named entity, I mean is it a reference to an MxAlgebra, MxMatrix, or MxObjectiveFunction. Named entities and free parameters cannot have overlapping names. If 'foo' is a named entity, then business as usual. If 'foo' is a free parameter, then perform free parameter substitution by creating a 1 x 1 MxMatrix.
(3) Otherwise is 'foo' a global variable? If yes, and foo refers to a scalar, a vector, or a matrix, then perform constant substitution. Vectors are converted to n x 1 matrices (try as.matrix(), it's the default behavior).
(4) Otherwise, 'foo' is an unknown reference and we have an error.
So the order is: