File: FixedAlgebra.R

package info (click to toggle)
r-cran-openmx 2.21.13%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,716 kB
  • sloc: cpp: 36,559; ansic: 13,821; fortran: 2,001; sh: 1,440; python: 350; perl: 21; makefile: 11
file content (17 lines) | stat: -rw-r--r-- 463 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
library(OpenMx)
library(testthat)

t1 <- mxModel(
  "test",
  mxMatrix("Full", 2,2,values=1:4, free=TRUE, name="z"),
  mxAlgebra(z, name="zCopy", fixed=TRUE, initial=matrix(1., 2,2))
  )

t1 <- expect_warning(mxRun(t1),
                     "set for onDemand recompute yet is still at initial values")
omxCheckEquals(t1$zCopy$result, matrix(1., 2,2))

t2 <- mxModel(t1, mxComputeOnce("zCopy", 'fit'))

t2 <- mxRun(t2)
omxCheckEquals(t2$zCopy$result, t2$z$values)