einstein

0th

Percentile

Numerical and Symbolic Einstein Summation

Implements the Einstein notation for summation over repeated indices.

Usage
einstein(..., drop = TRUE)
Arguments
...

arbitrary number of indexed arrays.

drop

logical. Drop summation indices? If FALSE, keep dummy dimensions.

Value

array.

See Also

index, trace

Aliases
  • einstein
Examples
# NOT RUN {
##################################
# A{i,j} B{j,k,k} C{k,l} D{j,k}
#

a <- array(1:10, dim = c(2,5))
b <- array(1:45, dim = c(5,3,3))
c <- array(1:12, dim = c(3,4))
d <- array(1:15, dim = c(5,3))

index(a) <- c('i','j')
index(b) <- c('j','k','k')
index(c) <- c('k', 'l')
index(d) <- c('j', 'k')

einstein(a,b,c,d)


##################################
# A{i,j} B{j,k}
#

a <- array(letters[1:6], dim = c(2,3))
b <- array(letters[1:12], dim = c(3,4))

index(a) <- c('i','j')
index(b) <- c('j','k')

einstein(a,b)

# }
Documentation reproduced from package calculus, version 0.1.0, License: GPL-3

Community examples

Looks like there are no examples yet.