Class RealComplexDenseElemMult
java.lang.Object
org.flag4j.operations.dense.real_complex.RealComplexDenseElemMult
This class contains low-level implementations of element-wise tensor multiplication for a real dense and complex dense
tensor.
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final int
Minimum number of entries in each tensor to apply concurrent algorithm. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic CNumber[]
Dynamically chooses and applies element-wise multiplication algorithm to use based on the number of entries in the tensors.static CNumber[]
Computes the element-wise multiplication of two tensors.static CNumber[]
elemMultConcurrent
(CNumber[] src1, Shape shape1, double[] src2, Shape shape2) Computes the element-wise multiplication of two tensors using a concurrent algorithm.
-
Field Details
-
CONCURRENT_THRESHOLD
private static final int CONCURRENT_THRESHOLDMinimum number of entries in each tensor to apply concurrent algorithm.- See Also:
-
-
Constructor Details
-
RealComplexDenseElemMult
private RealComplexDenseElemMult()
-
-
Method Details
-
elemMult
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.- Returns:
- The element-wise multiplication of the two tensors.
- Throws:
IllegalArgumentException
- If the tensors do not have the same shape.
-
elemMultConcurrent
public static CNumber[] elemMultConcurrent(CNumber[] src1, Shape shape1, double[] src2, Shape shape2) 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.- Returns:
- The element-wise multiplication of the two tensors.
- Throws:
IllegalArgumentException
- If the tensors do not have the same shape.
-
dispatch
Dynamically chooses and applies element-wise multiplication algorithm to use based on the number of entries in the tensors.- Parameters:
src1
- Entries of first tensor.shape1
- Shape of first tensor.src2
- Entries of second tensor.shape2
- Shape of second tensor.- Returns:
- The element-wise multiplication of the two tensors.
-