This proposal is for a new objective function that allows for a generic row-by-row computation on a data-set, followed by a final computation to aggregate all the row-by-row results. The objective function takes four arguments.

mxRowObjective(rowAlgebra, rowResults = NA, reduceAlgebra = NA, name = NA).

All four arguments expect character vector (string) values. rowAlgebra is the name of a MxMatrix algebra in the model. This algebra is applied to each row in a model. The result of the rowAlgebra must be a (1 x m) matrix. The results of the rowAlgebra computations are collected into a (n x m) matrix that will be named with the 2nd argument. n in this case is the number of rows in the data matrix. If reduceAlgebra is NA, then the return value of the objective function is the rowResults matrix. Otherwise, execute the reduceAlgebra and return the value of that algebra.