Class RealComplexCsrDenseOperations
java.lang.Object
org.flag4j.operations.dense_sparse.csr.real_complex.RealComplexCsrDenseOperations
This class contains low-level operations which act on a real/complex dense and a complex/real
sparse
CSR matrix
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic CMatrix
applyBinOpp
(CMatrix src1, CsrMatrix src2, BiFunction<CNumber, Double, CNumber> opp) Applies the specified binary operator element-wise to the two matrices.static CMatrix
applyBinOpp
(Matrix src1, CsrCMatrix src2, BiFunction<Double, CNumber, CNumber> opp) Applies the specified binary operator element-wise to the two matrices.static CMatrix
applyBinOpp
(CsrCMatrix src1, Matrix src2, BiFunction<CNumber, Double, CNumber> opp, UnaryOperator<Double> uOpp) Applies the specified binary operator element-wise to the two matrices.static CMatrix
applyBinOpp
(CsrMatrix src1, CMatrix src2, BiFunction<Double, CNumber, CNumber> opp, UnaryOperator<CNumber> uOpp) Applies the specified binary operator element-wise to the two matrices.static CMatrix
applyBinOpp
(CsrMatrix src1, CNumber b, BiFunction<Double, CNumber, CNumber> opp, UnaryOperator<CNumber> uOpp) Applies the specified binary operator element-wise to a matrix and a scalar.static CsrCMatrix
applyBinOppToSparse
(CMatrix src1, CsrMatrix src2, BiFunction<CNumber, Double, CNumber> opp) Applies an element-wise binary operation to a real dense and real sparse CSR matrix under the assumption thatopp.apply(x, 0d) = 0d
andopp.apply(0d, x) = 0d
.static CsrCMatrix
applyBinOppToSparse
(Matrix src1, CsrCMatrix src2, BiFunction<Double, CNumber, CNumber> opp) Applies an element-wise binary operation to a real dense and real sparse CSR matrix under the assumption thatopp.apply(x, 0d) = 0d
andopp.apply(0d, x) = 0d
.static CsrCMatrix
applyBinOppToSparse
(CsrMatrix src1, CMatrix src2, BiFunction<Double, CNumber, CNumber> opp) Applies an element-wise binary operation to a real sparse and complex dense CSR matrix under the assumption thatopp.apply(0d, x) = 0d
wherex
is aCNumber
.
-
Constructor Details
-
RealComplexCsrDenseOperations
private RealComplexCsrDenseOperations()
-
-
Method Details
-
applyBinOpp
public static CMatrix applyBinOpp(CsrCMatrix src1, Matrix src2, BiFunction<CNumber, Double, CNumber> opp, UnaryOperator<Double> uOpp) Applies the specified binary operator element-wise to the two matrices.- Parameters:
src1
- First matrix in element-wise binary operation.src2
- Second matrix in element-wise binary operation.opp
- Binary operator to apply element-wise to the two matrices.uOpp
- Unary operator for use with binary operations which are not commutative such as subtraction. If the operation is commutative this should benull
. If the binary operation is not commutative, it needs to be decomposable to one commutative binary operationopp
and one unary operationuOpp
such that it is equivalent toopp.apply(x, uOpp.apply(y))
.- Returns:
- A matrix containing the result from applying
opp
element-wise to the two matrices.
-
applyBinOpp
public static CMatrix applyBinOpp(Matrix src1, CsrCMatrix src2, BiFunction<Double, CNumber, CNumber> opp) Applies the specified binary operator element-wise to the two matrices.- Parameters:
src1
- First matrix in element-wise binary operation.src2
- Second matrix in element-wise binary operation.opp
- Binary operator to apply element-wise to the two matrices.- Returns:
- A matrix containing the result from applying
opp
element-wise to the two matrices.
-
applyBinOpp
public static CMatrix applyBinOpp(CsrMatrix src1, CMatrix src2, BiFunction<Double, CNumber, CNumber> opp, UnaryOperator<CNumber> uOpp) Applies the specified binary operator element-wise to the two matrices.- Parameters:
src1
- First matrix in element-wise binary operation.src2
- Second matrix in element-wise binary operation.opp
- Binary operator to apply element-wise to the two matrices.uOpp
- Unary operator for use with binary operations which are not commutative such as subtraction. If the operation is commutative this should benull
. If the binary operation is not commutative, it needs to be decomposable to one commutative binary operationopp
and one unary operationuOpp
such that it is equivalent toopp.apply(x, uOpp.apply(y))
.- Returns:
- A matrix containing the result from applying
opp
element-wise to the two matrices.
-
applyBinOpp
public static CMatrix applyBinOpp(CMatrix src1, CsrMatrix src2, BiFunction<CNumber, Double, CNumber> opp) Applies the specified binary operator element-wise to the two matrices.- Parameters:
src1
- First matrix in element-wise binary operation.src2
- Second matrix in element-wise binary operation.opp
- Binary operator to apply element-wise to the two matrices.- Returns:
- A matrix containing the result from applying
opp
element-wise to the two matrices.
-
applyBinOppToSparse
public static CsrCMatrix applyBinOppToSparse(Matrix src1, CsrCMatrix src2, BiFunction<Double, CNumber, CNumber> opp) Applies an element-wise binary operation to a real dense and real sparse CSR matrix under the assumption thatopp.apply(x, 0d) = 0d
andopp.apply(0d, x) = 0d
.- Parameters:
src1
- The first matrix in the operation.src2
- Second matrix in the operation.opp
- Operation to apply to the matrices.- Returns:
- The result of applying the operation element-wise to the matrices. Result is a sparse CSR matrix.
-
applyBinOppToSparse
public static CsrCMatrix applyBinOppToSparse(CMatrix src1, CsrMatrix src2, BiFunction<CNumber, Double, CNumber> opp) Applies an element-wise binary operation to a real dense and real sparse CSR matrix under the assumption thatopp.apply(x, 0d) = 0d
andopp.apply(0d, x) = 0d
.- Parameters:
src1
- The first matrix in the operation.src2
- Second matrix in the operation.opp
- Operation to apply to the matrices.- Returns:
- The result of applying the operation element-wise to the matrices. Result is a sparse CSR matrix.
-
applyBinOppToSparse
public static CsrCMatrix applyBinOppToSparse(CsrMatrix src1, CMatrix src2, BiFunction<Double, CNumber, CNumber> opp) Applies an element-wise binary operation to a real sparse and complex dense CSR matrix under the assumption thatopp.apply(0d, x) = 0d
wherex
is aCNumber
.- Parameters:
src1
- The first matrix in the operation.src2
- Second matrix in the operation.opp
- Operation to apply to the matrices.- Returns:
- The result of applying the operation element-wise to the matrices. Result is a sparse CSR matrix.
-
applyBinOpp
public static CMatrix applyBinOpp(CsrMatrix src1, CNumber b, BiFunction<Double, CNumber, CNumber> opp, UnaryOperator<CNumber> uOpp) Applies the specified binary operator element-wise to a matrix and a scalar.- Parameters:
src1
- First matrix in element-wise binary operation.b
- Scalar to apply element-wise using the specified operation.opp
- Binary operator to apply element-wise to the two matrices.uOpp
- Unary operator for use with binary operations which are not commutative such as subtraction. If the operation is commutative this should benull
. If the binary operation is not commutative, it needs to be decomposable to one commutative binary operationopp
and one unary operationuOpp
such that it is equivalent toopp.apply(x, uOpp.apply(y))
.- Returns:
- A matrix containing the result from applying
opp
element-wise to the two matrices.
-