Class RealCsrManipulations

java.lang.Object
org.flag4j.linalg.ops.sparse.csr.real.RealCsrManipulations

public final class RealCsrManipulations extends Object
Utility class for manipulating real sparse CSR matrices (e.g. row swaps, column swaps, etc.).
  • Method Details

    • swapRows

      public static void swapRows(CsrMatrix src, int rowIdx1, int rowIdx2)
      Swaps two rows in a sparse CSR matrix. This is done in place.
      Parameters:
      src - The matrix to swap rows within, done in place.
      rowIdx1 - Index of the first row to swap.
      rowIdx2 - Index of the second row to swap.
      Throws:
      IndexOutOfBoundsException - If either rowIdx1 or rowIdx2 is out of bounds of the rows of this matrix.
    • swapCols

      public static void swapCols(CsrMatrix src, int colIdx1, int colIdx2)
      Swaps two columns in a sparse CSR matrix. This is done in place.
      Parameters:
      src - The matrix to swap rows within, done in place.
      colIdx1 - Index of the first column to swap.
      colIdx2 - Index of the second column to swap.
      Throws:
      IndexOutOfBoundsException - If either colIndex1 or colIndex2 is out of bounds of the columns of this matrix.