Class CompareSemiring

java.lang.Object
org.flag4j.linalg.ops.common.semiring_ops.CompareSemiring

public final class CompareSemiring extends Object
This utility class provides methods useful for comparing elements of a Semiring.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends Semiring<T>>
    int
    argmax(T... values)
    Computes the index of the maximum value in the specified array.
    static <T extends Semiring<T>>
    int
    argmin(T... values)
    Computes the index of the minimum value in the specified array.
    static <T extends Semiring<T>>
    T
    max(T... values)
    Computes the maximum value in the specified array.
    static <T extends Semiring<T>>
    T
    min(T... values)
    Computes the minimum value in the specified array.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • max

      public static <T extends Semiring<T>> T max(T... values)
      Computes the maximum value in the specified array. This is done according to the ordering imposed by
      invalid reference
      Field#compareTo(Field)
      .
      Parameters:
      values - Values to commute maximum of.
      Returns:
      The maximum value in values. If values.length equals zero, then null is returned.
    • min

      public static <T extends Semiring<T>> T min(T... values)
      Computes the minimum value in the specified array. This is done according to the ordering imposed by
      invalid reference
      Field#compareTo(Field)
      .
      Parameters:
      values - Values to commute minimum of.
      Returns:
      The minimum value in values. If values.length equals zero, then null is returned.
    • argmax

      public static <T extends Semiring<T>> int argmax(T... values)
      Computes the index of the maximum value in the specified array. This is done according to the ordering imposed by Semiring.compareTo(Semiring).
      Parameters:
      values - Values for which compute index of maximum value.
      Returns:
      The index of the maximum value in values. If the maximum value occurs more than once, the index of the first occurrence is returned. If values.length equals zero, then -1 is returned.
    • argmin

      public static <T extends Semiring<T>> int argmin(T... values)
      Computes the index of the minimum value in the specified array. This is done according to the ordering imposed by Semiring.compareTo(Semiring).
      Parameters:
      values - Values for which compute index of the minimum value.
      Returns:
      The index of the minimum value in values. If the minimum value occurs more than once, the index of the first occurrence is returned. If values.length equals zero, then -1 is returned.