* and %x% operators in mxAlgebra
Posted on
carey
Joined: 10/19/2009
Forums
anyone explain this?
> model2 <- mxModel(model1, mxAlgebra(.5*CTf, name="CTDZf"))
> model2 <- mxRun(model2)
Running SameMZDZf
Error in runHelper(model, frontendStart, intervals, silent, suppressWarnings, :
BLAS/LAPACK routine 'DPOTRF' gave error code -4
> model2 <- mxModel(model1, mxAlgebra(.5 %x% CTf, name="CTDZf"))
> model2 <- mxRun(model2)
Running SameMZDZf
Warning message:
In model 'SameMZDZf' NPSOL returned a non-zero status code 1. blah blah ...
yet
> mat <- matrix(rnorm(16), 4)
> .5 * mat == .5 %x% mat
[,1] [,2] [,3] [,4]
[1,] TRUE TRUE TRUE TRUE
[2,] TRUE TRUE TRUE TRUE
[3,] TRUE TRUE TRUE TRUE
[4,] TRUE TRUE TRUE TRUE
suspect something simple. if not, i can send the MxModel.
greg
Which version of OpenMx are
There are three multiplication operators in OpenMx (operators and functions). "*" performs elementwise-multiplication. "%*%" performs matrix-multiplication. And "%x%" is the kronecker product. The reason for these three operators is that OpenMx is a matrix processing language. In R, the "*" operator will perform a element-scalar multiplication if one argument is scalar, or elementwise-multiplication if both arguments are matrices. In OpenMx, the scalar value is transformed into a 1 x 1 matrix.
In the OpenMx 1.1 release, the expression
mxEval(bar, model, compute=TRUE)
will return an error. It currently does not return an error, but this is a bug. We had to rewrite a significant portion of the evaluation routines in order to clean this up.Log in or register to post comments
In reply to Which version of OpenMx are by mspiegel
merci, mike am using version
am using version 1.0.3-1505.
suggest that you change the documentation for mxAlgebra from
expression An R expression of matrix operators and matrix functions.
to
expression An expression of OpenMx-supported R matrix operators and matrix functions
"*" is a valid matrix operator in R and in other matrix algebra languages because a 1 x 1 matrix is, by definition, a scalar and scalar*matrix is a legitimate operation.
Log in or register to post comments
In reply to merci, mike am using version by carey
> expression An expression
done
Log in or register to post comments