Class ComplexDenseSparseMatrixOperations
java.lang.Object
org.flag4j.operations.dense_sparse.coo.complex.ComplexDenseSparseMatrixOperations
This class contains low level implementations for operations between a dense and a sparse complex matrix.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic CMatrix
add
(CMatrix src1, CooCMatrix src2) Adds a real dense matrix to a real sparse matrix.static void
addEq
(CMatrix src1, CooCMatrix src2) Adds a complex dense matrix to a real sparse matrix and stores the result in the first matrix.static CMatrix
addToEachCol
(CooCMatrix src, CVector col) Adds a dense vector to each column as if the vector is a column vector.static CMatrix
addToEachRow
(CooCMatrix src, CVector row) Adds a dense vector to add to each row as if the vector is a row vector.static CooCMatrix
elemDiv
(CooCMatrix src1, CMatrix src2) Computes the element-wise division between a complex sparse matrix and a complex dense matrix.static CooCMatrix
elemMult
(CMatrix src1, CooCMatrix src2) Computes the element-wise multiplication between a real dense matrix and a real sparse matrix.static CMatrix
sub
(CMatrix src1, CooCMatrix src2) Subtracts a real sparse matrix from a real dense matrix.static CMatrix
sub
(CooCMatrix src2, CMatrix src1) Subtracts a complex dense matrix from a complex sparse matrix.static void
subEq
(CMatrix src1, CooCMatrix src2) Subtracts a complex sparse matrix from a complex dense matrix and stores the result in the dense matrix.
-
Constructor Details
-
ComplexDenseSparseMatrixOperations
private ComplexDenseSparseMatrixOperations()
-
-
Method Details
-
add
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
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.
-
sub
Subtracts a complex dense matrix from a complex sparse matrix.- Parameters:
src2
- Entries of second matrix in the difference.src1
- Entries of first matrix in difference.- 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
- First matrix.src2
- Second matrix.- Throws:
IllegalArgumentException
- If the matrices do not have the same shape.
-
subEq
Subtracts a complex sparse matrix from a complex dense matrix and stores the result in the dense matrix.- Parameters:
src1
- First matrix.src2
- Second matrix.- Throws:
IllegalArgumentException
- If the matrices do not have the same shape.
-
elemMult
Computes the element-wise multiplication between a real dense matrix and a real sparse matrix.- Returns:
- The result of element-wise multiplication.
- Throws:
IllegalArgumentException
- If the matrices do not have the same shape.
-
elemDiv
Computes the element-wise division between a complex sparse matrix and a complex 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_INFINITY
orDouble.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 operations 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
src1
andsrc2
. - Throws:
IllegalArgumentException
- Ifsrc1
andsrc2
do not have the same shape.
-
addToEachCol
Adds a dense vector to each column as if the vector is a column vector.- Parameters:
src
- Source sparse matrix.col
- Vector to add to each column of the source matrix.- Returns:
- A dense copy of the
src
matrix with the specified vector added to each column. - Throws:
IllegalArgumentException
- If the number of entries in thecol
vector does not match the number of rows in thesrc
matrix.
-
addToEachRow
Adds a dense vector to add to each row as if the vector is a row vector.- Parameters:
src
- Source sparse matrix.row
- Vector to add to each row of the source matrix.- Returns:
- A dense copy of the
src
matrix with the specified vector added to each row. - Throws:
IllegalArgumentException
- If the number of entries in thecol
vector does not match the number of columns in thesrc
matrix.
-