Computes the inner product of two numeric or character arrays.

x %inner% y

Arguments

x

numeric or character array.

y

numeric or character array.

Value

numeric or character.

Details

The inner product between two arrays A and B is computed as: $$C = \sum_{j_1\dots j_n} A_{j_1\dots j_n}B_{j_1\dots j_n}$$

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%(), %dot%(), %kronecker%(), %outer%(), %prod%(), %sum%()

Examples

### numeric inner product x <- array(1:4, dim = c(2,2)) x %inner% x
#> [1] 30
### symbolic inner product x <- array(letters[1:4], dim = c(2,2)) x %inner% x
#> [1] "(a) * (a) + (b) * (b) + (c) * (c) + (d) * (d)"