hierarchical_matrix {qrmtools}R Documentation

Construction of Hierarchical Matrices

Description

Constructing hierarchical matrices, used, for example, for hierarchical dependence models, clustering, etc.

Usage

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.

Details

See the examples for how to use.

Value

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.

Author(s)

Marius Hofert

Examples

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)

[Package qrmtools version 0.0-17 Index]