replaceBand: Replace matrix values by band.

Description Usage Arguments Value Author(s) Examples

View source: R/global.R

Description

F matrices utility function.

Usage

1
replaceBand(a, b, k)

Arguments

a

The matrix to be replaced

b

The matrix with the replacement values

k

The extend of the replacement: 0 (diagonal only), 1 (diagonal and first extra diagonal), in general an entry is replaced if abs(row(a) - col(a)) <= k

Value

A matrix (same size as a)

Author(s)

Bertrand Frederic, Myriam Maumy-Bertrand.

Examples

1
2
3
4
5
a=matrix(1:9,3,3)
b=matrix(0,3,3)
replaceBand(a,b,0)
replaceBand(a,b,1)
replaceBand(a,b,2)

fbertran/Patterns documentation built on Dec. 4, 2019, 1:12 p.m.