Class NativeHDF5MatrixStorage

java.lang.Object
org.episteme.nativ.mathematics.linearalgebra.matrices.storage.NativeHDF5MatrixStorage
All Implemented Interfaces:
AutoCloseable, MatrixStorage<Real>

public class NativeHDF5MatrixStorage extends Object implements MatrixStorage<Real>, AutoCloseable
Matrix storage backed by HDF5 with hyperslab support for partial loading.

This storage allows working with matrices larger than available RAM by loading only the required tiles from disk on-demand.

Since:
1.1
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • NativeHDF5MatrixStorage

      public NativeHDF5MatrixStorage(Path hdf5Path, String datasetName)
      Creates HDF5-backed matrix storage.
      Parameters:
      hdf5Path - Path to HDF5 file
      datasetName - Name of dataset within file
  • Method Details

    • rows

      public int rows()
      Description copied from interface: MatrixStorage
      Returns the number of rows.
      Specified by:
      rows in interface MatrixStorage<Real>
      Returns:
      the row count
    • cols

      public int cols()
      Description copied from interface: MatrixStorage
      Returns the number of columns.
      Specified by:
      cols in interface MatrixStorage<Real>
      Returns:
      the column count
    • get

      public Real get(int row, int col)
      Description copied from interface: MatrixStorage
      Returns the element at the specified position.
      Specified by:
      get in interface MatrixStorage<Real>
      Parameters:
      row - the row index
      col - the column index
      Returns:
      the element at [row, col]
    • set

      public void set(int row, int col, Real value)
      Description copied from interface: MatrixStorage
      Sets the element at the specified position.
      Specified by:
      set in interface MatrixStorage<Real>
      Parameters:
      row - the row index
      col - the column index
      value - the value to set
    • loadBlock

      public Matrix<Real> loadBlock(int startRow, int startCol, int rowCount, int colCount)
      Loads a rectangular block from the HDF5 file.
      Parameters:
      startRow - Starting row (0-indexed)
      startCol - Starting column (0-indexed)
      rowCount - Number of rows to load
      colCount - Number of columns to load
      Returns:
      Matrix containing the loaded block
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • clone

      public NativeHDF5MatrixStorage clone()
      Description copied from interface: MatrixStorage
      Creates a deep copy of this storage.
      Specified by:
      clone in interface MatrixStorage<Real>
      Overrides:
      clone in class Object
      Returns:
      a clone of this storage