Class RealFieldDenseCooMatrixOps
java.lang.Object
org.flag4j.linalg.ops.dense_sparse.coo.real_field_ops.RealFieldDenseCooMatrixOps
This class contains low level implementations of ops between real/field and dense/sparse matrices.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Field<T>>
AbstractDenseFieldMatrix<?, ?, T> add(AbstractDenseFieldMatrix<?, ?, T> src1, CooMatrix src2) Adds a real dense matrix to a real sparse matrix.static <T extends Field<T>>
voidaddEq(AbstractDenseFieldMatrix<?, ?, T> src1, CooMatrix src2) Adds a complex dense matrix to a real sparse matrix and stores the result in the first matrix.static <T extends Field<T>>
AbstractCooFieldMatrix<?, ?, ?, T> elemDiv(AbstractCooFieldMatrix<?, ?, ?, T> src1, Matrix src2) Computes the element-wise division between a complex sparse matrix and a real dense matrix.static <T extends Field<T>>
voidelemMult(AbstractDenseFieldMatrix<?, ?, T> src1, CooMatrix src2, Field<T>[] destEntries) Computes the element-wise multiplication between two matrices.static <T extends Field<T>>
AbstractCooFieldMatrix<?, ?, ?, T> elemMult(Matrix src1, AbstractCooFieldMatrix<?, ?, ?, T> src2) Computes the element-wise multiplication between a real dense matrix and a complex sparse matrix.static <T extends Field<T>>
AbstractDenseFieldMatrix<?, ?, T> sub(AbstractDenseFieldMatrix<?, ?, T> src1, CooMatrix src2) Subtracts a real sparse matrix from a complex dense matrix.static <T extends Field<T>>
AbstractDenseFieldMatrix<?, ?, T> sub(CooMatrix src1, AbstractDenseFieldMatrix<?, ?, T> src2) Subtracts a real sparse matrix from a real dense matrix.static <T extends Field<T>>
voidsubEq(AbstractDenseFieldMatrix<?, ?, T> src1, CooMatrix src2) Subtracts a real sparse matrix from a complex dense matrix and stores the result in the first matrix.
-
Method Details
-
add
public static <T extends Field<T>> AbstractDenseFieldMatrix<?,?, addT> (AbstractDenseFieldMatrix<?, ?, T> src1, CooMatrix src2) Adds a real dense matrix to a real sparse matrix.- Parameters:
src1- First matrix.src2- Second matrix.- Returns:
- The result of the matrix addition.
- Throws:
IllegalArgumentException- If the matrices do not have the same shape.
-
sub
public static <T extends Field<T>> AbstractDenseFieldMatrix<?,?, subT> (AbstractDenseFieldMatrix<?, ?, T> src1, CooMatrix src2) Subtracts a real sparse matrix from a complex dense matrix.- Parameters:
src1- First matrix.src2- Second matrix.- Returns:
- The result of the matrix subtraction.
- Throws:
IllegalArgumentException- If the matrices do not have the same shape.
-
sub
public static <T extends Field<T>> AbstractDenseFieldMatrix<?,?, subT> (CooMatrix src1, AbstractDenseFieldMatrix<?, ?, T> src2) Subtracts a real sparse matrix from a real dense matrix.- Parameters:
src1- First matrix.src2- Second matrix.- Returns:
- The result of the matrix subtraction.
- Throws:
IllegalArgumentException- If the matrices do not have the same shape.
-
addEq
Adds a complex dense matrix to a real sparse matrix and stores the result in the first matrix.- Parameters:
src1- Entries of first matrix in the sum. Also, the storage for the result.src2- Entries of second matrix in the sum.- Throws:
IllegalArgumentException- If the matrices do not have the same shape.
-
subEq
Subtracts a real sparse matrix from a complex dense matrix and stores the result in the first matrix.- Parameters:
src1- Entries of first matrix in the sum. Also, the storage for the result.src2- Entries of second matrix in the sum.- Throws:
IllegalArgumentException- If the matrices do not have the same shape.
-
elemMult
public static <T extends Field<T>> AbstractCooFieldMatrix<?,?, elemMult?, T> (Matrix src1, AbstractCooFieldMatrix<?, ?, ?, T> src2) Computes the element-wise multiplication between a real dense matrix and a complex sparse matrix.- Parameters:
src1- First matrix.src2- Second matrix.- Returns:
- The result of element-wise multiplication.
- Throws:
IllegalArgumentException- If the matrices do not have the same shape.
-
elemMult
public static <T extends Field<T>> void elemMult(AbstractDenseFieldMatrix<?, ?, T> src1, CooMatrix src2, Field<T>[] destEntries) Computes the element-wise multiplication between two matrices.- Parameters:
src1- First matrix.src2- Second matrix.destEntries- Array to store non-zero values resulting from the element-wise product. Assumed to have lengthsrc2.nnz.- Throws:
TensorShapeException- If the matrices do not have the same shape.
-
elemDiv
public static <T extends Field<T>> AbstractCooFieldMatrix<?,?, elemDiv?, T> (AbstractCooFieldMatrix<?, ?, ?, T> src1, Matrix src2) Computes the element-wise division between a complex sparse matrix and a real dense matrix.If the dense matrix contains a zero at the same index the sparse matrix contains a non-zero, the result will be either
Double.POSITIVE_INFINITYorDouble.NEGATIVE_INFINITY.If the dense matrix contains a zero at an index for which the sparse matrix is also zero, the result will be zero. This is done to realize computational benefits from ops with sparse matrices.
- Parameters:
src1- Real sparse matrix and numerator in element-wise quotient.src2- Real Dense matrix and denominator in element-wise quotient.- Returns:
- The element-wise quotient of
src1andsrc2. - Throws:
IllegalArgumentException- Ifsrc1andsrc2do not have the same shape.
-