rh.seq: Apply 'rh' sequentially

Description Usage Arguments Value Examples

View source: R/rh.seq.R

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

1
2
3
4
5
6
7
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# 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 Jan. 25, 2020, 1:07 a.m.