MCPcopy Create free account
hub / github.com/dask/dask / compression_level

Function compression_level

dask/array/linalg.py:624–654  ·  view source on GitHub ↗

Compression level to use in svd_compressed Given the size ``n`` of a space, compress that that to one of size ``q`` plus n_oversamples. The oversampling allows for greater flexibility in finding an appropriate subspace, a low value is often enough (10 is already a very conserva

(n, q, n_oversamples=10, min_subspace_size=20)

Source from the content-addressed store, hash-verified

622
623
624def compression_level(n, q, n_oversamples=10, min_subspace_size=20):
625 """Compression level to use in svd_compressed
626
627 Given the size ``n`` of a space, compress that that to one of size
628 ``q`` plus n_oversamples.
629
630 The oversampling allows for greater flexibility in finding an
631 appropriate subspace, a low value is often enough (10 is already a
632 very conservative choice, it can be further reduced).
633 ``q + oversampling`` should not be larger than ``n``. In this
634 specific implementation, ``q + n_oversamples`` is at least
635 ``min_subspace_size``.
636
637 Parameters
638 ----------
639 n: int
640 Column/row dimension of original matrix
641 q: int
642 Size of the desired subspace (the actual size will be bigger,
643 because of oversampling, see ``da.linalg.compression_level``)
644 n_oversamples: int, default=10
645 Number of oversamples used for generating the sampling matrix.
646 min_subspace_size : int, default=20
647 Minimum subspace size.
648
649 Examples
650 --------
651 >>> compression_level(100, 10)
652 20
653 """
654 return min(max(min_subspace_size, q + n_oversamples), n)
655
656
657def compression_matrix(

Callers 1

compression_matrixFunction · 0.85

Calls 2

minFunction · 0.85
maxFunction · 0.85

Tested by

no test coverage detected