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

Function compression_level

dask/array/linalg.py:622–652  ·  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

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

Callers 1

compression_matrixFunction · 0.85

Calls 2

minFunction · 0.85
maxFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…