%dot% {calculus}R Documentation

Numerical and Symbolic Dot Product

Description

The dot product between arrays with different dimensions is computed by taking the inner product on the last dimensions of the two arrays.

Usage

x %dot% y

Arguments

x

numeric or character array.

y

numeric or character array.

Details

The dot product between two arrays A and B is computed as:

C_{i_1… i_m} = ∑_{j_1… j_n} A_{i_1… i_mj_1… j_n}B_{j_1… j_n}

Value

array.

References

Guidotti, E. (2020). "calculus: High dimensional numerical and symbolic calculus in R". https://arxiv.org/abs/2101.00086

See Also

Other basic arithmetic: %diff%(), %div%(), %inner%(), %kronecker%(), %outer%(), %prod%(), %sum%()

Examples

### inner product 
x <- array(1:12, dim = c(3,4))
x %dot% x

### dot product 
x <- array(1:24, dim = c(3,2,4))
y <- array(letters[1:8], dim = c(2,4))
x %dot% y


[Package calculus version 0.3.1 Index]