View source: R/hierarchical_matrix.R
hierarchical_matrix | R Documentation |
Constructing hierarchical matrices, used, for example, for hierarchical dependence models, clustering, etc.
hierarchical_matrix(x, diagonal = rep(1, d))
x |
|
diagonal |
diagonal elements of the hierarchical matrix. |
See the examples for how to use.
A hierarchical matrix
of the structure
as specified in x
with off-diagonal entries as specified
in x
and diagonal entries as specified in diagonal
.
Marius Hofert
rho <- c(0.2, 0.3, 0.5, 0.8) # some entries (e.g., correlations) ## Test homogeneous case x <- list(rho[1], 1:6) hierarchical_matrix(x) ## Two-level case with one block of size 2 x <- list(rho[1], 1, list(rho[2], 2:3)) hierarchical_matrix(x) ## Two-level case with one block of size 2 and a larger homogeneous block x <- list(rho[1], 1:3, list(rho[2], 4:5)) hierarchical_matrix(x) ## Test two-level case with three blocks of size 2 x <- list(rho[1], NULL, list(list(rho[2], 1:2), list(rho[3], 3:4), list(rho[4], 5:6))) hierarchical_matrix(x) ## Test three-level case x <- list(rho[1], 1:3, list(rho[2], NULL, list(list(rho[3], 4:5), list(rho[4], 6:8)))) hierarchical_matrix(x) ## Test another three-level case x <- list(rho[1], c(3, 6, 1), list(rho[2], c(9, 2, 7, 5), list(rho[3], c(8, 4)))) hierarchical_matrix(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.