Tensor multiplication with Einstein's convention, by summing over all equally named indices.

Share:

Description

Multiplies tensors by multiplying over all duplicate names according to Einsteins summing convention by doing an implicit inner product over all dimensions with the same name.

Usage

1
2
3
4
5
einstein.tensor(...,only=NULL,by=NULL)
## Methods for class tensor
# x %e% y
## Default method
# x %e% y

Arguments

...

some tensors, or a renaming code

only

optional list, if given only names in this list are automatically processed

x

a tensor

y

a tensor

by

the parallel dimensions

Details

see mul.tensor on details on tensor multiplication. In einstein.tensor complex operations can be performed by command and renaming code: The arguments are processed from left to right and multiplied. Unnamed attributes are regarded as tensors or scalars and multiplied with the current result by the Einstein summing convention, which means an inner product over all dimensions with the same name. Named attributes can either have the name diag, which performs a diagmul according to the same-name convention or be of the form A="B" or "A"="B", for which we have two cases. If both names are present in the current result, an inner multiplication (trace) of on these two dimensions is performed. If only the first is a name up to this point, the specific dimension is renamed to the second name. This renaming might be visible in the result or inducing a multiplication according to the Einstein convention later.

Value

the tensor product of all the tensors along all duplicate dimensions.

Author(s)

K. Gerald van den Boogaart

See Also

mul.tensor, to.tensor, riemann.tensor

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
A <- to.tensor(1:20,c(U=2,V=2,W=5))
B <- to.tensor(1:30,list(U=c("a","b","c"),V=c("B1","B2"),W=1:5))
einstein.tensor(A,U="U'",B)
einstein.tensor(A,U="U'",mark(B,"k"))
einstein.tensor(A,U="U'",mark(B,"k"),V="Vk",W="Wk")
einstein.tensor(A,U="U'",mark(B,"k"),V="Vk",W="Wk",1/10)
einstein.tensor(A,U="U'",mark(B,"k"),V="Vk",W="Wk",diag=to.tensor(c(1,1/10,1/100),c(Uk=3)))

ftable(einstein.tensor(A,U="U'",B))
ftable(einstein.tensor(A,U="U'",mark(B,"k")))
ftable(einstein.tensor(A,U="U'",mark(B,"k"),V="Vk",W="Wk"))
ftable(einstein.tensor(A,U="U'",mark(B,"k"),V="Vk",W="Wk",1/10))
ftable(einstein.tensor(A,U="U'",mark(B,"k"),V="Vk",W="Wk",diag=to.tensor(c(1,1/10,1/100),c(Uk=3))))

dim(A[[U=~M]])
A[[U=~M]] 
A[[U=~M,V=~"L"]] 

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.