Interface TensorOverRing<T extends TensorOverRing<T,U,V,W>,U extends TensorOverRing<U,U,V,W>,V,W>
- Type Parameters:
T
- Type of this tensor.U
- Type of dense tensor equivalent toT
. IfT
is dense, then this should be the same type asT
. This parameter required because some ops between two sparse tensors may result in a dense tensor.V
- Storage for data of this tensor.W
- Type (or wrapper) of an element of this tensor. Should satisfy the axioms of a semiring as stated.
- All Superinterfaces:
TensorOverSemiring<T,
U, V, W>
- All Known Subinterfaces:
FieldTensorMixin<T,
,U, V> RingTensorMixin<T,
,U, V> TensorOverField<T,
U, V, W>
- All Known Implementing Classes:
AbstractCooFieldMatrix
,AbstractCooFieldTensor
,AbstractCooFieldVector
,AbstractCooRingMatrix
,AbstractCooRingTensor
,AbstractCooRingVector
,AbstractCsrFieldMatrix
,AbstractCsrRingMatrix
,AbstractDenseDoubleTensor
,AbstractDenseFieldMatrix
,AbstractDenseFieldTensor
,AbstractDenseFieldVector
,AbstractDenseRingMatrix
,AbstractDenseRingTensor
,AbstractDenseRingVector
,AbstractDoubleTensor
,CMatrix
,CooCMatrix
,CooCTensor
,CooCVector
,CooFieldMatrix
,CooFieldTensor
,CooFieldVector
,CooMatrix
,CooRingMatrix
,CooRingTensor
,CooRingVector
,CooTensor
,CooVector
,CsrCMatrix
,CsrFieldMatrix
,CsrMatrix
,CsrRingMatrix
,CTensor
,CVector
,FieldMatrix
,FieldTensor
,FieldVector
,Matrix
,RingMatrix
,RingTensor
,RingVector
,Tensor
,Vector
public interface TensorOverRing<T extends TensorOverRing<T,U,V,W>,U extends TensorOverRing<U,U,V,W>,V,W>
extends TensorOverSemiring<T,U,V,W>
This interface specifies methods which any tensor whose data are elements of a ring should implement. This includes
primitive values.
To allow for primitive types, the elements of this tensor do not necessarily have to implement
Ring
.
Formally, a ring is a set R with the binary ops addition (+) and multiplication (*) defined such that for elements a, b, c in R the following are satisfied:
- Addition and multiplication are associative: a + (b + c) = (a + b) + c and a * (b * c) = (a * b) * c.
- Addition is commutative: a + b = b + a
- Existence of additive and multiplicative identities: There exists two distinct elements 0 and 1 in R such that a + 0 = 0 and a * 1 = 1 (called the additive and multiplicative identities respectively).
- Distributivity of multiplication over addition: a * (b + c) = (a * b) + (a * c).
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionabs()
Computes the element-wise absolute value of this tensor.int[]
argmax()
Finds the indices of the maximum value in this tensor.int[]
Finds the indices of the maximum absolute value in this tensor.int[]
argmin()
Finds the indices of the minimum value in this tensor.int[]
Finds the indices of the minimum absolute value in this tensor.conj()
Computes the element-wise conjugation of this tensor.default T
H()
Computes the conjugate transpose of a tensor by exchanging the first and last axes of this tensor and conjugating the exchanged values.H
(int... axes) Computes the conjugate transpose of this tensor.H
(int axis1, int axis2) Computes the conjugate transpose of a tensor by conjugating and exchangingaxis1
andaxis2
.max()
Finds the maximum value in this tensor.double
maxAbs()
Finds the maximum absolute value in this tensor.min()
Finds the minimum value in this tensor.double
minAbs()
Finds the minimum value, in absolute value, in this tensor.Computes the element-wise difference between two tensors of the same shape.Subtracts a scalar value from each entry of this tensor.void
Subtracts a scalar value from each entry of this tensor and stores the result in this tensor.
-
Method Details
-
sub
-
subEq
Subtracts a scalar value from each entry of this tensor and stores the result in this tensor.- Parameters:
b
- Scalar value in difference.
-
sub
Computes the element-wise difference between two tensors of the same shape.- Parameters:
b
- Second tensor in the element-wise difference.- Returns:
- The difference of this tensor with
b
. - Throws:
TensorShapeException
- If this tensor andb
do not have the same shape.
-
abs
TensorOverRing abs()Computes the element-wise absolute value of this tensor.- Returns:
- The element-wise absolute value of this tensor.
-
conj
T conj()Computes the element-wise conjugation of this tensor.- Returns:
- The element-wise conjugation of this tensor.
-
H
Computes the conjugate transpose of a tensor by exchanging the first and last axes of this tensor and conjugating the exchanged values.- Returns:
- The conjugate transpose of this tensor.
- See Also:
-
H
Computes the conjugate transpose of a tensor by conjugating and exchangingaxis1
andaxis2
.- Parameters:
axis1
- First axis to exchange and conjugate.axis2
- Second axis to exchange and conjugate.- Returns:
- The conjugate transpose of this tensor according to the specified axes.
- Throws:
IndexOutOfBoundsException
- If eitheraxis1
oraxis2
are out of bounds for the rank of this tensor.- See Also:
-
H
Computes the conjugate transpose of this tensor. That is, conjugates and permutes the axes of this tensor so that it matches the permutation specified byaxes
.- Parameters:
axes
- Permutation of tensor axis. If the tensor has rankN
, then this must be an array of lengthN
which is a permutation of{0, 1, 2, ..., N-1}
.- Returns:
- The conjugate transpose of this tensor with its axes permuted by the
axes
array. - Throws:
IndexOutOfBoundsException
- If any element ofaxes
is out of bounds for the rank of this tensor.IllegalArgumentException
- Ifaxes
is not a permutation of{1, 2, 3, ... N-1}
.- See Also:
-
min
-
max
-
argmin
int[] argmin()Finds the indices of the minimum value in this tensor.- Returns:
- The indices of the minimum value in this tensor. If this value occurs multiple times, the indices of the first entry (in row-major ordering) are returned.
-
argmax
int[] argmax()Finds the indices of the maximum value in this tensor.- Returns:
- The indices of the maximum value in this tensor. If this value occurs multiple times, the indices of the first entry (in row-major ordering) are returned.
-
argminAbs
int[] argminAbs()Finds the indices of the minimum absolute value in this tensor.- Returns:
- The indices of the minimum absolute value in this tensor. If this value occurs multiple times, the indices of the first entry (in row-major ordering) are returned.
-
argmaxAbs
int[] argmaxAbs()Finds the indices of the maximum absolute value in this tensor.- Returns:
- The indices of the maximum absolute value in this tensor. If this value occurs multiple times, the indices of the first entry (in row-major ordering) are returned.
-
minAbs
double minAbs()Finds the minimum value, in absolute value, in this tensor.- Returns:
- The minimum value, in absolute value, in this tensor.
-
maxAbs
double maxAbs()Finds the maximum absolute value in this tensor.- Returns:
- The maximum absolute value in this tensor.
-