Class RealComplexDenseElemDiv
java.lang.Object
org.flag4j.operations.dense.real_complex.RealComplexDenseElemDiv
This class contains low-level implementations of element-wise tensor division 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 the appropriate algorithm for element-wise tensor multiplication.static CNumber[]
Dynamically chooses and applies the appropriate algorithm for element-wise tensor multiplication.static CNumber[]
Computes the element-wise division of two tensors.static CNumber[]
Computes the element-wise division of two tensors.static CNumber[]
elemDivConcurrent
(double[] src1, Shape shape1, CNumber[] src2, Shape shape2) Computes the element-wise division of two tensors using a concurrent algorithm.static CNumber[]
elemDivConcurrent
(CNumber[] src1, Shape shape1, double[] src2, Shape shape2) Computes the element-wise division of two tensors using a concurrent algorithm.private static boolean
useConcurrent
(int numEntries) Chooses if a concurrent algorithm for element-wise multiplication should be used based on the shape of the two tensors.
-
Field Details
-
CONCURRENT_THRESHOLD
private static final int CONCURRENT_THRESHOLDMinimum number of entries in each tensor to apply concurrent algorithm.- See Also:
-
-
Constructor Details
-
RealComplexDenseElemDiv
private RealComplexDenseElemDiv()
-
-
Method Details
-
elemDiv
Computes the element-wise division of two tensors.- Parameters:
src1
- First tensor in element-wise division.shape1
- Shape of the first tensor.src2
- Second tensor in element-wise division.shape2
- Shape of the second tensor.- Returns:
- The element-wise division of the two tensors.
- Throws:
IllegalArgumentException
- If the tensors do not have the same shape.
-
elemDivConcurrent
public static CNumber[] elemDivConcurrent(CNumber[] src1, Shape shape1, double[] src2, Shape shape2) Computes the element-wise division of two tensors using a concurrent algorithm.- Parameters:
src1
- First tensor in element-wise division.shape1
- Shape of the first tensor.src2
- Second tensor in element-wise division.shape2
- Shape of the second tensor.- Returns:
- The element-wise division of the two tensors.
- Throws:
IllegalArgumentException
- If the tensors do not have the same shape.
-
elemDiv
Computes the element-wise division of two tensors.- Parameters:
src1
- First tensor in element-wise division.shape1
- Shape of the first tensor.src2
- Second tensor in element-wise division.shape2
- Shape of the second tensor.- Returns:
- The element-wise division of the two tensors.
- Throws:
IllegalArgumentException
- If the tensors do not have the same shape.
-
elemDivConcurrent
public static CNumber[] elemDivConcurrent(double[] src1, Shape shape1, CNumber[] src2, Shape shape2) Computes the element-wise division of two tensors using a concurrent algorithm.- Parameters:
src1
- First tensor in element-wise division.shape1
- Shape of the first tensor.src2
- Second tensor in element-wise division.shape2
- Shape of the second tensor.- Returns:
- The element-wise division of the two tensors.
- Throws:
IllegalArgumentException
- If the tensors do not have the same shape.
-
useConcurrent
private static boolean useConcurrent(int numEntries) Chooses if a concurrent algorithm for element-wise multiplication should be used based on the shape of the two tensors.- Parameters:
numEntries
- Total entries in the tensors to multiply.- Returns:
- True if a concurrent algorithm should be used for element-wise multiplication. Otherwise, returns false.
-
dispatch
Dynamically chooses and applies the appropriate algorithm for element-wise tensor multiplication.- Parameters:
src1
- Entries of first tensor.shape1
- Shape of first tensor.src2
- Entries of second tensor.shape2
- Shape of second tensor.- Returns:
- The result of the element-wise tensor multiplication.
-
dispatch
Dynamically chooses and applies the appropriate algorithm for element-wise tensor multiplication.- Parameters:
src1
- Entries of first tensor.shape1
- Shape of first tensor.src2
- Entries of second tensor.shape2
- Shape of second tensor.- Returns:
- The result of the element-wise tensor multiplication.
-