Class RealFieldDenseOps

java.lang.Object
org.flag4j.linalg.ops.dense.real_field_ops.RealFieldDenseOps

public final class RealFieldDenseOps extends Object
This class provides low level methods for computing ops with at least one real tensor and at least one field tensor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends Field<T>>
    void
    add(double[] src, T a, T[] dest)
    Adds a scalar value to all data of a tensor.
    static <T extends Field<T>>
    void
    add(Shape shape1, T[] src1, Shape shape2, double[] src2, T[] dest)
    Computes the element-wise addition of two tensors.
    static <T extends Field<T>>
    void
    add(T[] src, double a, T[] dest)
    Adds a scalar value to all data of a tensor.
    static <T extends Field<T>>
    void
    elemDiv(Shape shape1, double[] src1, Shape shape2, T[] src2, T[] dest)
    Computes the element-wise division between two dense tensors.
    static <T extends Field<T>>
    void
    elemDiv(Shape shape1, T[] src1, Shape shape2, double[] src2, T[] dest)
    Computes the element-wise division between two dense tensors.
    static <T extends Field<T>>
    void
    elemMult(Shape shape1, T[] src1, Shape shape2, double[] src2, T[] dest)
    Computes the element-wise multiplication between two dense tensors.
    static <T extends Field<T>>
    void
    scalDiv(double[] src, T divisor, T[] dest)
    Computes the scalar multiplication of a tensor.
    static <T extends Field<T>>
    void
    scalDiv(T[] src, double divisor, T[] dest)
    Computes the scalar division of a tensor.
    static <T extends Field<T>>
    void
    sub(double[] src, T a, T[] dest)
    Subtracts a scalar value from all data of a tensor.
    static <T extends Field<T>>
    void
    sub(Shape shape1, double[] src1, Shape shape2, T[] src2, T[] dest)
    Computes the element-wise subtraction of two tensors.
    static <T extends Field<T>>
    void
    sub(Shape shape1, T[] src1, Shape shape2, double[] src2, T[] dest)
    Computes the element-wise subtraction of two tensors.
    static <T extends Field<T>>
    void
    sub(T[] src, double a, T[] dest)
    Subtracts a scalar value from all data of a tensor.

    Methods inherited from class java.lang.Object

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

    • add

      public static <T extends Field<T>> void add(Shape shape1, T[] src1, Shape shape2, double[] src2, T[] dest)
      Computes the element-wise addition of two tensors.
      Parameters:
      shape1 - Shape of first tensor.
      src1 - Entries of first tensor.
      shape2 - Shape of second tensor.
      src2 - Entries of second tensor.
      Array - to store the result of the element-wise sum in. Must be at least as long as src1. May be the same array as src1.
      Throws:
      TensorShapeException - If !shape1.equals(shape2).
    • sub

      public static <T extends Field<T>> void sub(Shape shape1, T[] src1, Shape shape2, double[] src2, T[] dest)
      Computes the element-wise subtraction of two tensors.
      Parameters:
      shape1 - Shape of first tensor.
      src1 - Entries of first tensor.
      shape2 - Shape of second tensor.
      src2 - Entries of second tensor.
      dest - Array to store the resulting element-wise difference in. Must be at lease as large as src1. May be the same array as src1.
      Throws:
      TensorShapeException - If !shape1.equals(shape2).
      ArrayIndexOutOfBoundsException - If src1.length != src2.length
    • sub

      public static <T extends Field<T>> void sub(Shape shape1, double[] src1, Shape shape2, T[] src2, T[] dest)
      Computes the element-wise subtraction of two tensors.
      Parameters:
      shape1 - Shape of first tensor.
      src1 - Entries of first tensor.
      shape2 - Shape of second tensor.
      src2 - Entries of second tensor.
      dest - Array to store the resulting element-wise difference in. Must be at lease as large as src1. May be the same array as src1.
      Throws:
      TensorShapeException - If !shape1.equals(shape2).
    • scalDiv

      public static <T extends Field<T>> void scalDiv(double[] src, T divisor, T[] dest)
      Computes the scalar multiplication of a tensor.
      Parameters:
      src - Entries of the tensor.
      divisor - Scalar value to multiply.
      dest - Array to store the result of the scalar division in. Must be at least as large as src. May be the same array as dest.
    • add

      public static <T extends Field<T>> void add(T[] src, double a, T[] dest)
      Adds a scalar value to all data of a tensor.
      Parameters:
      src - Entries of first tensor.
      a - Scalar to add to all data of this tensor.
      dest - Array to store the result of adding the scalar a to src. Must be at least as large as src. May be the same array as dest.
    • add

      public static <T extends Field<T>> void add(double[] src, T a, T[] dest)
      Adds a scalar value to all data of a tensor.
      Parameters:
      src - Entries of first tensor.
      a - Scalar to add to all data of this tensor.
      dest - Array to store the result of adding the scalar a to src. Must be at least as large as src. May be the same array as dest.
    • sub

      public static <T extends Field<T>> void sub(T[] src, double a, T[] dest)
      Subtracts a scalar value from all data of a tensor.
      Parameters:
      src - Entries of first tensor.
      a - Scalar to add to all data of this tensor.
      dest - Array to store the result of subtracting the scalar a from src. Must be at least as large as src. May be the same array as dest.
    • sub

      public static <T extends Field<T>> void sub(double[] src, T a, T[] dest)
      Subtracts a scalar value from all data of a tensor.
      Parameters:
      src - Entries of first tensor.
      a - Scalar to add to all data of this tensor.
      dest - Array to store the result of subtracting the scalar a from all data of src. Must be at least as large as src. May be the same array as src.
    • scalDiv

      public static <T extends Field<T>> void scalDiv(T[] src, double divisor, T[] dest)
      Computes the scalar division of a tensor.
      Parameters:
      src - Entries of the tensor.
      divisor - Scalar value to divide tensor by.
      dest - Array to store the result of the scalar division in. Must be at least as large as src. May be the same array as src.
    • elemMult

      public static <T extends Field<T>> void elemMult(Shape shape1, T[] src1, Shape shape2, double[] src2, T[] dest)
      Computes the element-wise multiplication between two dense tensors.
      Parameters:
      shape1 - Shape of the first tensor in the element-wise product.
      src1 - Entries of the first tensor in the element-wise product.
      shape2 - Shape of the second tensor in the element-wise product.
      src2 - Entries of the second tensor in the element-wise product.
      dest - Array to store the result of the element-wise product in. Must be at least as large as src1. May be the same arrays as src1.
      Throws:
      TensorShapeException - If !shape1.equals(shape1).
    • elemDiv

      public static <T extends Field<T>> void elemDiv(Shape shape1, T[] src1, Shape shape2, double[] src2, T[] dest)
      Computes the element-wise division between two dense tensors.
      Parameters:
      shape1 - Shape of the first tensor in the element-wise quotient.
      src1 - Entries of the first tensor in the element-wise quotient.
      shape2 - Shape of the second tensor in the element-wise quotient.
      src2 - Entries of the second tensor in the element-wise quotient.
      dest - Array to store the result of the element-wise quotient in.
      Throws:
      TensorShapeException - If !shape1.equals(shape1).
    • elemDiv

      public static <T extends Field<T>> void elemDiv(Shape shape1, double[] src1, Shape shape2, T[] src2, T[] dest)
      Computes the element-wise division between two dense tensors.
      Parameters:
      shape1 - Shape of the first tensor in the element-wise quotient.
      src1 - Entries of the first tensor in the element-wise quotient.
      shape2 - Shape of the second tensor in the element-wise quotient.
      src2 - Entries of the second tensor in the element-wise quotient.
      dest - Array to store the result of the element-wise quotient in.
      Throws:
      TensorShapeException - If !shape1.equals(shape1).