Class ComplexSparseMatrixOperations
java.lang.Object
org.flag4j.operations.sparse.coo.complex.ComplexSparseMatrixOperations
This class has low level implementations for operations between two complex sparse matrices.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic CooCMatrix
add
(CooCMatrix src1, CooCMatrix src2) Adds two real sparse matrices.static CMatrix
add
(CooCMatrix src, CNumber a) Adds a complex number to all entries (including zero values) of a complex sparse matrix.static CMatrix
addToEachCol
(CooCMatrix src, CooCVector col) Adds a sparse vector to each column of a sparse matrix as if the vector is a column vector.static CMatrix
addToEachRow
(CooCMatrix src, CooCVector row) Adds a sparse vector to each row of a sparse matrix as if the vector is a row vector.static CooCMatrix
elemMult
(CooCMatrix src1, CooCMatrix src2) Multiplies two sparse matrices element-wise.static CooCMatrix
sub
(CooCMatrix src1, CooCMatrix src2) Computes the difference between two complex matrices.static CMatrix
sub
(CooCMatrix src, CNumber a) Subtracts a complex number from all entries (including zero values) of a complex sparse matrix.
-
Constructor Details
-
ComplexSparseMatrixOperations
private ComplexSparseMatrixOperations()
-
-
Method Details
-
add
Adds two real sparse matrices. This method assumes that the indices of the two matrices are sorted lexicographically.- Parameters:
src1
- First matrix in the sum.src2
- Second matrix in the sum.- Returns:
- The sum of the two matrices
src1
andsrc2
. - Throws:
IllegalArgumentException
- If the two matrices do not have the same shape.
-
add
Adds a complex number to all entries (including zero values) of a complex sparse matrix.- Parameters:
src
- Sparse matrix to add complex value to.a
- Complex value to add to the sparse matrix.- Returns:
- The result of the matrix addition.
- Throws:
ArithmeticException
- If thesrc
sparse matrix is too large to be converted to a dense matrix. That is, there are more thanInteger.MAX_VALUE
entries in the matrix (including zero entries).
-
sub
Computes the difference between two complex matrices. This method assumes that the indices of the two matrices are sorted lexicographically.- Parameters:
src1
- First matrix in the difference.src2
- Second matrix in the difference.- Returns:
- The difference of the two matrices
src1
andsrc2
. - Throws:
IllegalArgumentException
- If the two matrices do not have the same shape.
-
sub
Subtracts a complex number from all entries (including zero values) of a complex sparse matrix.- Parameters:
src
- Sparse matrix to subtract complex value from.a
- Complex value to add to the sparse matrix.- Returns:
- The result of the matrix addition.
- Throws:
ArithmeticException
- If thesrc
sparse matrix is too large to be converted to a dense matrix. That is, there are more thanInteger.MAX_VALUE
entries in the matrix (including zero entries).
-
elemMult
Multiplies two sparse matrices element-wise. This method assumes that the indices of the two matrices are sorted lexicographically.- Parameters:
src1
- First matrix in the element-wise multiplication.src2
- Second matrix in the element-wise multiplication.- Returns:
- The element-wise product of the two matrices
src1
andsrc2
. - Throws:
IllegalArgumentException
- If the two matrices do not have the same shape.
-
addToEachCol
Adds a sparse vector to each column of a sparse matrix as if the vector is a column vector.- Parameters:
src
- The source sparse matrix.col
- Sparse vector to add to each column of the sparse matrix.- Returns:
- A dense copy of the
src
matrix with thecol
vector added to each row of the matrix.
-
addToEachRow
Adds a sparse vector to each row of a sparse matrix as if the vector is a row vector.- Parameters:
src
- The source sparse matrix.row
- Sparse vector to add to each row of the sparse matrix.- Returns:
- A dense copy of the
src
matrix with therow
vector added to each row of the matrix.
-