BallisticLA / RandBLAS

A header-only C++ library for sketching in randomized linear algebra
https://randblas.readthedocs.io/en/latest/
Other
66 stars 4 forks source link

Simplify DenseSkOp memory management semantics #41

Closed rileyjmurray closed 1 year ago

rileyjmurray commented 1 year ago

The situation before this PR

The DenseSkOp class has complicated semantics for memory management and lazy instantiation. These semantics have so far been governed by the persistent and filled members of DenseSkOp objects. In particular, the current implementation of LSKGE3 inspects these members and decides whether it needs to allocate memory and/or sample random numbers that define the sketching operator. The details of how this currently happens is not very relevant to this PR.

The situation after this PR is merged

This PR removes the persistent and filled members of the DenseSkOp class.

This PR introduces a new function called realize_full that operates on DenseSkOp objects. Calling realize_full(S) populates S.buff as a matrix of size S.n_rows by S.n_cols in S.layout order. It also sets a flag to deallocate S.buff when the destructor is called for S.

Here are the new semantics of LSKGE3, in terms of a DenseSkOp object S.