Learn R Programming

diagonals (version 0.2.0)

block_matrix: Block Matrix

Description

Block Matrix

Usage

block_matrix(x, steps = NULL, size = NULL, replacement = 0)

Arguments

x
a square matrix where the dimensions are integer multiples of size or integer dividors of steps
steps
the required number of steps (block matrices) across the diagonal
size
the width or height of the matrix being dropped over the diagonal of matrix x
replacement
value to be inserted on the diagonal, by default this is zero (0).

Details

Either steps or size is expected to be provided.

Examples

Run this code
# create a square matrix
m <- matrix(1:64, nrow=8)

# select a block matrix with two steps
block_matrix(m, steps=2)

# select a block matrix with four steps
block_matrix(m, steps=4)

Run the code above in your browser using DataLab