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.
Arguments
- a
An array or any object that can be coerced to an array via
as.array().- 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
index_positionsneeds to agree with the length ofindex_names.- call
For internal use only.
- i
An index slot label specification created with
.().
Value
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.