build_tensor: Build Tensor

View source: R/build_tensor.R

build_tensorR Documentation

Build Tensor

Description

Tensor products of Matrices.

Usage

build_tensor(x = NULL, y = NULL, ...)

Arguments

x

a matrix

y

a matrix

...

additional numeric matrices to build the tensor product

Value

a matrix

A matrix

See Also

vignette("cnr", package = "cpr") for details on tensor products.

Examples


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 <- do.call(build_tensor, list(A, B))
all.equal(tensor1, tensor2)

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


dewittpe/cpr documentation built on Feb. 16, 2024, 1:11 p.m.