xtrace

trace.xtrace(
    A,
    batch=32,
    pdf='sphere',
    converge='default',
    seed=None,
    full=False,
    callback=None,
    **kwargs,
)

Estimates the trace of A using the XTrace estimator.

This function implements Epperly’s exchangeable ‘XTrace’ estimator.

Parameters

Name Type Description Default
A Union[LinearOperator, np.ndarray] real symmetric matrix or linear operator. required
batch int Number of random vectors to sample at a time for batched matrix multiplication. 32
pdf Union[str, Callable] Choice of zero-centered distribution to sample random vectors from. 'sphere'
converge Union[str, ConvergenceCriterion] Convergence criterion to test for estimator convergence. See details. 'default'
seed Union[int, np.random.Generator, None] Seed to initialize the rng entropy source. Set seed > -1 for reproducibility. None
full bool Whether to return additional information about the computation. False
callback Optional[Callable] Optional callable to execute after each batch of samples. None
**kwargs dict Additional keyword arguments to parameterize the convergence criterion. {}

Returns

Name Type Description
Union[float, tuple] Estimate the trace of A. If info = True, additional information about the computation is also returned.