Class RealCooMatrixGetSet
java.lang.Object
org.flag4j.linalg.ops.sparse.coo.real.RealCooMatrixGetSet
This class provides methods for getting and setting elements and slices from/to a real sparse matrix.
-
Method Summary
Modifier and TypeMethodDescriptionstatic CooVectorGets a specified column from this sparse matrix.static CooVectorGets a specified column range from this sparse matrix.static CooVectorGets a specified row from this sparse matrix.static CooVectorGets a specified row range from this sparse matrix.static CooMatrixGets a specified rectangular slice of a sparse matrix.static doubleGets the specified element from a sparse matrix.static CooMatrixSets the specified element from a sparse matrix.static CooMatrixSets a column of a sparse matrix to the data of a dense array.static CooMatrixSets a column of a sparse matrix to the values in a sparse tensor.static CooMatrixSets a specified row of a real sparse matrix to the values of a dense array.static CooMatrixSets a specified row of a real sparse COO matrix to the values in a sparse COO vector.static CooMatrixCopies a sparse matrix and sets a slice of the sparse matrix to the data of a dense array.static CooMatrixCopies a sparse matrix and sets a slice of the sparse matrix to the data of a dense array.static CooMatrixCopies a sparse matrix and sets a slice of the sparse matrix to the data of a dense matrix.static CooMatrixCopies a sparse matrix and sets a slice of the sparse matrix to the data of another sparse matrix.
-
Method Details
-
matrixGet
Gets the specified element from a sparse matrix.- Parameters:
src- Source matrix to get value from.row- Row index of the value to get from the sparse matrix.col- Column index of the value to get from the sparse matrix.- Returns:
- The value in the sparse matrix at the specified indices.
-
matrixSet
Sets the specified element from a sparse matrix.- Parameters:
src- Sparse matrix to set value in.row- Row index of the value to set in the sparse matrix.col- Column index of the value to set in the sparse matrix.value- Value to set.- Returns:
- The
-
setRow
Sets a specified row of a real sparse COO matrix to the values in a sparse COO vector.- Parameters:
src- Sparse COO matrix to set row in.rowIdx- Index of the row to set.row- Sparse COO vector containing new data for the row.- Returns:
- A new COO matrix resulting from setting row
rowIdxinsrctorow. - Throws:
IllegalArgumentException- Ifrow.length != src.numCols.
-
setRow
Sets a specified row of a real sparse matrix to the values of a dense array.- Parameters:
src- Source matrix to set the row of.rowIdx- Index of the row to set.row- Dense array containing the data of the row to set.- Returns:
- A copy of the
srcmatrix with the specified row set to the denserowarray.
-
setCol
Sets a column of a sparse matrix to the data of a dense array.- Parameters:
src- Source matrix to set column of.colIdx- The index of the column to set within thesrcmatrix.col- The dense array containing the new column data for thesrcarray.- Returns:
- A copy of the
srcmatrix with the specified column set to the dense array. - Throws:
IllegalArgumentException- If thecolIdxis not within the range of the matrix.IllegalArgumentException- If thecolarray does not have the same length as the number of rows insrcmatrix.
-
setCol
Sets a column of a sparse matrix to the values in a sparse tensor.- Parameters:
src- Source matrix to set column of.colIdx- Index of the column to set.col- New data for the specified column.- Returns:
- A copy of the
srcmatrix with the specified column set to thecolsparse vector. - Throws:
IllegalArgumentException- If thesrcmatrix does not have the same number of rows as total data in thecolvector.
-
setSlice
Copies a sparse matrix and sets a slice of the sparse matrix to the data of another sparse matrix.- Parameters:
src- Source sparse matrix to copy and set values of.values- Values of the slice to be set.row- Starting row index of slice.col- Starting column index of slice.- Returns:
- A copy of the
srcmatrix with the specified slice set to thevaluesmatrix. - Throws:
IllegalArgumentException- If thevaluesmatrix does not fit in thesrcmatrix given the row and column index.
-
setSlice
Copies a sparse matrix and sets a slice of the sparse matrix to the data of a dense array.- Parameters:
src- Source sparse matrix to copy and set values of.values- Dense values of the slice to be set.row- Starting row index of slice.col- Starting column index of slice.- Returns:
- A copy of the
srcmatrix with the specified slice set to thevaluesarray. - Throws:
IllegalArgumentException- If thevaluesarray does not fit in thesrcmatrix given the row and column index.
-
setSlice
Copies a sparse matrix and sets a slice of the sparse matrix to the data of a dense matrix.- Parameters:
src- Source sparse matrix to copy and set values of.values- Dense matrix containing values of the slice to be set.row- Starting row index of slice.col- Starting column index of slice.- Returns:
- A copy of the
srcmatrix with the specified slice set to thevaluesarray. - Throws:
IllegalArgumentException- If thevaluesarray does not fit in thesrcmatrix given the row and column index.
-
setSlice
Copies a sparse matrix and sets a slice of the sparse matrix to the data of a dense array.- Parameters:
src- Source sparse matrix to copy and set values of.values- Dense values of the slice to be set.row- Starting row index of slice.col- Starting column index of slice.- Returns:
- A copy of the
srcmatrix with the specified slice set to thevaluesarray. - Throws:
IllegalArgumentException- If thevaluesarray does not fit in thesrcmatrix given the row and column index.
-
getRow
-
getRow
Gets a specified row range from this sparse matrix.- Parameters:
src- Source sparse matrix to extract row from.rowIdx- Index of the row to extract from thesrcmatrix.start- Staring column index of the column to be extracted (inclusive).end- Ending column index of the column to be extracted (exclusive)- Returns:
- Returns the specified column range from this sparse matrix.
-
getCol
-
getCol
Gets a specified column range from this sparse matrix.- Parameters:
src- Source sparse matrix to extract column from.colIdx- Index of the column to extract from thesrcmatrix.start- Staring row index of the column to be extracted (inclusive).end- Ending row index of the column to be extracted (exclusive)- Returns:
- Returns the specified column range from this sparse matrix.
-
getSlice
Gets a specified rectangular slice of a sparse matrix.- Parameters:
src- Sparse matrix to extract slice from.rowStart- Starting row index of the slice (inclusive).rowEnd- Ending row index of the slice (exclusive).colStart- Staring column index of a slice (inclusive).colEnd- Ending column index of the slice (exclusive).- Returns:
- The specified slice of the sparse matrix.
-