tensor | R Documentation |
Creates a labeled array (tensor) from an array. %_%
and tensor()
serve
the same purpose, but typically usage of %_%
is preferred due to
brevity.
tensor()
is exported to provide a standard-evaluation interface
as well which might be useful under some circumstances.
tensor(a, index_names, index_positions, call = NULL)
a %_% i
a |
An array or any object that can be coerced to an array via
|
index_names |
A character vector of index names / labels. |
index_positions |
A character vector of index positions with two allowed
values "+" and "-", for "upper" and "lower" position respectively.
The length of |
call |
For internal use only. |
i |
An index slot label specification created with |
A labeled tensor object of class "tensor"
, an array()
with attached dimension labels. Note that the index structure
of the resulting tensor does not necessarily have to match i
. In case
implicit calculations are already triggered (e.g. contractions)
the index structure reflects the resulting tensor.
a <- array(1:4, dim = c(2, 2))
a %_% .(i, j)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.