cross: Special combination of Matrix and Vector

View source: R/cross.R

crossR Documentation

Special combination of Matrix and Vector

Description

This operation is useful in recursively generating all the possible path histories of a sequential design.

Usage

cross(A, v)

Arguments

A

An arbitrary matrix

v

An arbitrary vector

Details

For each component of v, the matrix A is duplicated with an extra right column equal to v[i]. This is added to the current output until the components of v are exhausted.

Value

A matrix with dim(A)[2]+1 columns and dim(A)[1]*length(v) rows.

Author(s)

Chris J. Lloyd

Examples

A=cbind(c(1,2),c(3,4))
v=c(5,6)
cross(A,v)
#     [,1] [,2] [,3]
#[1,]    1    3    5
#[2,]    2    4    5
#[3,]    1    3    6
#[4,]    2    4    6

CLAST documentation built on April 8, 2022, 9:06 a.m.