Class SemiringOps

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

public final class SemiringOps extends Object
This utility class contains ops for tensors whose elements are members of a Field. The implementations in this class are agnostic
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends Semiring<T>>
    void
    add(T[] src, T summand, T[] dest)
    Sums a value to each entry of tensor.
    static <T extends Semiring<T>>
    void
    scalMult(T[] src, T factor, T[] dest)
    Computes the scalar multiplication of a tensor.
    static <T extends Semiring<T>>
    void
    scalMult(T[] src, T factor, T[] dest, int start, int stop)
    Computes the scalar multiplication of a tensor.

    Methods inherited from class java.lang.Object

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

    • scalMult

      public static <T extends Semiring<T>> void scalMult(T[] src, T factor, T[] dest)
      Computes the scalar multiplication of a tensor.
      Parameters:
      src - Entries of the tensor.
      factor - Scalar value to multiply.
      dest - Array to store result in.
      Throws:
      ArrayIndexOutOfBoundsException - If dest is not at least the size of src.
    • scalMult

      public static <T extends Semiring<T>> void scalMult(T[] src, T factor, T[] dest, int start, int stop)
      Computes the scalar multiplication of a tensor.
      Parameters:
      src - Entries of the tensor.
      factor - Scalar value to multiply.
      dest - Array to store result in.
      start - Starting index of scalar multiplication.
      stop - Stopping index of scalar multiplication.
      Throws:
      ArrayIndexOutOfBoundsException - If dest is not the size of src.
    • add

      public static <T extends Semiring<T>> void add(T[] src, T summand, T[] dest)
      Sums a value to each entry of tensor.
      Parameters:
      src - Entries of the tensor (non-zero data if tensor is sparse).
      summand - Value to sum to each entry of the tensor.
      dest - Array to store result in.