Class RealDenseElemMult
java.lang.Object
org.flag4j.linalg.ops.dense.real.RealDenseElemMult
This class contains low level implementations of element-wise multiplications algorithms for real dense tensors.
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.
-
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 benullor the same array assrc1orsrc2.- Returns:
- If
dest != nullthen a reference todestis returned. Otherwise, a new array of the appropriate size is created and returned. - Throws:
IllegalArgumentException- Ifsrc1.length != src2.length.ArrayIndexOutOfBoundsException- Ifdest.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 benullor the same array assrc1orsrc2.- Returns:
- If
dest != nullthen a reference todestis returned. Otherwise, a new array of the appropriate size is created and returned. - Throws:
IllegalArgumentException- Ifsrc1.length != src2.length.ArrayIndexOutOfBoundsException- Ifdest.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 benullor the same array assrc1orsrc1.- Returns:
- If
dest != nullthen a reference todestwill be returned. Otherwise, a new array of the appropriate size will be created and returned.
-