API Reference
Interface Meta-Functions
The main goal of this function to provide a universal interface to smooth functions and proximable functions to be used by proximal gradient algorithms.
ProximalCore.gradient! — Function
gradient!(y, f, x)In-place gradient (and value) of f at x.
The gradient is written to the (pre-allocated) array y, which should have the same shape/size as x.
Returns the value f at x.
See also: gradient.
ProximalCore.gradient — Method
gradient(f, x)Gradient (and value) of f at x.
Return a tuple (y, fx) consisting of
y: the gradient offatxfx: the value offatx
See also: gradient!.
ProximalCore.prox — Function
prox(f, x, gamma=1)Proximal mapping for f, evaluated at x, with stepsize gamma.
The proximal mapping is defined as
\[\mathrm{prox}_{\gamma f}(x) = \arg\min_z \left\{ f(z) + \tfrac{1}{2\gamma}\|z-x\|^2 \right\}.\]
Returns a tuple (y, fy) consisting of
y: the output of the proximal mapping offatxwith stepsizegammafy: the value offaty
See also: prox!.
ProximalCore.prox! — Function
prox!(y, f, x, gamma=1)In-place proximal mapping for f, evaluated at x, with stepsize gamma.
The proximal mapping is defined as
\[\mathrm{prox}_{\gamma f}(x) = \arg\min_z \left\{ f(z) + \tfrac{1}{2\gamma}\|z-x\|^2 \right\}.\]
The result is written to the (pre-allocated) array y, which should have the same shape/size as x.
Returns the value of f at y.
See also: prox.
Properties
ProximalCore.is_affine_indicator — Method
is_affine_indicator(T::Type)Returns true if the type T represents the indicator of an affine set. An affine set is a set that can be represented as the solution set of a system of linear equations. In other words, f(x) = 0 if Ax = b, for a given matrix A and vector b, and ∞ otherwise.
ProximalCore.is_cone_indicator — Method
is_cone_indicator(T::Type)Returns true if the type T represents the indicator function of a cone. A cone is a set C such that if x ∈ C, then λx ∈ C for any λ ≥ 0. In other words, is a set that is closed under non-negative scaling. ``
ProximalCore.is_convex — Method
is_convex(T::Type)Returns true if the type T represents a convex function. A function f(x) is convex if its domain is a convex set and for all x, y in the domain and for all λ in [0, 1], we have f(λx + (1-λ)y) ≤ λf(x) + (1-λ)f(y).
ProximalCore.is_generalized_quadratic — Method
is_generalized_quadratic(T::Type)Returns true if the type T represents a generalized quadratic function, i.e. a quadratic function over a subspace and +∞ outside of it. A quadratic function has the form f(x)=(1/2)*<Ax, x> + <b, x> + c where A is a symmetric matrix, b is a vector, and c a real number.
ProximalCore.is_locally_smooth — Method
is_locally_smooth(T::Type)Returns true if the type T represents a locally smooth function. A function f(x) is locally smooth if it is smooth on every open set within its domain. If f is locally smooth, then gradient!(y, f, x) is expected to be defined, and it should return the value of f at x and store the gradient in y.
ProximalCore.is_positively_homogeneous — Method
is_positively_homogeneous(T::Type)Returns true if the type T represents a positively homogeneous function. A function f(x) is positively homogeneous if f(λx) = λf(x) for all λ ≥ 0.
ProximalCore.is_proximable — Method
is_proximable(T::Type)Returns true if the type T has a proximal operator that can be expressed in a closed formula. (i.e. prox! function is defined for the type T).
ProximalCore.is_quadratic — Method
is_quadratic(T::Type)Returns true if the type T represents a quadratic function. A function f(x) is quadratic if it is smooth and its Hessian is constant.
ProximalCore.is_separable — Method
is_separable(T::Type)Returns true if the type T represents a separable function. A function f(x) is separable if it can applied to each element of x independently.
ProximalCore.is_set_indicator — Method
is_set_indicator(T::Type)Returns true if the type T represents an indicator function of a set. The indicator of a set S is a function associating 0 to points in S, and ∞ otherwise.
ProximalCore.is_singleton_indicator — Method
is_singleton_indicator(T::Type)Returns true if the type T represents a singleton indicator function. An indicator function f(x) is a singleton if it is 0 for a single value and ∞ otherwise.
ProximalCore.is_smooth — Method
is_smooth(T::Type)Returns true if the type T represents a smooth function. A function f(x) is smooth if it is continuously differentiable and its gradient is Lipschitz. If f is smooth, then gradient!(y, f, x) is expected to be defined, and it should return the value of f at x and store the gradient in y.
ProximalCore.is_strongly_convex — Method
is_strongly_convex(T::Type)Returns true if the type T represents a strongly convex function. A function f(x) is strongly convex if it is convex and there exists a positive constant μ such that f(x) - μ/2 * ||x||^2 is convex.
ProximalCore.is_support — Method
is_support(T::Type)Returns true if the type T represents a support function of a set. A function f(x) is a support function of a set C if f(x) = sup{⟨x, c⟩ : c ∈ C}.
Basic Functions
ProximalCore.ConvexConjugate — Type
ConvexConjugate(f)Constructs the convex conjugate of the function f. The convex conjugate of a function f is defined as f*(y) = sup_x {<x, y> - f(x)}.
ProximalCore.IndZero — Type
IndZero()Constructs the indicator function of the zero set, i.e., the function that is zero if the input is zero and infinity otherwise.
Example
julia> f = ProximalCore.IndZero()
ProximalCore.IndZero()
julia> f([1.0, 2.0, 3.0])
Inf
julia> f([0.0, 0.0, 0.0])
0.0ProximalCore.Zero — Type
Zero()Constructs the zero function, i.e., the function that is zero everywhere.
Example
julia> f = ProximalCore.Zero()
ProximalCore.Zero()
julia> f(rand(3))
0.0