Optimisation (optix.optim)
Proximity operators, finite-difference operators and ADMM and primal–dual solvers, the building blocks of the regularised estimators. See Optimisation tools.
No stability promise
optix.optim is semi-public: it may change without notice.
Proximity operators
Building blocks of convex optimisation: proximity operators, functions, finite-difference operators and solvers.
Semi-public: these may change without notice. They are shared by the
regularised estimators (for example
Ikoma).
- Proximity operators:
prox_box,prox_group_l2,project_group_l2,project_l2_ball,prox_schatten(withschatten_norm),project_schatten,prox_squared_l2,prox_shifted_poisson,prox_conjugate; the iterativeprox_hessian_schatten(withHessianSchattenResult). - Functions pairing a value and a prox:
Box,GroupL2,L2Ball,Schatten,HessianSchatten,SquaredL2,ShiftedPoisson; smooth functions (value, gradient, Lipschitz constant): the protocolSmoothandPoissonGaussian. - Linear operators: the protocols
LinearOperator(forward, adjoint, norm2) andCirculant(adds the Fourier symbols);Identity,Convolution(a transfer function), the finite differencesdiff,diff_adjoint,GradientandHessian;as_circulant. - Solvers:
admm_fft;primal_dual(withprimal_dual_step);chambolle_pock.
HessianSchattenResult
Bases: NamedTuple
Result of prox_hessian_schatten.
Attributes:
| Name | Type | Description |
|---|---|---|
x |
Tensor
|
The estimate x̂ = P_C(z − τ H*Ω), shaped like |
dual |
Tensor
|
The last dual iterate Ω, |
n_iter |
int
|
Number of iterations. |
prox_box
prox_box(v, lower=0.0, upper=None)
Projection onto the box [lower, upper].
prox(v) = min(max(v, lower), upper),
the proximity operator of the indicator function of the box, for any step size.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Tensor
|
Point to project. |
required |
lower
|
float or Tensor
|
Bounds (None: unbounded on that side). Default: [0, +∞), the non-negative orthant. |
0.0
|
upper
|
float or Tensor
|
Bounds (None: unbounded on that side). Default: [0, +∞), the non-negative orthant. |
0.0
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Projected point, a new tensor. |
prox_group_l2
prox_group_l2(v, t, *, dim=0)
Block soft threshold, the prox of t·∑ⱼ ‖vⱼ‖₂.
prox(v)ⱼ = max(1 − t / ‖vⱼ‖₂, 0) · vⱼ,
where vⱼ collects the components of v along dim at voxel j
(the gradient for isotropic total variation, the packed Hessian for
its Frobenius norm).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Tensor
|
Point, with the components along |
required |
t
|
float or Tensor
|
Threshold t ≥ 0 (step size times weight); a tensor broadcasts against the voxels. |
required |
dim
|
int
|
Component dim. |
0
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Thresholded point. |
project_group_l2
project_group_l2(v, radius, *, dim=0)
Projection of each vⱼ onto the ℓ2 ball of the given radius.
proj(v)ⱼ = vⱼ · min(1, r / ‖vⱼ‖₂).
This is the prox of the convex conjugate of r·∑ⱼ ‖vⱼ‖₂ (Moreau: v = prox_group_l2(v, r) + project_group_l2(v, r)).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Tensor
|
Point, with the components along |
required |
radius
|
float or Tensor
|
Ball radius r ≥ 0. |
required |
dim
|
int
|
Component dim. |
0
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Projected point. |
project_l2_ball
project_l2_ball(v, radius, center=0.0, weight=1.0, *, max_iter=500)
Projection onto the weighted ℓ2 ball ∑ⱼ wⱼ (zⱼ − cⱼ)² ≤ r².
The proximity operator of the indicator function of the ball, for any step size. With e = v − c, the projection is (KKT conditions)
z = c + e / (1 + μw),
with μ = 0 if v is inside the ball, otherwise the root μ > 0 of the
decreasing convex function φ(μ) = ∑ⱼ wⱼ eⱼ² / (1 + μwⱼ)² − r².
With a scalar w this is the closed form z = c + e·r / (√w ‖e‖₂);
otherwise Newton's method on φ from μ = 0, which increases
monotonically to the root, stopped when φ(μ) ≤ 10⁻¹²·r² or after
max_iter steps (then the point is scaled radially onto the ball,
so the result is always feasible). The scalar reductions are in
float64.
Far from the ball each Newton step increases μ by at most a factor
of about 1.5, so the number of steps grows like log₁.₅ of
√(∑ⱼ wⱼeⱼ²)/r. If the cap max_iter is reached (r tiny against
the distance, or weights spread over many decades), the result is
feasible but not the exact projection. Points close to the ball, as
in the iterations of tv_denoise,
take a few steps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Tensor
|
Point. |
required |
radius
|
float
|
r ≥ 0. |
required |
center
|
Tensor or float
|
Centre c; broadcasts with |
0.0
|
weight
|
Tensor or float
|
Weights w ≥ 0; broadcasts with |
1.0
|
max_iter
|
int
|
Maximum number of Newton steps (non-scalar weights). |
500
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Projected point. |
prox_schatten
prox_schatten(v, t, p, *, dim=0)
Prox of t·∑ⱼ ‖Xⱼ‖_{S_p}, for packed symmetric matrices.
With Y = U diag(σ) Vᴴ (singular value decomposition), the prox of a Schatten norm acts on the singular values only (Lefkimmiatis & Unser 2013, Proposition 1, Eq. 36):
prox_{t‖·‖_{S_p}}(Y) = U diag(prox_{t‖·‖_p}(σ)) Vᴴ,
with the ℓ_p proxes (Eqs. 43–47)
- p = 1: soft threshold, σ̂ᵢ = max(σᵢ − t, 0);
- p = 2: block soft threshold of the whole matrix (Eq. 44), the same
as
prox_group_l2on the packed vector; - p = ∞: σ̂ᵢ = min(σᵢ, c), with c = max(0, maxₖ (Sₖ − t)/k) and Sₖ the sum of the k largest σᵢ. For 2 × 2 matrices (σ₁ ≥ σ₂) this is c = 0 if σ₁ + σ₂ ≤ t, c = (σ₁ + σ₂ − t)/2 if |σ₁ − σ₂| < t < σ₁ + σ₂, and c = σ₁ − t if σ₁ − σ₂ ≥ t: Eq. (46) with the threshold written out (the paper states it for t = 1, and c = t·γ(σ/t)). It is σ minus the projection of σ onto the ℓ1 ball of radius t (Moreau).
For a symmetric matrix the singular values are the absolute
eigenvalues, and the map keeps the signs of the eigenvalues and the
eigenvectors: X̂ = U diag(ĝ(μ)) Uᵀ with ĝ(μ) = sign(μ)·σ̂. No
decomposition is formed for 2 × 2 matrices (eigenvalues m ± r,
X̂ = m̂·I + (r̂/r)·(X − m·I)); 3 × 3 matrices use the closed form
below. The packing is that of Hessian
(diagonal entries, then √2 times the off-diagonal ones), an isometry
for the Frobenius inner product, so this is exactly the matrix prox.
Dimensions
p = 2 is available for matrices of any size; p ∈ {1, ∞} for 1 × 1, 2 × 2 and 3 × 3 matrices (C = 1, 3, 6): 1-D, 2-D and 3-D images.
3 × 3 closed form (not in the papers, which are 2-D)
X = m·I + s·B with m = tr(X)/3 and s the largest absolute entry of X − m·I, so B is traceless with q = tr(B²) ≥ 1.
- The eigenvalue of B farthest from the other two is λ = sign(ρ)·2√(q/6)·cos(arccos(|ρ|)/3), with ρ = det(B)/(2(q/6)^{3/2}) (the trigonometric solution of the characteristic cubic, Smith 1961), refined by one Newton step on the cubic. Its gap to the others is at least √(q/2).
- Its unit eigenvector u is the largest cross product of two rows of B − λI, normalised; the gap keeps it well conditioned.
- The other two eigenvalues are m₂ ± r₂, those of B on the plane P = I − uuᵀ: m₂ = (tr B − uᵀBu)/2, r₂ = ‖D‖_F/√2 with D = P B P − m₂P, solved like a 2 × 2 matrix without a basis of the plane.
The map is X̂ = ĝ_u·uuᵀ + m̂·P + (r̂/r)·s·D. A repeated
eigenvalue is always the pair, which needs no eigenvectors, so
the result is accurate to a few ulps of s with repeated, nearly
repeated or zero eigenvalues; X = m·I maps to g(m)·I. Compared
with batched torch.linalg.eigh and the reconstruction
U diag(ĝ) Uᵀ (2·10⁵ matrices, one CPU thread), it is about 3
times faster in float32 (1.6 times in float64), at least as
accurate (within 5 ulps of a float64 reference in float32 and
about 10 in float64; float32 eigh: 16), element-wise (processed in
chunks of voxels to bound memory), and differentiable without
NaN, where the derivatives of eigh are NaN at repeated
eigenvalues. Smith OK, Eigenvalues of a symmetric 3 × 3
matrix, Commun ACM 4(4):168, 1961,
doi:10.1145/355578.366316.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Tensor
|
Packed symmetric matrices, components along |
required |
t
|
float or Tensor
|
Threshold t ≥ 0 (step size times weight); a tensor broadcasts
against the voxels (with a size-1 |
required |
p
|
(1, 2, inf)
|
Order of the Schatten norm. |
1
|
dim
|
int
|
Component dim. |
0
|
Returns:
| Type | Description |
|---|---|
Tensor
|
The prox, packed like |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
For p ∈ {1, ∞} with d > 3. |
schatten_norm
schatten_norm(v, p, *, dim=0)
Schatten p-norm of packed symmetric matrices, voxel by voxel.
v packs a symmetric d × d matrix X at every voxel along dim, as
the output of Hessian: the d diagonal
entries, then √2 times the entries above the diagonal, C = d(d + 1)/2
components. The singular values of X are the absolute values of its
eigenvalues, so (Lefkimmiatis, Ward & Unser 2013, Eq. 4)
‖X‖_{S₁} = ∑ |μᵢ|, ‖X‖_{S₂} = ‖X‖_F = ‖v‖₂,
‖X‖_{S∞} = maxᵢ |μᵢ|.
p = 2 is available for any d. For p ∈ {1, ∞} the eigenvalues are
computed in closed form for d ≤ 3: Lefkimmiatis, Bourquard & Unser
(2012, Eq. 15) for d = 2, and the method described in
prox_schatten for d = 3. The result
has finite derivatives everywhere.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Tensor
|
Packed matrices, components along |
required |
p
|
(1, 2, inf)
|
Order of the norm. |
1
|
dim
|
int
|
Component dim. |
0
|
Returns:
| Type | Description |
|---|---|
Tensor
|
‖Xⱼ‖_{S_p} per voxel ( |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
For p ∈ {1, ∞} with d > 3. |
project_schatten
project_schatten(v, radius, q, *, dim=0)
Projection of packed symmetric matrices onto the S_q ball of radius r.
By Proposition 1 of Lefkimmiatis, Ward & Unser (2013), the projection onto {X : ‖X‖_{S_q} ≤ r} projects the singular values onto the ℓ_q ball of radius r and keeps the singular vectors (Eqs. 33–36):
- q = 2: X · min(1, r/‖X‖_F) (Eq. 33; the same as
project_group_l2on the packed vector); - q = ∞: σ̂ᵢ = min(σᵢ, r) (Eq. 34);
- q = 1: σ̂ᵢ = max(σᵢ − γ, 0), with γ = max(0, maxₖ (Sₖ − r)/k) and Sₖ the sum of the k largest σᵢ (Eq. 35; for 2 × 2 matrices this is Eq. 36 scaled to radius r).
With 1/p + 1/q = 1 it is the prox of the convex conjugate of r·‖·‖_{S_p} (Moreau decomposition):
X = prox_schatten(X, r, p) + project_schatten(X, r, q).
The decomposition is that of prox_schatten
(closed form, 3 × 3 included).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Tensor
|
Packed symmetric matrices, components along |
required |
radius
|
float or Tensor
|
Radius r ≥ 0; a tensor broadcasts against the voxels (with a
size-1 |
required |
q
|
(1, 2, inf)
|
Order of the Schatten ball. |
1
|
dim
|
int
|
Component dim. |
0
|
Returns:
| Type | Description |
|---|---|
Tensor
|
The projection, packed like |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
For q ∈ {1, ∞} with d > 3. |
prox_hessian_schatten
prox_hessian_schatten(z, tau, p, *, ndim=None, lower=0.0, upper=None, max_iter=10, dual=None, boundary='mirror', hessian=None)
Hessian Schatten-norm denoising: prox of τ‖H·‖₁,ₚ + ι_C.
Solves (Lefkimmiatis, Ward & Unser 2013, Eq. 19)
x̂ = argmin_{x ∈ C} ½‖x − z‖₂² + τ ∑ₙ ‖[H x]ₙ‖_{S_p},
with H the discrete Hessian (Hessian; by
default with the stencil and boundary of their Eq. 10,
boundary="mirror") and C the box [lower, upper], by their
Algorithm 2 (denoise): FISTA (Beck & Teboulle 2009) on the dual
problem (Eqs. 21–32). The mixed norm is a maximum over the dual ball
(Lemma 1, Eqs. 21–22),
‖Ψ‖₁,ₚ = max_{Ω ∈ B∞,q} ⟨Ω, Ψ⟩, 1/p + 1/q = 1,
with B∞,q the set of fields whose matrices all lie in the unit S_q
ball. The minimiser is x̂ = P_C(z − τHΩ̂) (Eq. 29), where Ω̂
maximises the smooth dual objective s(Ω) (Eq. 28), whose gradient
∇s(Ω) = τ H P_C(z − τHΩ) (Eq. 30) is Lipschitz with L ≤ τ²‖H‖²
(Proposition 2: ‖H‖² ≤ 64 in 2-D). The iteration, from
Ψ₁ = Ω₀ = dual (0 by default) and t₁ = 1, is
Ωₙ = P_{B∞,q}(Ψₙ + 1/(τ‖H‖²) · H P_C(z − τH*Ψₙ))
tₙ₊₁ = (1 + √(1 + 4tₙ²))/2
Ψₙ₊₁ = Ωₙ + ((tₙ − 1)/tₙ₊₁)(Ωₙ − Ωₙ₋₁),
and returns P_C(z − τH*Ω) at the last Ω. The step 1/(τ‖H‖²) uses
the bound Hessian.norm2, 1/(64τ) in
2-D as in the paper (144 in 3-D). P_{B∞,q} projects every matrix of
the field onto the unit S_q ball
(project_schatten, Proposition 1
and Eqs. 33–36, in closed form for 2 × 2 and 3 × 3 matrices).
The paper runs a fixed number of iterations (10 in its deblurring
experiments, Section IV-A; 5 inside HSPIRAL1); max_iter sets it.
A dual iterate from a neighbouring problem (dual) warm-starts the
iteration; the momentum restarts at t₁ = 1 (not specified in the
paper).
Dimensions
The paper is 2-D. The algorithm is the same in 3-D, with the
3 × 3 Hessian and ‖H‖² ≤ 144; p ∈ {1, ∞} use the closed-form
3 × 3 eigen-decomposition of
prox_schatten.
References
- Lefkimmiatis S, Ward JP, Unser M. Hessian Schatten-norm regularization for linear inverse problems. IEEE Trans Image Process 22(5):1873-1888, 2013. doi:10.1109/TIP.2013.2237919
- Beck A, Teboulle M. Fast gradient-based algorithms for constrained total variation image denoising and deblurring problems. IEEE Trans Image Process 18(11):2419-2434, 2009. doi:10.1109/TIP.2009.2028250
BibTeX
@article{lefkimmiatis2013hessian,
author = {Lefkimmiatis, Stamatios and Ward, John Paul and
Unser, Michael},
title = {{Hessian} {Schatten}-Norm Regularization for
Linear Inverse Problems},
journal = {IEEE Transactions on Image Processing},
volume = {22},
number = {5},
pages = {1873--1888},
year = {2013},
doi = {10.1109/TIP.2013.2237919}
}
@article{beck2009fast,
author = {Beck, Amir and Teboulle, Marc},
title = {Fast Gradient-Based Algorithms for Constrained
Total Variation Image Denoising and Deblurring
Problems},
journal = {IEEE Transactions on Image Processing},
volume = {18},
number = {11},
pages = {2419--2434},
year = {2009},
doi = {10.1109/TIP.2009.2028250}
}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
Tensor
|
Noisy image |
required |
tau
|
float
|
Weight τ ≥ 0 (τ = 0 returns P_C(z)). |
required |
p
|
(1, 2, inf)
|
Order of the Schatten norm. |
1
|
ndim
|
int
|
Number of spatial dims. Default: |
None
|
lower
|
float or Tensor
|
Bounds of the box C (None: unbounded). Default: x ≥ 0. |
0.0
|
upper
|
float or Tensor
|
Bounds of the box C (None: unbounded). Default: x ≥ 0. |
0.0
|
max_iter
|
int
|
Number of iterations. Default: 10 (the paper's deblurring experiments). |
10
|
dual
|
Tensor
|
Starting dual Ω₀ |
None
|
boundary
|
(mirror, neumann, periodic)
|
Boundary of the default Hessian. Default: |
"mirror"
|
hessian
|
Hessian
|
The Hessian operator (overrides |
None
|
Returns:
| Type | Description |
|---|---|
HessianSchattenResult
|
|
prox_squared_l2
prox_squared_l2(v, t, data=0.0, weight=1.0)
prox_shifted_poisson
prox_shifted_poisson(v, t, data, variance=0.0)
Prox of the shifted-Poisson negative log-likelihood.
With c = y + σ² ≥ 0, the function is (Ikoma et al. 2018, Eq. S3)
f(z) = ∑ⱼ zⱼ − cⱼ log(zⱼ + σⱼ²),
and prox_{t f}(v) = argmin_z f(z) + ‖z − v‖² / (2t). Setting the derivative to 0 gives, with w = z + σ², s = v + σ² and ρ = 1/t, the quadratic ρw² + (1 − ρs)w − c = 0, whose non-negative root is computed without cancellation: with q = ρs − 1 and Δ = √(q² + 4ρc),
w = (q + Δ) / (2ρ) if q ≥ 0,
w = 2c / (Δ − q) otherwise,
and z = w − σ². This is algebraically the update (S17) of Ikoma et al.; with σ² = 0 it is the Poisson prox. The result satisfies z ≥ −σ² (z > −σ² when c > 0).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Tensor
|
Point. |
required |
t
|
float or Tensor
|
Step size t = 1/ρ > 0. |
required |
data
|
Tensor
|
Data y, with y + σ² ≥ 0 (clip beforehand); broadcasts with |
required |
variance
|
Tensor or float
|
Read-noise variance σ² ≥ 0 (σ² = 0: Poisson), broadcasts with |
0.0
|
Returns:
| Type | Description |
|---|---|
Tensor
|
prox_{t f}(v). |
prox_conjugate
prox_conjugate(prox, v, t)
Functions
Building blocks of convex optimisation: proximity operators, functions, finite-difference operators and solvers.
Semi-public: these may change without notice. They are shared by the
regularised estimators (for example
Ikoma).
- Proximity operators:
prox_box,prox_group_l2,project_group_l2,project_l2_ball,prox_schatten(withschatten_norm),project_schatten,prox_squared_l2,prox_shifted_poisson,prox_conjugate; the iterativeprox_hessian_schatten(withHessianSchattenResult). - Functions pairing a value and a prox:
Box,GroupL2,L2Ball,Schatten,HessianSchatten,SquaredL2,ShiftedPoisson; smooth functions (value, gradient, Lipschitz constant): the protocolSmoothandPoissonGaussian. - Linear operators: the protocols
LinearOperator(forward, adjoint, norm2) andCirculant(adds the Fourier symbols);Identity,Convolution(a transfer function), the finite differencesdiff,diff_adjoint,GradientandHessian;as_circulant. - Solvers:
admm_fft;primal_dual(withprimal_dual_step);chambolle_pock.
Function
Bases: Protocol
A proper, closed, convex function f with an easy prox.
value
value(z)
f(z), a float64 scalar (+inf outside the domain).
prox
prox(v, t)
prox_{t f}(v) = argmin_z f(z) + ‖z − v‖² / (2t).
Box
Box(lower=0.0, upper=None)
Indicator function of the box [lower, upper] (0 inside, +∞ outside).
Set the bounds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lower
|
float or Tensor
|
Bounds; None is unbounded. Default: [0, +∞). |
0.0
|
upper
|
float or Tensor
|
Bounds; None is unbounded. Default: [0, +∞). |
0.0
|
value
value(z)
0 inside the box, +inf outside.
prox
prox(v, t)
Projection onto the box (any t).
GroupL2
GroupL2(weight, dim=0)
Weighted mixed ℓ2,1 norm, w·∑ⱼ ‖zⱼ‖₂ (components along dim).
With z the gradient of an image this is its isotropic total
variation; with z the packed Hessian of
Hessian, ‖zⱼ‖₂ is the Frobenius norm of the
Hessian matrix at voxel j.
Set the weight.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
weight
|
float or Tensor
|
w ≥ 0; a tensor broadcasts against the voxels. |
required |
dim
|
int
|
Component dim. |
0
|
value
value(z)
w·∑ⱼ ‖zⱼ‖₂ in float64.
prox
prox(v, t)
Block soft threshold at t·w.
prox_conjugate
prox_conjugate(v, t)
Prox of t·F*: the projection of each vⱼ onto the ball of radius w.
The same as prox_conjugate(self.prox, v, t) (Moreau), for any
t, with fewer temporaries.
L2Ball
L2Ball(radius, center=0.0, weight=1.0)
Indicator function of the weighted ℓ2 ball ∑ⱼ wⱼ (zⱼ − cⱼ)² ≤ r².
0 inside, +∞ outside. With z an image and c the data, this is the discrepancy constraint of Rudin, Osher & Fatemi (1992, Eq. 2.3c).
Set the ball.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
float
|
r ≥ 0. |
required |
center
|
Tensor or float
|
Centre c. |
0.0
|
weight
|
Tensor or float
|
Weights w ≥ 0, broadcasting with c. |
1.0
|
value
value(z)
0 inside the ball (to a relative 10⁻⁶ of r²), +inf outside.
prox
prox(v, t)
Projection onto the ball (any t; see project_l2_ball).
Schatten
Schatten(weight, p=1, *, ndim=None, dim=0)
Mixed Schatten norm w·∑ⱼ ‖Zⱼ‖_{S_p} of a field of symmetric matrices.
zⱼ packs a symmetric d × d matrix Zⱼ along dim, as the output of
Hessian. With z = H x this is the Hessian
Schatten-norm regulariser ‖H x‖₁,ₚ of Lefkimmiatis & Unser (2013,
Eq. 11): the nuclear norm (p = 1, the sum of the absolute
eigenvalues), the Frobenius norm (p = 2, equal to
GroupL2) or the spectral norm (p = ∞, the
largest absolute eigenvalue). See
prox_schatten for the prox; p ∈ {1, ∞}
is available for matrices up to 3 × 3 (2-D and 3-D images).
Set the weight and the order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
weight
|
float or Tensor
|
w ≥ 0; a tensor broadcasts against the voxels. |
required |
p
|
(1, 2, inf)
|
Order of the Schatten norm. |
1
|
ndim
|
int
|
Matrix size d, checked against p (p ∈ {1, ∞} needs d ≤ 3). Default: taken from the number of components. |
None
|
dim
|
int
|
Component dim. |
0
|
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
For p ∈ {1, ∞} with d > 3. |
value
value(z)
w·∑ⱼ ‖Zⱼ‖_{S_p} in float64.
prox
prox(v, t)
Prox of t·w·∑ⱼ ‖·‖_{S_p} (see prox_schatten).
HessianSchatten
HessianSchatten(weight, p=1, *, ndim, lower=0.0, upper=None, n_iter=5, warm_start=True, boundary='mirror', hessian=None)
Hessian Schatten-norm penalty with a box constraint.
f(x) = w‖H x‖₁,ₚ + ι_C(x).
The function f₂ of Lefkimmiatis & Unser (2013, Eq. 25), split as a
whole in HSPIRAL1: its prox has no closed form and is computed by
prox_hessian_schatten
(Algorithm 2 of Lefkimmiatis, Ward & Unser 2013) with a fixed number
of iterations. Each call starts from the dual of the previous call
(Lefkimmiatis & Unser 2013, Section III-C: "we initialize the
internal variables ... with those obtained in the previous ADMM
iteration"); here the dual Ω is kept and the momentum restarts
(t₁ = 1, Ψ₁ = Ω; not specified in the paper). The prox is therefore
inexact and depends on the call history: use one instance per
problem, or reset().
Warm start
Inside ADMM, the warm-started inexact prox lets the outer
iteration converge to the minimiser, as the inner error shrinks
while the dual settles. warm_start=False with a small n_iter
does not converge to the prox, and ADMM then stalls away from
the minimiser while still meeting a relative-change stopping
rule: it is not a safer setting. Carrying Ψ and t over as well
does not settle either, because t keeps growing on a problem
that changes at every call.
Set the penalty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
weight
|
float
|
w ≥ 0 (τ in the paper). |
required |
p
|
(1, 2, inf)
|
Order of the Schatten norm. |
1
|
ndim
|
int
|
Number of spatial (trailing) dims of x. |
required |
lower
|
float or Tensor
|
Bounds of the box C. Default: x ≥ 0 (the paper). |
0.0
|
upper
|
float or Tensor
|
Bounds of the box C. Default: x ≥ 0 (the paper). |
0.0
|
n_iter
|
int
|
Iterations per prox. Default: 5 (Lefkimmiatis & Unser 2013, Section IV). |
5
|
warm_start
|
bool
|
Start each prox from the previous dual. Default: True (the paper). |
True
|
boundary
|
(mirror, neumann, periodic)
|
Boundary of the Hessian. Default: |
"mirror"
|
hessian
|
Hessian
|
The Hessian operator (overrides |
None
|
reset
reset()
Forget the stored dual.
value
value(z)
w‖H z‖₁,ₚ in float64, +inf outside the box.
prox
prox(v, t)
Approximate prox of t·f by n_iter dual iterations.
SquaredL2
SquaredL2(weight=1.0, data=0.0)
ShiftedPoisson
ShiftedPoisson(data, variance=0.0)
Shifted-Poisson negative log-likelihood (Ikoma et al. 2018, Eq. S3).
f(z) = ∑ⱼ zⱼ − (yⱼ + σⱼ²) log(zⱼ + σⱼ²),
up to a constant. The data y + σ² must be non-negative (clip y at −σ² beforehand). With σ² = 0 this is the Poisson likelihood.
Set the data and the read-noise variance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Tensor
|
Data y (in electrons), y + σ² ≥ 0. |
required |
variance
|
Tensor or float
|
Read-noise variance σ² ≥ 0 (in electrons²); broadcasts with
|
0.0
|
lipschitz
property
lipschitz
Lipschitz constant of ∇f on z ≥ 0: max (y + σ²)/σ⁴.
+inf when some σ² = 0 (Poisson).
value
value(z)
f(z) in float64; +inf where z + σ² ≤ 0 with y + σ² > 0.
grad
grad(z)
∇f(z) = 1 − (y + σ²)/(z + σ²).
prox
prox(v, t)
Closed form (see prox_shifted_poisson).
Smooth
Bases: Protocol
A convex, differentiable function h with a Lipschitz gradient.
lipschitz
property
lipschitz
Lipschitz constant of ∇h (may be +inf).
value
value(z)
h(z), a float64 scalar.
grad
grad(z)
∇h(z).
PoissonGaussian
PoissonGaussian(data, variance, *, max_terms=_SERIES_TERMS)
Exact Poisson–Gaussian negative log-likelihood (Chouzenoux et al. 2015).
With yᵢ = Poisson(zᵢ) + N(0, σᵢ²) (Eqs. 2.1–2.4), the function of z ∈ [0, +∞)^Q is (Eqs. 2.6–2.7)
φ(z) = ∑ᵢ φᵢ(zᵢ),
φᵢ(u) = −log ∑ₙ uⁿe^{−u}/n! · e^{−(yᵢ − n)²/2σᵢ²}/√(2πσᵢ²),
computed by
poisson_normal_logpdf.
Its derivative is φᵢ′(u) = 1 − ξᵢ(u), ξᵢ(u) = s(u, yᵢ − 1)/s(u, yᵢ)
(Eqs. 2.8, 2.10, 2.12; see
poisson_normal_ratio). It is
convex, with φᵢ″(u) = ηᵢ(u) ≤ ηᵢ(0) (Eq. 2.11, Theorem 2.1). For
u < 0 it is continued by the quadratic of Eq. (2.28),
φᵢ(u) = ½ηᵢ(0)u² + (1 − ξᵢ(0))u + φᵢ(0),
ξᵢ(0) = e^{(2yᵢ − 1)/2σᵢ²},
ηᵢ(0) = (1 − e^{−1/σᵢ²}) e^{(2yᵢ − 1)/σᵢ²}
(Eqs. 2.29–2.30), so that φ is convex and twice differentiable on ℝ^Q with a gradient of Lipschitz constant maxᵢ ηᵢ(0). The data need no clipping. The Lipschitz constant grows like e^{2 max y/σ²}: at high counts with low read noise it is too large to be useful.
Set the data and the read-noise variance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Tensor
|
Data y (in electrons). |
required |
variance
|
Tensor or float
|
Read-noise variance σ² > 0 (in electrons²); broadcasts with
|
required |
max_terms
|
int
|
Series terms evaluated at once (memory bound). |
_SERIES_TERMS
|
log_lipschitz
property
log_lipschitz
log maxᵢ ηᵢ(0), finite even when the constant overflows.
lipschitz
property
lipschitz
Lipschitz constant maxᵢ ηᵢ(0) of ∇φ (Theorem 2.1); may be inf.
value
value(z)
φ(z) in float64.
grad
grad(z)
∇φ(z) = 1 − ξ(z), with ξ(z) = ξ(0) − η(0)·z for z < 0.
1 − ξ is formed in float64 (float32 on MPS) and then cast to the
dtype of z. Raises a ValueError when the gradient is not
finite in that dtype (ξ overflows at large y/σ²).
Linear operators
Building blocks of convex optimisation: proximity operators, functions, finite-difference operators and solvers.
Semi-public: these may change without notice. They are shared by the
regularised estimators (for example
Ikoma).
- Proximity operators:
prox_box,prox_group_l2,project_group_l2,project_l2_ball,prox_schatten(withschatten_norm),project_schatten,prox_squared_l2,prox_shifted_poisson,prox_conjugate; the iterativeprox_hessian_schatten(withHessianSchattenResult). - Functions pairing a value and a prox:
Box,GroupL2,L2Ball,Schatten,HessianSchatten,SquaredL2,ShiftedPoisson; smooth functions (value, gradient, Lipschitz constant): the protocolSmoothandPoissonGaussian. - Linear operators: the protocols
LinearOperator(forward, adjoint, norm2) andCirculant(adds the Fourier symbols);Identity,Convolution(a transfer function), the finite differencesdiff,diff_adjoint,GradientandHessian;as_circulant. - Solvers:
admm_fft;primal_dual(withprimal_dual_step);chambolle_pock.
LinearOperator
Bases: Protocol
A linear operator A with C output components.
It maps an image (..., *N) to (..., C, *N), the components
stacked along dim -(d + 1) with d = len(N).
norm2
property
norm2
Upper bound on ‖A‖² (the largest eigenvalue of AᵀA).
forward
forward(x)
A x, (..., *N) → (..., C, *N).
adjoint
adjoint(y)
Aᵀ y, (..., C, *N) → (..., *N).
Circulant
Bases: LinearOperator, Protocol
A LinearOperator diagonal in Fourier.
Each component is a periodic convolution on the grid N, given by
its transfer function on the half spectrum of torch.fft.rfftn.
symbols
symbols(grid, *, dtype=float64, device=None)
Transfer function of each of the C components.
Complex tensors of the precision of dtype that broadcast to the
half spectrum (*N[:-1], N[-1] // 2 + 1).
gram
gram(grid, *, dtype=float64, device=None)
∑_c |symbol_c|², the transfer function of AᵀA (real).
Identity
Identity(ndim)
Bases: _CirculantBase
The identity on images of d dims, as a one-component operator.
Set the number of image dims.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ndim
|
int
|
Number d of trailing image dims. |
required |
norm2
property
norm2
‖I‖² = 1.
forward
forward(x)
x, (..., *N) → (..., 1, *N) (a new tensor).
adjoint
adjoint(y)
y, (..., 1, *N) → (..., *N).
symbols
symbols(grid, *, dtype=float64, device=None)
A single transfer function equal to 1.
Convolution
Convolution(transfer, grid)
Bases: _CirculantBase
Periodic convolution on a grid N, given by its transfer function.
Wraps a transfer function on the half spectrum of torch.fft.rfftn
(for example the otf of
PaddedConvolution) as a
one-component Circulant operator.
Set the transfer function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
transfer
|
Tensor
|
Transfer function Â, broadcastable to the half spectrum
|
required |
grid
|
sequence of int
|
Periodic grid N. |
required |
norm2
property
norm2
‖A‖² = max |Â|².
forward
forward(x)
A x, (..., *N) → (..., 1, *N).
adjoint
adjoint(y)
Aᵀ y, (..., 1, *N) → (..., *N).
symbols
symbols(grid, *, dtype=float64, device=None)
The transfer function, cast to the complex dtype of dtype.
as_circulant
as_circulant(operator, grid)
The Circulant operator meant by operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operator
|
(None, Tensor or Circulant)
|
None: the |
required |
grid
|
sequence of int
|
Periodic grid N. |
required |
Returns:
| Type | Description |
|---|---|
Circulant
|
|
Difference operators
Building blocks of convex optimisation: proximity operators, functions, finite-difference operators and solvers.
Semi-public: these may change without notice. They are shared by the
regularised estimators (for example
Ikoma).
- Proximity operators:
prox_box,prox_group_l2,project_group_l2,project_l2_ball,prox_schatten(withschatten_norm),project_schatten,prox_squared_l2,prox_shifted_poisson,prox_conjugate; the iterativeprox_hessian_schatten(withHessianSchattenResult). - Functions pairing a value and a prox:
Box,GroupL2,L2Ball,Schatten,HessianSchatten,SquaredL2,ShiftedPoisson; smooth functions (value, gradient, Lipschitz constant): the protocolSmoothandPoissonGaussian. - Linear operators: the protocols
LinearOperator(forward, adjoint, norm2) andCirculant(adds the Fourier symbols);Identity,Convolution(a transfer function), the finite differencesdiff,diff_adjoint,GradientandHessian;as_circulant. - Solvers:
admm_fft;primal_dual(withprimal_dual_step);chambolle_pock.
Gradient
Gradient(ndim, *, weights=None, boundary='periodic')
Bases: _Differences
Discrete gradient by forward differences, ∇x = (w₁D₁x, …, w_dD_dx).
The C = d components are stacked along dim -(d + 1), so an image
(..., *N) maps to (..., d, *N). ∑ⱼ ‖(∇x)ⱼ‖₂ is the isotropic
total variation.
Configure the operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ndim
|
int
|
Number d of trailing dims differentiated. |
required |
weights
|
sequence of float
|
Weight wₐ ≥ 0 of each axis (Dₐ is replaced by wₐDₐ). Default: 1. |
None
|
boundary
|
(periodic, neumann)
|
See |
"periodic"
|
norm2
property
norm2
Upper bound on ‖∇‖²: 4∑ₐwₐ² (attained for periodic, even N).
forward
forward(x)
∇x, (..., *N) → (..., d, *N).
The differences are written into the output, with no other image-sized temporary (Neumann boundary).
adjoint
adjoint(y)
∇ᵀy, (..., d, *N) → (..., *N), accumulated in place.
symbols
symbols(grid, *, dtype=float64, device=None)
Transfer function of each component, wₐ(e^{2πiξₐ} − 1).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid
|
sequence of int
|
Periodic grid N. |
required |
dtype
|
optional
|
Real dtype (the result is complex of the same precision) and device. |
float64
|
device
|
optional
|
Real dtype (the result is complex of the same precision) and device. |
float64
|
Returns:
| Type | Description |
|---|---|
list of Tensor
|
d complex tensors that broadcast to the half spectrum of
|
Hessian
Hessian(ndim, *, weights=None, boundary='periodic', stencil='forward')
Bases: _Differences
Discrete Hessian by forward differences, packed as a vector.
The second differences are forward stencils, D_aa xᵢ = xᵢ₊₂ − 2xᵢ₊₁ +
xᵢ and D_ab xᵢ = xᵢ₊ₐ₊ᵦ − xᵢ₊ₐ − xᵢ₊ᵦ + xᵢ (i + a: one step along
axis a), as in Ikoma et al. (2018, Eq. S5). In 2-D and away from the
border this is also the stencil of Lefkimmiatis, Bourquard & Unser
(2012, Eq. 21) and of Lefkimmiatis, Ward & Unser (2013, Eq. 10),
used by Lefkimmiatis & Unser (2013): f_xx[i, j] = f[i, j] −
2f[i+1, j] + f[i+2, j] and f_xy[i, j] = f[i, j] − f[i+1, j] −
f[i, j+1] + f[i+1, j+1]. Eq. 10 as a whole, its border rows
included, is boundary="mirror" (below); the default "periodic"
differs from it at the last two indices of every axis. The boundary
sets the samples past the last index:
"periodic": wrap-around; D_ab = D_a D_b with periodic forward differences, diagonal in Fourier (the HSPIRAL2 solve)."neumann": D_ab = D_a D_b with forward differences that are 0 at the last index (diff)."mirror": the image is extended by half-sample symmetry, x_{N+k} = x_{N+1−k} (1-based), before the stencils are applied. This is Eq. (10) of Lefkimmiatis, Ward & Unser (2013), their "Neumann boundary conditions": D_aa x = x_{N−1} − x_N at the last two indices, D_ab x = 0 at the last index of a or b. The mixed terms are those of"neumann"; the diagonal ones differ at the last index (0 with"neumann").
The components are packed as in Ikoma et al. (Eq. S7): the d
diagonal terms D_aa, then the off-diagonal terms √2·D_ab for a < b,
C = d(d + 1)/2 in all, stacked along dim -(d + 1). Then ‖(Hx)ⱼ‖₂
is the Frobenius norm of the d × d Hessian matrix at voxel j, and
the adjoint is that of Lefkimmiatis, Ward & Unser (Eq. 14),
HY = ∑ₐ D_aaY⁽ᵃᵃ⁾ + ∑_{a<b} D_ab*(Y⁽ᵃᵇ⁾ + Y⁽ᵇᵃ⁾). With axis weights
wₐ, Dₐ is replaced by wₐDₐ.
Configure the operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ndim
|
int
|
Number d of trailing dims differentiated. |
required |
weights
|
sequence of float
|
Weight wₐ ≥ 0 of each axis. Default: 1. |
None
|
boundary
|
(periodic, neumann, mirror)
|
See above. Fourier symbols need |
"periodic"
|
stencil
|
forward
|
Second-difference stencil. |
"forward"
|
norm2
property
norm2
Upper bound on ‖H‖²: (4∑ₐwₐ²)².
From ‖D_ab‖ ≤ 4wₐw_b and ‖H*H‖ ≤ ∑ₐ‖D_aa‖² + 2∑_{a<b}‖D_ab‖² (Lefkimmiatis, Ward & Unser 2013, Eq. 70: 64 in 2-D).
forward
forward(x)
H x, (..., *N) → (..., C, *N).
adjoint
adjoint(y)
Hᵀ y, (..., C, *N) → (..., *N).
symbols
symbols(grid, *, dtype=float64, device=None)
Transfer function of each component (broadcastable).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid
|
sequence of int
|
Periodic grid N. |
required |
dtype
|
optional
|
Real dtype (the result is complex of the same precision) and device. |
float64
|
device
|
optional
|
Real dtype (the result is complex of the same precision) and device. |
float64
|
Returns:
| Type | Description |
|---|---|
list of Tensor
|
C complex tensors, D̂_aD̂_b (×√2 off the diagonal), that
broadcast to the half spectrum of |
diff
diff(x, dim, *, boundary='periodic')
Forward difference along dim: (D x)ᵢ = xᵢ₊₁ − xᵢ.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Image. |
required |
dim
|
int
|
Dim along which to differentiate. |
required |
boundary
|
(periodic, neumann)
|
|
"periodic"
|
Returns:
| Type | Description |
|---|---|
Tensor
|
D x, shaped like |
diff_adjoint
diff_adjoint(y, dim, *, boundary='periodic')
Adjoint of diff: (Dᵀ y)ᵢ = yᵢ₋₁ − yᵢ.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
Tensor
|
Differences. |
required |
dim
|
int
|
Dim of the difference. |
required |
boundary
|
(periodic, neumann)
|
As in |
"periodic"
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Dᵀ y, shaped like |
rfft_frequencies
rfft_frequencies(grid, *, dtype=float64, device=None)
Frequencies ξₐ = kₐ/Nₐ of torch.fft.rfftn on a grid, per axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid
|
sequence of int
|
Grid shape N. |
required |
dtype
|
optional
|
Backend of the result. |
float64
|
device
|
optional
|
Backend of the result. |
float64
|
Returns:
| Type | Description |
|---|---|
list of Tensor
|
One tensor per axis, shaped to broadcast against the half
spectrum |
Solver
Building blocks of convex optimisation: proximity operators, functions, finite-difference operators and solvers.
Semi-public: these may change without notice. They are shared by the
regularised estimators (for example
Ikoma).
- Proximity operators:
prox_box,prox_group_l2,project_group_l2,project_l2_ball,prox_schatten(withschatten_norm),project_schatten,prox_squared_l2,prox_shifted_poisson,prox_conjugate; the iterativeprox_hessian_schatten(withHessianSchattenResult). - Functions pairing a value and a prox:
Box,GroupL2,L2Ball,Schatten,HessianSchatten,SquaredL2,ShiftedPoisson; smooth functions (value, gradient, Lipschitz constant): the protocolSmoothandPoissonGaussian. - Linear operators: the protocols
LinearOperator(forward, adjoint, norm2) andCirculant(adds the Fourier symbols);Identity,Convolution(a transfer function), the finite differencesdiff,diff_adjoint,GradientandHessian;as_circulant. - Solvers:
admm_fft;primal_dual(withprimal_dual_step);chambolle_pock.
Term
Bases: NamedTuple
One term f(A x) of an admm_fft objective.
Attributes:
| Name | Type | Description |
|---|---|---|
operator |
(Circulant, Tensor or None)
|
The operator A, a |
function |
Function
|
f, applied to the split variable z = A x of shape |
region |
tuple of slice, optional
|
Restricts f to |
AdmmResult
Bases: NamedTuple
Result of admm_fft.
Attributes:
| Name | Type | Description |
|---|---|---|
x |
Tensor
|
Last iterate, |
splits |
list of Tensor
|
Split variables zₖ, |
duals |
list of Tensor
|
Scaled dual variables uₖ, |
n_iter |
int
|
Number of iterations. |
change |
float
|
Last relative change ‖xᵏ⁺¹ − xᵏ‖₂ / ‖xᵏ‖₂ (inf if not measured). |
primal_residual |
float
|
Last primal residual ‖r‖₂ = (∑ₖ ‖Aₖ x − zₖ‖²)^½ (Boyd et al. 2011, §3.3). |
dual_residual |
float
|
Last dual residual ‖s‖₂ (Boyd et al. 2011, §3.3): ρ‖∑ₖ Aₖᵀ(zₖ −
zₖ_prev)‖ = ρ‖∑ₖ Aₖᵀ uₖ‖ for |
PrimalDualResult
Bases: NamedTuple
Result of primal_dual.
Attributes:
| Name | Type | Description |
|---|---|---|
x |
Tensor
|
The primal estimate p₁ of the last iteration, |
duals |
list of Tensor
|
Dual variables v_r, |
n_iter |
int
|
Number of iterations. |
change |
float
|
Last relative change ‖xₖ₊₁ − xₖ‖₂ / ‖xₖ‖₂ (inf if not measured). |
residual |
float
|
Last (‖xₖ − p₁,ₖ‖₂² + ∑_r ‖v_r,ₖ − p₂,r,ₖ‖₂²)^½ / γ, the norm of the full forward–backward–forward residual (primal and dual parts). It does not depend on the step, and tends to 0 at a solution: a γ-free diagnostic of convergence. |
admm_fft
admm_fft(terms, grid, *, rho, x0=None, order='x-first', max_iter=150, tol=0.001, dtype=None, device=None, trace=None, callback=None)
Minimise ∑ₖ fₖ(Aₖ x) by ADMM, with every Aₖ circulant on a grid.
Each term is split, zₖ = Aₖ x, and the scaled augmented Lagrangian
∑ₖ fₖ(zₖ) + (ρ/2) ‖Aₖ x − zₖ + uₖ‖²
is minimised alternately over x and the zₖ, with the dual update uₖ ← uₖ + Aₖ x − zₖ (Boyd et al. 2011, §3.1.1). The x-update is the least-squares solve
x = (∑ₖ AₖᵀAₖ)⁻¹ ∑ₖ Aₖᵀ(zₖ − uₖ),
exact in the Fourier domain because every Aₖ is diagonalised by the DFT (Ikoma et al. 2018, Eq. S16; Lefkimmiatis & Unser 2013, Eq. 42); ∑ₖ |Âₖ|² must be positive at every frequency (an identity term ensures it). The zₖ-update is zₖ = prox_{fₖ/ρ}(Aₖ x + uₖ) on the term's region and zₖ = Aₖ x + uₖ outside it.
order="x-first": x, then z, then u, from z = u = 0 (Ikoma et al. 2018, Eqs. S9–S15).order="z-first": z from (x, u), then x, then u, from x =x0and u = 0 (Lefkimmiatis & Unser 2013, Eqs. 18a–c).
Iterations stop when ‖xᵏ⁺¹ − xᵏ‖₂ ≤ tol·‖xᵏ‖₂ (tested once
‖xᵏ‖₂ > 0) or after max_iter iterations. The norms of x are
computed in float64.
A small change is not convergence
The relative-change test is the stopping rule of Ikoma et al.
(2018) and Lefkimmiatis & Unser (2013). ADMM can move slowly
while still far from the minimiser, so a stop by this test does
not certify convergence. The primal and dual residuals of the
last iterate (Boyd et al. 2011, §3.3) are returned in
AdmmResult; both tend to 0 at a
solution.
References
- Boyd S, Parikh N, Chu E, Peleato B, Eckstein J. Distributed optimization and statistical learning via the alternating direction method of multipliers. Found Trends Mach Learn 3(1):1-122, 2011. doi:10.1561/2200000016
- Ikoma H, Broxton M, Kudo T, Wetzstein G. A convex 3D deconvolution algorithm for low photon count fluorescence imaging. Sci Rep 8:11489, 2018. doi:10.1038/s41598-018-29768-x
- Lefkimmiatis S, Unser M. Poisson image reconstruction with Hessian Schatten-norm regularization. IEEE Trans Image Process 22(11):4314-4327, 2013. doi:10.1109/TIP.2013.2271852
BibTeX
@article{boyd2011distributed,
author = {Boyd, Stephen and Parikh, Neal and Chu, Eric and
Peleato, Borja and Eckstein, Jonathan},
title = {Distributed Optimization and Statistical
Learning via the Alternating Direction Method of
Multipliers},
journal = {Foundations and Trends in Machine Learning},
volume = {3},
number = {1},
pages = {1--122},
year = {2011},
doi = {10.1561/2200000016}
}
@article{ikoma2018convex,
author = {Ikoma, Hayato and Broxton, Michael and Kudo,
Takamasa and Wetzstein, Gordon},
title = {A convex {3D} deconvolution algorithm for low
photon count fluorescence imaging},
journal = {Scientific Reports},
volume = {8},
pages = {11489},
year = {2018},
doi = {10.1038/s41598-018-29768-x}
}
@article{lefkimmiatis2013poisson,
author = {Lefkimmiatis, Stamatios and Unser, Michael},
title = {Poisson Image Reconstruction With {Hessian}
{Schatten}-Norm Regularization},
journal = {IEEE Transactions on Image Processing},
volume = {22},
number = {11},
pages = {4314--4327},
year = {2013},
doi = {10.1109/TIP.2013.2271852}
}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
terms
|
sequence of Term
|
The terms fₖ(Aₖ x). |
required |
grid
|
sequence of int
|
Periodic grid N of x. |
required |
rho
|
float
|
Penalty parameter ρ > 0. |
required |
x0
|
Tensor
|
Starting x, |
None
|
order
|
(x - first, z - first)
|
Update order (see above). |
"x-first"
|
max_iter
|
int
|
Maximum number of iterations. |
150
|
tol
|
float
|
Relative-change tolerance; None runs |
0.001
|
dtype
|
optional
|
Backend. Default: those of |
None
|
device
|
optional
|
Backend. Default: those of |
None
|
trace
|
dict
|
Filled during the run (a callback can read it) with
per-iteration lists: |
None
|
callback
|
callable
|
|
None
|
Returns:
| Type | Description |
|---|---|
AdmmResult
|
|
primal_dual
primal_dual(grad, terms, x0, *, step, constraint=None, duals=None, max_iter=5000, tol=1e-05, value=None, trace=None, callback=None)
Minimise h(x) + ψ₀(x) + ∑_r ψ_r(V_r x) by primal–dual splitting.
h is convex and differentiable with a μ-Lipschitz gradient; ψ₀ and the ψ_r are convex with easy proximity operators; the V_r are linear. The iteration is Algorithm 1 of Chouzenoux et al. (2015), an instance of the forward–backward–forward primal–dual method of Combettes & Pesquet (2012), without the error terms cₖ, eₖ:
y₁ = xₖ − γ(∇h(xₖ) + ∑_r V_rᵀ v_r)
p₁ = prox_{γψ₀}(y₁)
for each r:
y₂ = v_r + γ V_r xₖ
p₂ = y₂ − γ prox_{ψ_r/γ}(y₂/γ)
q₂ = p₂ + γ V_r p₁
v_r ← v_r − y₂ + q₂
q₁ = p₁ − γ(∇h(p₁) + ∑_r V_rᵀ p₂)
xₖ₊₁ = xₖ − y₁ + q₁
p₂ is the prox of γψ_r* (Moreau's identity; for ψ_r = λ‖·‖₂,₁ it is
the projection of y₂ onto the ℓ₂ balls of radius λ). It needs no
matrix inversion, and converges for any step γ in the interval of
primal_dual_step (Theorem 3.2).
Iterations stop when ‖xₖ₊₁ − xₖ‖₂ ≤ tol·‖xₖ‖₂ or after max_iter
iterations (the paper stops "when the difference in norm between two
consecutive iterates becomes small"; the normaliser is not
specified). The p₁ of the last iteration is returned: xₖ and p₁,ₖ
have the same limit (Theorem 3.2), and p₁ lies in the domain of ψ₀.
The stopping rule depends on the step
Every term of xₖ₊₁ − xₖ is γ times a residual, so the relative
change accepts a residual of about tol·‖xₖ‖/γ: at a small step
the run can stop far from the minimiser. The recorded
residual, (‖xₖ − p₁‖² + ∑_r ‖v_r − p₂,r‖²)^½/γ, is free of γ;
read it when the minimiser is wanted.
References
- Chouzenoux E, Jezierska A, Pesquet J-C, Talbot H. A convex approach for image restoration with exact Poisson–Gaussian likelihood. SIAM J Imaging Sci 8(4):2662-2682, 2015. doi:10.1137/15M1014395
- Combettes PL, Pesquet J-C. Primal-dual splitting algorithm for solving inclusions with mixtures of composite, Lipschitzian, and parallel-sum type monotone operators. Set-Valued Var Anal 20(2):307-330, 2012. doi:10.1007/s11228-011-0191-y
BibTeX
@article{chouzenoux2015convex,
author = {Chouzenoux, Emilie and Jezierska, Anna and
Pesquet, Jean-Christophe and Talbot, Hugues},
title = {A Convex Approach for Image Restoration with
Exact {Poisson}--{Gaussian} Likelihood},
journal = {SIAM Journal on Imaging Sciences},
volume = {8},
number = {4},
pages = {2662--2682},
year = {2015},
doi = {10.1137/15M1014395}
}
@article{combettes2012primal,
author = {Combettes, Patrick L. and Pesquet, Jean-Christophe},
title = {Primal-Dual Splitting Algorithm for Solving
Inclusions with Mixtures of Composite,
{Lipschitzian}, and Parallel-Sum Type Monotone
Operators},
journal = {Set-Valued and Variational Analysis},
volume = {20},
number = {2},
pages = {307--330},
year = {2012},
doi = {10.1007/s11228-011-0191-y}
}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grad
|
callable
|
∇h, |
required |
terms
|
sequence of (LinearOperator, Function)
|
The pairs (V_r, ψ_r); V_r maps |
required |
x0
|
Tensor
|
Starting point x₀, |
required |
step
|
float
|
γ > 0, for example from
|
required |
constraint
|
Function
|
ψ₀ (for example |
None
|
duals
|
sequence of Tensor
|
Starting dual variables v_{r,0}. Default: zeros. |
None
|
max_iter
|
int
|
Maximum number of iterations. |
5000
|
tol
|
float
|
Relative-change tolerance; None runs |
1e-05
|
value
|
callable
|
h, used for the |
None
|
trace
|
dict
|
Filled with per-iteration lists: |
None
|
callback
|
callable
|
|
None
|
Returns:
| Type | Description |
|---|---|
PrimalDualResult
|
|
primal_dual_step
primal_dual_step(lipschitz, norms2, *, eps=None)
Largest step γ of the primal–dual iteration (Combettes & Pesquet 2012).
With δ = μ + √(∑_r ‖V_r‖²), μ the Lipschitz constant of ∇h, convergence holds for γ ∈ [ε, (1 − ε)/δ] with ε ∈ (0, 1/(δ + 1)) (Chouzenoux et al. 2015, Theorem 3.2 iii). The step returned is γ = (1 − ε)/δ. The default ε = min(10⁻³, ½/(δ + 1)) is not specified in the paper, which takes "the maximum possible value".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lipschitz
|
float
|
μ ≥ 0. |
required |
norms2
|
sequence of float
|
Upper bounds on ‖V_r‖². |
required |
eps
|
float
|
ε ∈ (0, 1/(δ + 1)). |
None
|
Returns:
| Type | Description |
|---|---|
float
|
γ; 0 when μ is infinite. |
chambolle_pock
chambolle_pock(op, dual, primal, x0, *, tau=None, sigma=None, strong_convexity=0.0, y0=None, max_iter=1000, tol=1e-05, gap=None, check_every=1, trace=None, callback=None)
Minimise G(x) + F(Kx) by the primal–dual method of Chambolle & Pock.
F and G are convex with easy proximity operators, K is linear. The iteration is Algorithm 1 of Chambolle & Pock (2011) with θ = 1:
yₖ₊₁ = prox_{σF*}(yₖ + σ K x̄ₖ)
xₖ₊₁ = prox_{τG}(xₖ − τ Kᵀ yₖ₊₁)
x̄ₖ₊₁ = xₖ₊₁ + θ(xₖ₊₁ − xₖ)
with prox_{σF*} from the prox of F by Moreau's identity
(prox_conjugate), or from the
method dual.prox_conjugate(v, σ) when F has one. Theorem 1 states
convergence for τσ‖K‖² < 1, at the rate O(1/N) of the ergodic
average; the steps are accepted up to τσ‖K‖² ≤ 1 (the starting
condition of Algorithm 2). The iterates themselves converge, and the
last one is returned, not the ergodic average. When G is
γ-strongly convex (strong_convexity = γ > 0), the steps follow
Algorithm 2 (θₖ = 1/√(1 + 2γτₖ), τₖ₊₁ = θₖτₖ, σₖ₊₁ = σₖ/θₖ), which
converges at the rate O(1/N²) (Theorem 2).
The default steps are τ = σ = 0.99/‖K‖, with ‖K‖² the bound
op.norm2 (the paper leaves the split between τ and σ open). The
names tau and sigma are those of the paper: sigma is the dual
step, not a noise level.
Iterations stop after max_iter iterations, or when the measure of
convergence is at most tol: gap(x, y) when given (for example a
relative primal–dual gap, Section 5), else the relative change
‖xₖ₊₁ − xₖ‖₂ / ‖xₖ₊₁‖₂ (not specified in the paper). It is
evaluated every check_every iterations, and at the last one.
References
- Chambolle A, Pock T. A first-order primal-dual algorithm for convex problems with applications to imaging. J Math Imaging Vis 40(1):120–145, 2011. doi:10.1007/s10851-010-0251-1
BibTeX
@article{chambolle2011first,
author = {Chambolle, Antonin and Pock, Thomas},
title = {A first-order primal-dual algorithm for convex
problems with applications to imaging},
journal = {Journal of Mathematical Imaging and Vision},
volume = {40}, number = {1}, pages = {120--145},
year = {2011}, doi = {10.1007/s10851-010-0251-1}
}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
op
|
LinearOperator
|
K, mapping |
required |
dual
|
Function
|
F, acting on Kx (only its prox, or its |
required |
primal
|
Function
|
G (only its prox is used). |
required |
x0
|
Tensor
|
Starting point x₀, |
required |
tau
|
float
|
Primal and dual steps τ, σ > 0 with τσ‖K‖² ≤ 1 ( |
None
|
sigma
|
float
|
Primal and dual steps τ, σ > 0 with τσ‖K‖² ≤ 1 ( |
None
|
strong_convexity
|
float
|
γ ≥ 0, the modulus of strong convexity of G (0: Algorithm 1). |
0.0
|
y0
|
Tensor
|
Starting dual variable. Default: zeros. |
None
|
max_iter
|
int
|
Maximum number of iterations. |
1000
|
tol
|
float
|
Tolerance on the measure of convergence; None runs |
1e-05
|
gap
|
callable
|
|
None
|
check_every
|
int
|
Iterations between two evaluations of |
1
|
trace
|
dict
|
Filled with the per-iteration list |
None
|
callback
|
callable
|
|
None
|
Returns:
| Type | Description |
|---|---|
PrimalDualResult
|
|