Class RealComplexDenseCooOps
java.lang.Object
org.flag4j.linalg.ops.dense_sparse.coo.real_complex.RealComplexDenseCooOps
This class contains methods to apply common binary ops to a real/complex dense matrix and to a complex/real sparse matrix.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
add
(Shape shape1, double[] src1, Shape shape2, Complex128[] src2, int[][] indices, Complex128[] dest) Computes element-wise sum between a real dense tensor to a sparse COO complex tensor.static CTensor
add
(CooCTensor src1, double b) Adds a scalar to a real sparse COO tensor.static CTensor
add
(CooTensor src1, Complex128 b) Adds a scalar to a real sparse COO tensor.static CooCTensor
Computes the element-wise division between a real dense tensor and a complex sparse tensor.static CooCTensor
Computes the element-wise multiplication between a complex dense tensor and a real sparse matrix.static CooCTensor
elemMult
(Tensor src1, CooCTensor src2) Computes the element-wise multiplication between a complex dense tensor and a real sparse matrix.static CTensor
sub
(Tensor src1, CooCTensor src2) Subtracts a sparse complex tensor from a real dense tensor.static CTensor
sub
(CooCTensor src1, double b) Adds a scalar to a real sparse COO tensor.static CTensor
sub
(CooCTensor src1, Tensor src2) Subtracts a real dense tensor from a complex sparse tensor.static CTensor
sub
(CooTensor src1, Complex128 b) Subtracts a scalar from a real sparse COO tensor.
-
Method Details
-
elemDiv
Computes the element-wise division between a real dense tensor and a complex sparse tensor.- Parameters:
src1
- Real sparse tensor.src2
- complex dense tensor.- Returns:
- The result of element-wise division.
- Throws:
IllegalArgumentException
- If the tensors do not have the same shape.
-
add
public static void add(Shape shape1, double[] src1, Shape shape2, Complex128[] src2, int[][] indices, Complex128[] dest) Computes element-wise sum between a real dense tensor to a sparse COO complex tensor.- Parameters:
shape1
- Shape of the first tensor.src1
- Entries of the first tensor.shape2
- Shape of the COO tensor.src2
- Non-zero data of the COO tensor.indices
- Non-zero indices of the COO tensor.dest
- Array to store the dense result of the element-wise sum. Must be at least as large assrc1
. May benull
or the same array assrc1
.- Throws:
IllegalArgumentException
- If!shape1.equals(shape2)
.
-
sub
Subtracts a sparse complex tensor from a real dense tensor.- Parameters:
src1
- First tensor in the sum.src2
- Second tensor in the sum.- Returns:
- The result of the tensor addition.
- Throws:
IllegalArgumentException
- If the tensors do not have the same shape.t
-
elemMult
Computes the element-wise multiplication between a complex dense tensor and a real sparse matrix.- Parameters:
src1
- First tensor in the element-wise multiplication.src2
- Second tensor in the element-wise multiplication.- Returns:
- The result of element-wise multiplication.
- Throws:
IllegalArgumentException
- If the tensors do not have the same shape.
-
elemMult
Computes the element-wise multiplication between a complex dense tensor and a real sparse matrix.- Parameters:
src1
- First tensor in the element-wise multiplication.src2
- Second tensor in the element-wise multiplication.- Returns:
- The result of element-wise multiplication.
- Throws:
IllegalArgumentException
- If the tensors do not have the same shape.
-
sub
Subtracts a real dense tensor from a complex sparse tensor.- Parameters:
src1
- First tensor in the sum.src2
- Second tensor in the sum.- Returns:
- The result of the tensor addition.
- Throws:
IllegalArgumentException
- If the tensors do not have the same shape.t
-
add
Adds a scalar to a real sparse COO tensor.- Parameters:
src1
- Sparse tensor in sum.b
- Scalar in sum.- Returns:
- A dense tensor which is the sum of
src1
andb
such thatb
is added to each element ofsrc1
.
-
sub
Subtracts a scalar from a real sparse COO tensor.- Parameters:
src1
- Sparse tensor in sum.b
- Scalar in sum.- Returns:
- A dense tensor which is the sum of
src1
andb
such thatb
is added to each element ofsrc1
.
-
sub
Adds a scalar to a real sparse COO tensor.- Parameters:
src1
- Sparse tensor in sum.b
- Scalar in sum.- Returns:
- A dense tensor which is the sum of
src1
andb
such thatb
is added to each element ofsrc1
.
-
add
Adds a scalar to a real sparse COO tensor.- Parameters:
src1
- Sparse tensor in sum.b
- Scalar in sum.- Returns:
- A dense tensor which is the sum of
src1
andb
such thatb
is added to each element ofsrc1
.
-