How desirable is it that we continue to support matrix and algebra substitution. Matrix substitution will take a 1 x 1 matrix with name 'foo', and then any other matrix with the fixed parameter named 'foo' will get the value stored in the 'foo' matrix. Algebra substitution will take a 1 x 1 matrix with name 'foo', and then any other matrix with the fixed parameter named 'foo' will get the value computed by the 'foo' algebra. This idea is completely orthogonal to constant substitution and free parameter substitution. The target of matrix and algebra substitution is a matrix, while the target of constant substitution and free parameter substitution is an algebra.
The problem is that including matrix and algebra substitution prevents us from making the rule that free parameters, fixed parameters, and named entities all must have non-overlapping names. Personally I find matrix and algebra substitution a bit confusing. Take a look at this example that is in our test suite. Is it intuitive what is happening here?
aMatrix <- mxMatrix(values = matrix(1, 1, 1), name = 'a') bMatrix <- mxMatrix(values = matrix(2, 1, 1), name = 'b') cMatrix <- mxMatrix(values = matrix(3, 1, 1), name = 'c') dMatrix <- mxMatrix(values = matrix(4, 1, 1), name = 'd') eMatrix <- mxMatrix(labels = c('a','b','c','d'), nrow = 2, ncol = 2, byrow = TRUE, name = 'e') model <- mxModel(aMatrix, bMatrix, cMatrix, dMatrix, eMatrix) model <- mxRun(model) expected <- matrix(c(1, 2, 3, 4), nrow = 2, ncol = 2, byrow = TRUE) omxCheckEquals(mxEval(e, model), expected)
Is there a strong use case for matrix and algebra substitution? Because otherwise I am in favor of eliminating this feature.