math.py 🚧¢

Source: LION/utils/math.py

Warning

This file has not yet received a complete narrative and docstring audit. Its public source-level API is listed automatically below.

Utility math functions.

power_method(op: Operator, maxiter: int = 100, tol: float = 1e-06, device: torch.device | str | None = None) torch.Tensor

Estimate operator norm by power iteration using torch.

Parameters β€”β€”β€”- op : Operator The operator for which to estimate the norm. maxiter : int Number of power iterations. tol : float Absolute tolerance for convergence. (TODO: consider adding relative tolerance?) device : torch.device | str | None Device for computations. If None, use operator’s device.

Returns β€”β€”- sigma : torch.Tensor Estimated operator norm.

test_convexity(net, x, device)

No docstring is available.