capytaine.tools.lazy_matrices module

Lazy matrix where the rows are computed and stored on demand when the matrix-vector product is requested.

class capytaine.tools.lazy_matrices.LazyMatrix(row_constructor, shape, *, chunk_size=10, dtype=<class 'float'>)[source]

Bases: object

capytaine.tools.lazy_matrices.slices(start, stop, chunk_size)[source]

Generator returning slices covering the range from start to stop with chunk_size elements per slice.

>>> list(slices(0, 50, 10))
[slice(0, 15, None),
 slice(15, 30, None),
 slice(30, 45, None),
 slice(45, 50, None)]