Class RealFieldDenseElemMult

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

public final class RealFieldDenseElemMult extends Object
This class contains low-level implementations of element-wise tensor multiplication for a dense real and dense field tensor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends Field<T>>
    void
    dispatch(T[] src1, Shape shape1, double[] src2, Shape shape2, T[] dest)
    Dynamically chooses and applies element-wise multiplication algorithm to use based on the number of data in the tensors.
    static <T extends Field<T>>
    void
    elemMult(T[] src1, Shape shape1, double[] src2, Shape shape2, T[] dest)
    Computes the element-wise multiplication of two tensors.
    static <T extends Field<T>>
    void
    elemMultConcurrent(T[] src1, Shape shape1, double[] src2, Shape shape2, T[] dest)
    Computes the element-wise multiplication of two tensors using a concurrent algorithm.

    Methods inherited from class java.lang.Object

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

    • elemMult

      public static <T extends Field<T>> void elemMult(T[] src1, Shape shape1, double[] src2, Shape shape2, T[] dest)
      Computes the element-wise multiplication of two tensors. Also called the Hadamard product.
      Parameters:
      src1 - First tensor in element-wise multiplication.
      shape1 - Shape of the first tensor.
      src2 - Second tensor in element-wise multiplication.
      shape2 - Shape of the second tensor.
      dest - Array to store the result of the element-wise product in (modified). May be the same array as src1.
      Throws:
      IllegalArgumentException - If the tensors do not have the same shape.
    • elemMultConcurrent

      public static <T extends Field<T>> void elemMultConcurrent(T[] src1, Shape shape1, double[] src2, Shape shape2, T[] dest)
      Computes the element-wise multiplication of two tensors using a concurrent algorithm. Also called the Hadamard product.
      Parameters:
      src1 - First tensor in element-wise multiplication.
      shape1 - Shape of the first tensor.
      src2 - Second tensor in element-wise multiplication.
      shape2 - Shape of the second tensor.
      dest - Array to store the result of the element-wise product in (modified). May be the same array as src1.
      Throws:
      IllegalArgumentException - If the tensors do not have the same shape.
    • dispatch

      public static <T extends Field<T>> void dispatch(T[] src1, Shape shape1, double[] src2, Shape shape2, T[] dest)
      Dynamically chooses and applies element-wise multiplication algorithm to use based on the number of data in the tensors.
      Parameters:
      src1 - Entries of first tensor.
      shape1 - Shape of first tensor.
      src2 - Entries of second tensor.
      shape2 - Shape of second tensor.
      dest - Array to store the result of the element-wise product in (modified). May be the same array as src1.