Description Usage Arguments Details Value Author(s) See Also Examples
In typical tensor notation the indices are not identified by names but by positions. The operators allow to identify names and positions transparently during calculation.
1 2 3 4 5 | ## Methods for class tensor
# x $ y
# x ^ y
# x | y
renamefirst.tensor(x,y)
|
x |
A tensor |
y |
Typically a character vector specifying a sequence of names for the
tensor. The names can be specified in various ways: |
These functions are used to mimic the mathematical notation in tensor analysis. Formulae of the form (with Einstein convention):
E_ijk= A_ihl C_hj C_lk
with defined tensors A_ijk and C_ij can
be given the
simple
form
E <- A$ihl %e% C$hj %e% C$lk |"$ijk"
or alternatively for multi letter names:
E <- A$i.h.l %e% C$h.j %e% C$l.k |"i.j.k"
or more flexible in computation with arguments I,J,K:
E <- A^c(I,"h.l") %e% C^c("h",J) %e% C^c("l",K) | c(I,J,K)
The $
or ^
binds to the tensors with high precedence
and renames the first elements. The |
binds with very low
precedence and reorders the tensor according to the
assumed index sequence of the result afterwards.
A tensor of the same shape as x but with reordered dimensions (for
|
) or renamed dimensions (for the others)
K. Gerald van den Boogaart
reorder.tensor
, names<-.tensor
, [[.tensor
1 2 3 4 5 6 7 8 9 10 11 12 13 | A <- to.tensor(1:20,c(i=5,j=2,k=2))
C <- to.tensor(1:4,c(i=2,j=2))
E <- A$ihl %e% C$hj %e% C$lk |"$ijk"
E
# Same as:
E2 <- reorder.tensor(A[[j=~h,k=~l]] %e% C[[i=~h]] %e% C[[i=~l,j=~k]],c("i","j","k"))
E-E2
E <- A$i.h.l %e% C$h.j %e% C$l.k |"i.j.k"
E
E-E2
E <- A^"i.h.l" %e% C^"h.j" %e% C^"l.k" |"i.j.k"
E
E-E2
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.