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 to T. If T is dense, then this should be the same type as T. 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 Type
    Method
    Description
    abs()
    Computes the element-wise absolute value of this tensor.
    int[]
    Finds the indices of the maximum value in this tensor.
    int[]
    Finds the indices of the maximum absolute value in this tensor.
    int[]
    Finds the indices of the minimum value in this tensor.
    int[]
    Finds the indices of the minimum absolute value in this tensor.
    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 exchanging axis1 and axis2.
    max()
    Finds the maximum value in this tensor.
    double
    Finds the maximum absolute value in this tensor.
    min()
    Finds the minimum value in this tensor.
    double
    Finds the minimum value, in absolute value, in this tensor.
    sub(T b)
    Computes the element-wise difference between two tensors of the same shape.
    sub(W b)
    Subtracts a scalar value from each entry of this tensor.
    void
    subEq(W b)
    Subtracts a scalar value from each entry of this tensor and stores the result in this tensor.

    Methods inherited from interface org.flag4j.arrays.backend.semiring_arrays.TensorOverSemiring

    add, add, addEq, elemMult, getData, getRank, getShape, isOnes, isZeros, makeLikeTensor, mult, multEq, prod, sum, tensorDot, tensorDot, tensorDot, tensorDot, tensorTr, tensorTr
  • Method Details

    • sub

      T sub(W b)
      Subtracts a scalar value from each entry of this tensor.
      Parameters:
      b - Scalar value in difference.
      Returns:
      The difference of this tensor and the scalar b.
    • subEq

      void subEq(W b)
      Subtracts a scalar value from each entry of this tensor and stores the result in this tensor.
      Parameters:
      b - Scalar value in difference.
    • sub

      T sub(T b)
      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 and b do not have the same shape.
    • 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

      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.
      Returns:
      The conjugate transpose of this tensor.
      See Also:
    • H

      T H(int axis1, int axis2)
      Computes the conjugate transpose of a tensor by conjugating and exchanging axis1 and axis2.
      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 either axis1 or axis2 are out of bounds for the rank of this tensor.
      See Also:
    • H

      T H(int... axes)
      Computes the conjugate transpose of this tensor. That is, conjugates and permutes the axes of this tensor so that it matches the permutation specified by axes.
      Parameters:
      axes - Permutation of tensor axis. If the tensor has rank N, then this must be an array of length N 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 of axes is out of bounds for the rank of this tensor.
      IllegalArgumentException - If axes is not a permutation of {1, 2, 3, ... N-1}.
      See Also:
    • min

      W min()
      Finds the minimum value in this tensor.
      Returns:
      The minimum value in this tensor.
    • max

      W max()
      Finds the maximum value in this tensor.
      Returns:
      The maximum value in this tensor.
    • 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.