Skip to contents

Sums A's entries within each (row-group, column-group) block – TDA's mag. row_groups/col_groups assign each row/column of A to a group (any positive integers; groups need not be contiguous or start at 1). The result has one row per distinct value in row_groups and one column per distinct value in col_groups, in ascending order of group number.

Usage

tda_mag(A, row_groups, col_groups, dir = tempfile("tda"))

Arguments

A

a numeric matrix.

row_groups

integer group index for each row, length nrow(A).

col_groups

integer group index for each column, length ncol(A).

dir

working directory.

Value

A numeric matrix.

See also

Examples

A <- matrix(1:12, 3, 4, byrow = TRUE)
tda_mag(A, row_groups = c(1, 2, 1), col_groups = c(1, 1, 2, 2))
#>      [,1] [,2]
#> [1,]   22   30
#> [2,]   11   15