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 CooMatrixRemoves a specified column from a sparse matrix.static CooMatrixremoveCols(CooMatrix src, int... colIdxs) Removes a list of specified columns from a sparse matrix.static CooMatrixRemoves a specified row from a sparse matrix.static CooMatrixremoveRows(CooMatrix src, int... rowIdxs) Removes multiple rows from a real sparse matrix.static CooMatrixSwaps two columns, in place, in a sparse matrix.static CooMatrixSwaps 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 thesrcmatrix.- Returns:
- A sparse matrix which has one less row than the
srcmatrix 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 thesrcmatrix. 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
srcmatrix 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 thesrcmatrix.- Returns:
- A sparse matrix which has one less column than the
srcmatrix 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 thesrcmatrix.- Returns:
- A copy of the
srcsparse 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
srcsparse 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
srcsparse matrix.
-