Class RealDenseElemMult

java.lang.Object
org.flag4j.linalg.ops.dense.real.RealDenseElemMult

public final class RealDenseElemMult extends Object
This class contains low level implementations of element-wise multiplications algorithms for real dense tensors.
  • Method Summary

    Modifier and Type
    Method
    Description
    static double[]
    dispatch(double[] src1, double[] src2, double[] dest)
    Dynamically chooses and applies element-wise multiplication algorithm to use based on the number of data in the tensors.
    static double[]
    elemMult(double[] src1, double[] src2, double[] dest)
    Computes the element-wise multiplication of two tensors.
    static double[]
    elemMultConcurrent(double[] src1, double[] src2, double[] 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 double[] elemMult(double[] src1, double[] src2, double[] dest)
      Computes the element-wise multiplication of two tensors.
      Parameters:
      src1 - First tensor in element-wise multiplication.
      src2 - Second tensor in element-wise multiplication.
      dest - Array to store the result in. May be null or the same array as src1 or src2.
      Returns:
      If dest != null then a reference to dest is returned. Otherwise, a new array of the appropriate size is created and returned.
      Throws:
      IllegalArgumentException - If src1.length != src2.length.
      ArrayIndexOutOfBoundsException - If dest.length < src1.length.
    • elemMultConcurrent

      public static double[] elemMultConcurrent(double[] src1, double[] src2, double[] dest)
      Computes the element-wise multiplication of two tensors using a concurrent algorithm.
      Parameters:
      src1 - First tensor in element-wise multiplication.
      src2 - Second tensor in element-wise multiplication.
      dest - Array to store the result in. May be null or the same array as src1 or src2.
      Returns:
      If dest != null then a reference to dest is returned. Otherwise, a new array of the appropriate size is created and returned.
      Throws:
      IllegalArgumentException - If src1.length != src2.length.
      ArrayIndexOutOfBoundsException - If dest.length < src1.length.
    • dispatch

      public static double[] dispatch(double[] src1, double[] src2, double[] 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.
      src2 - Entries of second tensor.
      dest - Array to store the result in. May be null or the same array as src1 or src1.
      Returns:
      If dest != null then a reference to dest will be returned. Otherwise, a new array of the appropriate size will be created and returned.