rh.seq: Apply 'rh' sequentially

View source: R/rh.seq.R

rh.seqR Documentation

Apply rh sequentially

Description

rh.seq sequentially applies the rh function to a. Specifically, if the length of x is d, then rh.seq(x, a) is equivalent to rh(x[[d]], rh(x[[d - 1]], ..., rh(x[[2]], rh(x[[1]], a))..)).

Usage

rh.seq(x, a, transpose = FALSE)

rh_seq(x, a, transpose = FALSE)

rhSeq(x, a, transpose = FALSE)

RhSeq(x, a, transpose = FALSE)

Arguments

x

A list of matrix-like objects

a

A matrix-like object (with dimensions)

transpose

A logical value. The Default is FALSE. If TRUE, then the transpose of A

Value

A matrix or Matrix-class.

Examples

# generate x, a
x = list(matrix(rnorm(100), nrow = 10),
         matrix(rnorm(100), nrow = 10))
a = matrix(rnorm(100), nrow = 10)

# three equivalent forms
rhs1 = rh.seq(x, a)
rhs2 = rh(x[[2]], rh(x[[1]], a))
rhs3 = x[[1]] %*% a %*% t(x[[2]])

# check equality
all.equal(rhs1, rhs2)
all.equal(rhs1, rhs3)

hero documentation built on July 26, 2023, 5:11 p.m.