Class RealCsrDenseOps
java.lang.Object
org.flag4j.linalg.ops.dense_sparse.csr.real.RealCsrDenseOps
This class contains low-level ops which act on a real dense and a real sparse
CSR matrix.-
Method Summary
Modifier and TypeMethodDescriptionstatic MatrixComputes the element-wise sum of two matrices.static MatrixapplyBinOpp(Matrix src1, CsrMatrix src2, BinaryOperator<Double> opp) Applies the specified binary operator element-wise to the two matrices.static MatrixapplyBinOpp(CsrMatrix src1, double b, BinaryOperator<Double> opp, UnaryOperator<Double> uOpp) Applies the specified binary operator element-wise to a matrix and a scalar.static MatrixapplyBinOpp(CsrMatrix src1, Matrix src2, BinaryOperator<Double> opp, UnaryOperator<Double> uOpp) Applies the specified binary operator element-wise to the two matrices.static CsrMatrixapplyBinOppToSparse(Matrix src1, CsrMatrix src2, BinaryOperator<Double> opp) Applies an element-wise binary operation to a real dense and real sparse CSR matrix under the assumption thatopp.apply(x, 0d) = 0dandopp.apply(0d, x) = 0d.static MatrixComputes the element-wise difference of two matrices.
-
Method Details
-
applyBinOpp
public static Matrix applyBinOpp(CsrMatrix src1, Matrix src2, BinaryOperator<Double> 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 operationoppand one unary operationuOppsuch that it is equivalent toopp.apply(x, uOpp.apply(y)).- Returns:
- A matrix containing the result from applying
oppelement-wise to the two matrices.
-
applyBinOpp
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
oppelement-wise to the two matrices.
-
applyBinOppToSparse
public static CsrMatrix applyBinOppToSparse(Matrix src1, CsrMatrix src2, BinaryOperator<Double> opp) Applies an element-wise binary operation to a real dense and real sparse CSR matrix under the assumption thatopp.apply(x, 0d) = 0dandopp.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.
-
applyBinOpp
public static Matrix applyBinOpp(CsrMatrix src1, double b, BinaryOperator<Double> opp, UnaryOperator<Double> 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 operationoppand one unary operationuOppsuch that it is equivalent toopp.apply(x, uOpp.apply(y)).- Returns:
- A matrix containing the result from applying
oppelement-wise to the two matrices.
-
add
-
sub
-