Constructing hierarchical matrices, used, for example, for hierarchical dependence models, clustering, etc.
hierarchical_matrix(x, diagonal = rep(1, d))
Arguments
x: list of length 2 or 3 containing the homogeneous numeric
entry of the current block of the hierarchical matrix, the integer components belongning to the current block (or NULL) and, possibly, another (nested) list of the same type.
diagonal: diagonal elements of the hierarchical matrix.
Returns
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.
Details
See the examples for how to use.
Author(s)
Marius Hofert
Examples
rho <- c(0.2,0.3,0.5,0.8)# some entries (e.g., correlations)## Test homogeneous casex <- list(rho[1],1:6)hierarchical_matrix(x)## Two-level case with one block of size 2x <- 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 blockx <- list(rho[1],1:3, list(rho[2],4:5))hierarchical_matrix(x)## Test two-level case with three blocks of size 2x <- 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 casex <- 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 casex <- list(rho[1], c(3,6,1), list(rho[2], c(9,2,7,5), list(rho[3], c(8,4))))hierarchical_matrix(x)