Class ComplexSparseMatrixManipulations
java.lang.Object
org.flag4j.operations.sparse.coo.complex.ComplexSparseMatrixManipulations
This class contains implementations for complex sparse matrix manipulations.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static void
copyRanges
(CooCMatrix src, CNumber[] entries, int[] rowIndices, int[] colIndices, int[] startEnd) A helper method which copies from a sparse matrix to a set of three arrays (non-zero entries, row indices, and column indices) but skips over a specified range.static CooCMatrix
removeCol
(CooCMatrix src, int colIdx) Removes a specified column from a sparse matrix.static CooCMatrix
removeCols
(CooCMatrix src, int... colIdxs) Removes a list of specified columns from a sparse matrix.static CooCMatrix
removeRow
(CooCMatrix src, int rowIdx) Removes a specified row from a sparse matrix.static CooCMatrix
removeRows
(CooCMatrix src, int... rowIdxs) Removes multiple rows from a real sparse matrix.static CooCMatrix
swapCols
(CooCMatrix src, int colIdx1, int colIdx2) Swaps two columns, in place, in a sparse matrix.static CooCMatrix
swapRows
(CooCMatrix src, int rowIdx1, int rowIdx2) Swaps two rows, in place, in a sparse matrix.
-
Constructor Details
-
ComplexSparseMatrixManipulations
private ComplexSparseMatrixManipulations()
-
-
Method Details
-
removeRow
Removes a specified row from a sparse matrix.- Parameters:
src
- Source matrix to remove row of.rowIdx
- Row to remove from thesrc
matrix.- Returns:
- A sparse matrix which has one less row than the
src
matrix with the specified row removed.
-
removeRows
Removes multiple rows from a real sparse matrix.- Parameters:
src
- The source sparse matrix to remove rows from.rowIdxs
- Indices of rows to remove from thesrc
matrix.- Returns:
- A copy of the
src
matrix with the specified rows removed.
-
removeCol
Removes a specified column from a sparse matrix.- Parameters:
src
- Source matrix to remove column from.colIdx
- Column to remove from thesrc
matrix.- Returns:
- A sparse matrix which has one less column than the
src
matrix with the specified column removed.
-
removeCols
Removes a list of specified columns from a sparse matrix.- Parameters:
src
- Source matrix to remove columns from.colIdxs
- Columns to remove from thesrc
matrix.- Returns:
- A copy of the
src
sparse matrix with the specified columns removed.
-
copyRanges
private static void copyRanges(CooCMatrix src, CNumber[] entries, int[] rowIndices, int[] colIndices, int[] startEnd) A helper method which copies from a sparse matrix to a set of three arrays (non-zero entries, row indices, and column indices) but skips over a specified range.- Parameters:
src
- Source sparse matrix to copy from.entries
- Array to copy src non-zero entries to.rowIndices
- Array to copy src row indices entries to.colIndices
- Array to copy src column indices entries to.startEnd
- An array of length two specifying thestart
(inclusive) andend
(exclusive) indices of the range to skip during the copy.
-
swapRows
Swaps two rows, in place, in a sparse matrix.- Parameters:
src
- The source sparse matrix to swap rows within.rowIdx1
- Index of the first row in the swap.rowIdx2
- Index of the second row in the swap.- Returns:
- A reference to the
src
sparse matrix.
-
swapCols
Swaps two columns, in place, in a sparse matrix.- Parameters:
src
- The source sparse matrix to swap columns within.colIdx1
- Index of the first row in the swap.colIdx2
- Index of the second row in the swap.- Returns:
- A reference to the
src
sparse matrix.
-