Class RealSparseMatrixManipulations
java.lang.Object
org.flag4j.linalg.ops.sparse.coo.real.RealSparseMatrixManipulations
This utility class contains implementations for real sparse COO matrix manipulations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic CooMatrix
Removes a specified column from a sparse matrix.static CooMatrix
removeCols
(CooMatrix src, int... colIdxs) Removes a list of specified columns from a sparse matrix.static CooMatrix
Removes a specified row from a sparse matrix.static CooMatrix
removeRows
(CooMatrix src, int... rowIdxs) Removes multiple rows from a real sparse matrix.static CooMatrix
Swaps two columns, in place, in a sparse matrix.static CooMatrix
Swaps two rows, in place, in a sparse matrix.
-
Method Details
-
removeRow
Removes a specified row from a sparse matrix.- Parameters:
src
- Source matrix to remove row from.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. This array is assumed to be sorted and contain unique indices (however, this is not checked or enforced). If it is not sorted, callArrays.sort(int[])
first otherwise the behavior of this method is not defined.- 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.
-
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.
-