optim.mean_diagonal

Contents

optim.mean_diagonal#

bartorch.optim.mean_diagonal()#

Estimate the mean of the diagonal of \(A^H A\) from random probes (Hutchinson).

For a probe \(v\) of independent standard complex normal entries, \(\operatorname{Re} v^H A^H A v / \lVert v \rVert^2\) estimates the trace of the normal operator over its size. A penalty stated relative to this value, \(\rho = \lambda d\), keeps its meaning however the data, the density weights or a subspace basis scale the encoding, which a plug-and-play penalty annealed as \(\lambda d / \sigma_k^2\) needs.

Parameters:
  • A (LinearOperator) – Encoding operator; its normal() is applied once per probe.

  • probes (int, default=1) – Probes averaged. The relative spread of one probe is about \(1/\sqrt{n}\) for an operator of \(n\) unknowns with a flat diagonal, so a volume needs one.

  • seed (int, default=0) – Seed of the generator the probes are drawn from.

  • device (torch.device or str, default=None) – Where the probes are drawn, applied and reduced; on the host when omitted. On the card the operator was built on, a volume’s probe never crosses the bus; the generator is the card’s, so the estimate differs from the host’s by the probe’s spread. An operator built elsewhere is applied where it was built.

Returns:

The estimate.

Return type:

float

Examples

>>> rho = 0.05 * mean_diagonal(A) / sigma**2