add.tensor: Element-wise arithmetic operations +,-,*,/ with tensors
Description
Adds/subs/multiplies/devides tensors element by element .
The luxury difference to a simple + is that we
do not need to consider the correct permutation of indices or rules
on implicit replication, since all of this is handled automatically.
Usage
add.tensor(X,Y,op="+",only=NULL)
## Methods for class tensor
# x + y
# x - y
# x * y
# x - y
Arguments
X
a tensor
Y
a tensor
op
a binary function used to perform the "addition"
only
a list of dimnames that may be considered as equal. This
parameter is here to allow parallelization of tensors with only
partially known structure.
Value
A tensor giving the element-wise operation X,Y. If some of the
indices are missing in one of the tensors they are added by repetition.
Details
The tensors are properly reordered such that dimensions of the same
name are identified. If dimensions are missing in one of the tensors
it is correspondingly repeated.