This function is called by collapse_omega()
and collapse_sigma()
to
convert multiple matrix blocks into a single matrix block. This "collapsing"
of the matrix list is irreversible.
collapse_matrix(x, range = NULL, name = NULL)
an object that inherits from matlist
; this object is most
frequently extracted from a model object using omat()
or smat()
for
OMEGA
and SIGMA
, respectively
numeric vector of length 2 specifying the range of matrices
to collapse in case there are more than 2. The second element may be NA
to indicate the length of the list of matrices.
a new name for the collapsed matrix; note that this is the
matrix name, not the labels which alias ETA(n)
or EPS(n)
; specifying a
name will only alter how this matrix is potentially updated in the future
An update matlist
object (either omegalist
or sigmalist
).
omega <- omat(list(dmat(1, 2), dmat(3, 4, 5)))
omega
#> $...
#> [,1] [,2]
#> 1: 1 0
#> 2: 0 2
#>
#> $...
#> [,1] [,2] [,3]
#> 3: 3 0 0
#> 4: 0 4 0
#> 5: 0 0 5
#>
collapse_matrix(omega)
#> $...
#> [,1] [,2] [,3] [,4] [,5]
#> 1: 1 0 0 0 0
#> 2: 0 2 0 0 0
#> 3: 0 0 3 0 0
#> 4: 0 0 0 4 0
#> 5: 0 0 0 0 5
#>