Learn R Programming

stokes (version 1.1-3)

cross: Cross products of \(k\)-tensors

Description

Cross products of \(k\)-tensors

Usage

cross(U, ...)
cross2(U1,U2)

Value

The functions documented here all return a spray object.

Arguments

U,U1,U2

Object of class ktensor

...

Further arguments, currently ignored

Author

Robin K. S. Hankin

Details

Given a \(k\)-tensor \(S\) and an \(l\)-tensor \(T\), we can form the cross product \(S\otimes T\), defined as

S T(v_1,...,v_k,v_k+1,..., v_k+l)= S(v_1,... v_k) T(v_k+1,... v_k+l).omitted; see latex

Package idiom for this includes cross(S,T) and S %X% T; note that the cross product is not commutative. Function cross() can take any number of arguments (the result is well-defined because the cross product is associative); it uses cross2() as a low-level helper function.

References

Spivak 1961

See Also

ktensor

Examples

Run this code

(A <- ktensor(spray(matrix(c(1,1,2,2,3,3),2,3,byrow=TRUE),1:2)))
(B <- ktensor(spray(10+matrix(4:9,3,2),5:7)))
cross(A,B)

A %X% B - B %X% A


Va <- matrix(rnorm(9),3,3)
Vb <- matrix(rnorm(38),19,2)

LHS <- as.function(A %X% B)(cbind(rbind(Va,matrix(0,19-3,3)),Vb))
RHS <-  as.function(A)(Va) * as.function(B)(Vb)

c(LHS=LHS,RHS=RHS,diff=LHS-RHS)



Run the code above in your browser using DataLab