Interface SemiringTensorMixin<T extends SemiringTensorMixin<T,U,V>,U extends SemiringTensorMixin<U,U,V>,V extends Semiring<V>>
- Type Parameters:
T
- Type of this tensor.U
- Dense equivalent of this tensor. If this tensor is dense, this should be the same type asT
V
- Type of an element of this tensor. Satisfiessemiring
axioms.
- All Superinterfaces:
TensorOverSemiring<T,
U, V[], V>
- All Known Subinterfaces:
FieldTensorMixin<T,
,U, V> RingTensorMixin<T,
U, V>
- All Known Implementing Classes:
AbstractCooFieldMatrix
,AbstractCooFieldTensor
,AbstractCooFieldVector
,AbstractCooRingMatrix
,AbstractCooRingTensor
,AbstractCooRingVector
,AbstractCooSemiringMatrix
,AbstractCooSemiringTensor
,AbstractCooSemiringVector
,AbstractCsrFieldMatrix
,AbstractCsrRingMatrix
,AbstractCsrSemiringMatrix
,AbstractDenseFieldMatrix
,AbstractDenseFieldTensor
,AbstractDenseFieldVector
,AbstractDenseRingMatrix
,AbstractDenseRingTensor
,AbstractDenseRingVector
,AbstractDenseSemiringMatrix
,AbstractDenseSemiringTensor
,AbstractDenseSemiringVector
,CMatrix
,CooCMatrix
,CooCTensor
,CooCVector
,CooFieldMatrix
,CooFieldTensor
,CooFieldVector
,CooRingMatrix
,CooRingTensor
,CooRingVector
,CooSemiringMatrix
,CooSemiringTensor
,CooSemiringVector
,CsrCMatrix
,CsrFieldMatrix
,CsrRingMatrix
,CsrSemiringMatrix
,CTensor
,CVector
,FieldMatrix
,FieldTensor
,FieldVector
,RingMatrix
,RingTensor
,RingVector
,SemiringMatrix
,SemiringTensor
,SemiringVector
public interface SemiringTensorMixin<T extends SemiringTensorMixin<T,U,V>,U extends SemiringTensorMixin<U,U,V>,V extends Semiring<V>>
extends TensorOverSemiring<T,U,V[],V>
This interface provides default functionality for all tensors whose data are elements of a
Semiring
. This includes both
sparse and dense tensors.-
Method Summary
Modifier and TypeMethodDescriptiondefault T
Adds a scalar value to each entry of this tensor.default void
Adds a scalar value to each entry of this tensor and stores the result in this tensor.default int[]
argmax()
Finds the indices of the maximum value in this tensor.default int[]
argmin()
Finds the indices of the minimum value in this tensor.default boolean
isOnes()
Checks if this tensor only contains ones.default boolean
isZeros()
Checks if this tensor only contains zeros.default V[]
makeEmptyDataArray
(int length) Creates an empty array of the same type as the data array of this tensor.default V
max()
Finds the maximum value in this tensor.default V
min()
Finds the minimum value in this tensor.default T
Multiplies a scalar value to each entry of this tensor.default void
Multiplies a scalar value to each entry of this tensor and stores the result in this tensor.default V
prod()
Computes the product of all values in this tensor (or non-zero values if this tensor is sparse).default V
sum()
Computes the sum of all values in this tensor.
-
Method Details
-
makeEmptyDataArray
Creates an empty array of the same type as the data array of this tensor.- Parameters:
length
- The length of the array to construct.- Returns:
- An empty array of the same type as the data array of this tensor.
-
add
Adds a scalar value to each entry of this tensor. If the tensor is sparse, the scalar will only be added to the non-zero data of the tensor. -
addEq
Adds a scalar value to each entry of this tensor and stores the result in this tensor. -
mult
Multiplies a scalar value to each entry of this tensor. -
multEq
Multiplies a scalar value to each entry of this tensor and stores the result in this tensor. -
isZeros
default boolean isZeros()Checks if this tensor only contains zeros. -
isOnes
default boolean isOnes()Checks if this tensor only contains ones. If this tensor is sparse, only the non-zero data are considered. -
sum
-
prod
Computes the product of all values in this tensor (or non-zero values if this tensor is sparse). -
min
Finds the minimum value in this tensor. If this tensor is complex, then this method finds the smallest value in magnitude.- Returns:
- The minimum value (smallest in magnitude for a complex valued tensor) in this tensor.
-
max
Finds the maximum value in this tensor. If this tensor is complex, then this method finds the largest value in magnitude.- Returns:
- The maximum value (largest in magnitude for a complex valued tensor) in this tensor.
-
argmin
default 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
default 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.
-