multensor: Tensor multiplication for the tensor class

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Performs a tensor multiplication like tensor(), but with named indices, keeping dimnames, and vectorized.

Usage

1
mul.tensor(X,i=c(),Y,j=i,by=NULL)

Arguments

X

a tensor to be multiplied

i

numeric or character vector specifying the dimension to be used in the multiplication for X

Y

a tensor to be multiplied

j

numeric or character vector specifying the dimension to be used in the multiplication for Y

by

the by dimensions if present and not mentioned in i or j are used as sequence dimensions. tensors in these dimensions are processed in parallel. So in this dimension the product is neither inner nor outer but parallel like a*b, rather than a%*%b or a%o%b. Unmentioned dimensions get an outer product. Mentioned dimensions an inner.

Details

Say

X_{i_1… i_n h_1 … h_l}

and

Y_{j_1… j_n k_1 … k_m}

the the result is:

E_{h_1… h_l k_1 … k_m}= ∑_{i_1,…,i_n} X_{i_1… i_n h_1 … h_l}Y_{j_1… j_n k_1 … k_m}

This is an full outer product with i,j not given and a full inner product product of i=dim(X)

Value

The tensor product of X and Y with respect to the regarding dimensions.

Author(s)

K. Gerald van den Boogaart

See Also

to.tensor, %e%, %r%, diagmul.tensor, einstein.tensor, riemann.tensor, solve.tensor

Examples

1
2
3
A <- to.tensor(1:20,c(A=2,B=2,C=5))
B <- to.tensor(1:20,c(D=2,B=2,E=5))
mul.tensor(A,"A",A,"B")

tensorA documentation built on Nov. 20, 2020, 9:07 a.m.

Related to multensor in tensorA...