build_tensor: Build Tensor

Description Usage Arguments Value Author(s) Examples

Description

Tensor products of Matrices.

Usage

1

Arguments

x

a matrix, or list of numeric matrices, build the tensor product

...

additional numeric matrices to build the tensor product

Value

A matrix

Author(s)

Peter DeWitt dewittpe@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# see vignette("cpr-pkg", package = "cpr") for details on tensor products.

A <- matrix(1:4, nrow = 10, ncol = 20)
B <- matrix(1:6, nrow = 10, ncol = 6)

# Two ways of building the same tensor product
tensor1 <- build_tensor(A, B) 
tensor2 <- build_tensor(list(A, B))
all.equal(tensor1, tensor2)

# a three matrix tensor product
tensor3 <- build_tensor(A, B, B)
str(tensor3)

Example output

[1] TRUE
 num [1:10, 1:720] 1 8 27 64 25 72 3 16 9 32 ...

cpr documentation built on May 1, 2019, 10:46 p.m.