Class RealFieldDenseCsrOps
java.lang.Object
org.flag4j.linalg.ops.dense_sparse.csr.real_field_ops.RealFieldDenseCsrOps
This class contains low-level ops which act on a real/complex dense and a complex/real
sparse CSR matrix.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Field<T>>
AbstractDenseFieldMatrix<?, ?, T> add
(CsrMatrix a, AbstractDenseFieldMatrix<?, ?, T> b) Computes the element-wise sum of two matrices.static <T extends Field<T>>
AbstractDenseFieldMatrix<?, ?, T> applyBinOpp
(AbstractDenseFieldMatrix<?, ?, T> src1, CsrMatrix src2, BiFunction<T, Double, T> opp) Applies the specified binary operator element-wise to the two matrices.static <T extends Field<T>>
AbstractDenseFieldMatrix<?, ?, T> applyBinOpp
(CsrMatrix src1, AbstractDenseFieldMatrix<?, ?, T> src2, BiFunction<Double, T, T> opp, UnaryOperator<T> uOpp) Applies the specified binary operator element-wise to the two matrices.static <T extends Field<T>>
AbstractCsrFieldMatrix<?, ?, ?, T> applyBinOppToSparse
(AbstractDenseFieldMatrix<?, ?, T> src1, CsrMatrix src2, BiFunction<T, Double, T> 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 <T extends Field<T>>
AbstractCsrFieldMatrix<?, ?, ?, T> applyBinOppToSparse
(Matrix src1, AbstractCsrFieldMatrix<?, ?, ?, T> src2, BiFunction<Double, T, T> 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 <T extends Field<T>>
AbstractCsrFieldMatrix<?, ?, ?, T> applyBinOppToSparse
(CsrMatrix src1, AbstractDenseFieldMatrix<?, ?, T> src2, BiFunction<Double, T, T> 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 aComplex128
.static <T extends Field<T>>
AbstractDenseFieldMatrix<?, ?, T> sub
(AbstractDenseFieldMatrix<?, ?, T> a, CsrMatrix b) Computes the element-wise difference of two matrices.static <T extends Field<T>>
AbstractDenseFieldMatrix<?, ?, T> sub
(CsrMatrix a, AbstractDenseFieldMatrix<?, ?, T> b) Computes the element-wise difference of two matrices.
-
Method Details
-
applyBinOpp
public static <T extends Field<T>> AbstractDenseFieldMatrix<?,?, applyBinOppT> (CsrMatrix src1, AbstractDenseFieldMatrix<?, ?, T> src2, BiFunction<Double, T, T> opp, UnaryOperator<T> 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 ops 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 <T extends Field<T>> AbstractDenseFieldMatrix<?,?, applyBinOppT> (AbstractDenseFieldMatrix<?, ?, T> src1, CsrMatrix src2, BiFunction<T, Double, T> 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 <T extends Field<T>> AbstractCsrFieldMatrix<?,?, applyBinOppToSparse?, T> (Matrix src1, AbstractCsrFieldMatrix<?, ?, ?, T> src2, BiFunction<Double, T, T> 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 <T extends Field<T>> AbstractCsrFieldMatrix<?,?, applyBinOppToSparse?, T> (AbstractDenseFieldMatrix<?, ?, T> src1, CsrMatrix src2, BiFunction<T, Double, T> 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 <T extends Field<T>> AbstractCsrFieldMatrix<?,?, applyBinOppToSparse?, T> (CsrMatrix src1, AbstractDenseFieldMatrix<?, ?, T> src2, BiFunction<Double, T, T> 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 aComplex128
.- 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.
-
add
public static <T extends Field<T>> AbstractDenseFieldMatrix<?,?, addT> (CsrMatrix a, AbstractDenseFieldMatrix<?, ?, T> b) Computes the element-wise sum of two matrices.- Parameters:
a
- First matrix in sum.b
- Second matrix in sum.- Returns:
- The element-wise sum of
a
andb
.
-
sub
public static <T extends Field<T>> AbstractDenseFieldMatrix<?,?, subT> (CsrMatrix a, AbstractDenseFieldMatrix<?, ?, T> b) Computes the element-wise difference of two matrices.- Parameters:
a
- First matrix in difference.b
- Second matrix in difference.- Returns:
- The element-wise difference of
a
andb
.
-
sub
public static <T extends Field<T>> AbstractDenseFieldMatrix<?,?, subT> (AbstractDenseFieldMatrix<?, ?, T> a, CsrMatrix b) Computes the element-wise difference of two matrices.- Parameters:
a
- First matrix in difference.b
- Second matrix in difference.- Returns:
- The element-wise difference of
a
andb
.
-