pyproximal.Simplex#
- pyproximal.Simplex(n, radius, dims=None, axis=-1, maxiter=100, ftol=1e-08, xtol=1e-08, call=True, engine='numpy')[source]#
Simplex proximal operator.
Proximal operator of a Simplex: \(\Delta_n(r) = \{ \mathbf{x}: \sum_i x_i = r,\; x_i \geq 0 \}\). This operator can be applied to a single vector as well as repeatedly to a set of vectors which are defined as the rows (or columns) of a matrix obtained by reshaping the input vector as defined by the
dimsandaxisparameters.- Parameters
- n
int Number of elements of input vector
- radius
float Radius
- dims
tuple, optional Dimensions of the matrix onto which the input vector is reshaped
- axis
int, optional Axis along which simplex is repeatedly applied when
dimsis not provided- maxiter
int, optional Maximum number of iterations used by bisection
- ftol
float, optional Function tolerance in bisection (only with
engine='numba'orengine='cuda')- xtol
float, optional Solution absolute tolerance in bisection
- call
bool, optional Evalutate call method (
True) or not (False)- engine
str, optional Engine used for simplex computation (
numpy,numba``or ``cuda).
- n
- Raises
- KeyError
If
engineis neithernumpynornumbanorcuda- ValueError
If
dimsis provided as a list (or tuple) with more or less than 2 elements
Notes
As the Simplex is an indicator function, the proximal operator corresponds to its orthogonal projection (see
pyproximal.projection.SimplexProjfor details.Note that
taudoes not have effect for this proximal operator, any positive number can be provided.