Inverse of dcm_vec: splits a flat numeric vector across the
shape implied by one or more template arguments.
dcm_unvec(vX, ...)A structure (or list of structures) matching the templates.
dcm_vec for the forward operation.
# Round-trip: flatten a structure and rebuild it
P <- list(A = matrix(1:4, 2), C = c(5, 6))
identical(dcm_unvec(dcm_vec(P), P), P)
#> [1] FALSE
# The template supplies the shape; the vector supplies the values
tmpl <- list(A = matrix(0, 2, 2), C = numeric(2))
dcm_unvec(1:6, tmpl)
#> $A
#> [,1] [,2]
#> [1,] 1 3
#> [2,] 2 4
#>
#> $C
#> [1] 5 6
#>