Functions and operators#

group grp_Functions

(Proximable) functions and operators.

Variables

struct alpaqa::prox_fn prox#

Compute the proximal mapping.

\[ \begin{aligned} \mathrm{out} &\leftarrow \prox_{\gamma\, \mathrm{func}} \left( \mathrm{in} \right). \end{aligned} \]

Param func:

The proximable function \( h : \Rn \to \Rn \) to apply the proximal mapping of.

Param in:

[in] Input vector or matrix \( x \), e.g. current iterate.

Param out:

[out] Proximal mapping of \( (\gamma\, h) \) at \( x \). \( \hat x \leftarrow \prox_{\gamma\, h}\left( x \right) \)

Param γ:

[in] Proximal step size \( \gamma \).

Return:

The value of the function evaluated in the output, \( h(\hat x) \).

struct alpaqa::prox_step_fn prox_step#

Compute a generalized forward-backward step.

\[\begin{split} \begin{aligned} \mathrm{out} &\leftarrow \prox_{\gamma\, \mathrm{func}} \left( \mathrm{in} + \gamma_\mathrm{fwd}\, \mathrm{fwd\_step} \right) \\ \mathrm{fb\_step} &\leftarrow \mathrm{out} - \mathrm{in}. \end{aligned} \end{split}\]
This function can be used to implement the TypeErasedProblem::eval_prox_grad_step function:

struct Problem {
    alpaqa::functions::NuclearNorm<config_t> h{λ, rows, cols};
    real_t eval_prox_grad_step(real_t γ, crvec x, crvec grad_ψ, rvec x̂, rvec p) const {
        return alpaqa::prox_step(h, x, grad_ψ, x̂, p, γ, -γ);
    }
};
Note the negative sign for the forward step size.

Param func:

The proximable function \( h : \Rn \to \Rn \) to apply the proximal mapping of.

Param in:

[in] Input vector or matrix \( x \), e.g. current iterate.

Param fwd_step:

[in] Step \( d \) to add to \( x \) before computing the proximal mapping. Scaled by \( \gamma_\text{fwd} \).

Param out:

[out] Proximal mapping of \( (\gamma\, h) \) at \( x + \gamma_\text{fwd}\, d \). \( \hat x \leftarrow \prox_{\gamma\, h}\left( x + \gamma_\text{fwd}\, d \right) \)

Param fb_step:

[out] Forward-backward step \( p \). \( p = \hat x - \hat x \)

Param γ:

[in] Proximal step size \( \gamma \).

Param γ_fwd:

[in] Forward step size \( \gamma_\mathrm{fwd} \).

Return:

The value of the function evaluated in the output, \( h(\hat x) \).

template<Config Conf, class Weight = typename Conf::real_t>
struct L1Norm
#include <alpaqa/functions/l1-norm.hpp>

ℓ₁-norm.

Template Parameters:

Weight – Type of weighting factors. Either scalar or vector.

Public Types

using weight_t = Weight

Public Functions

inline L1Norm(weight_t λ)
inline L1Norm()
L1Norm() = default
inline real_t prox(crmat in, rmat out, real_t γ = 1)

Public Members

weight_t λ

Public Static Attributes

static constexpr bool scalar_weight = std::is_same_v<weight_t, real_t>

Friends

inline friend real_t alpaqa_tag_invoke(tag_t<alpaqa::prox>, L1Norm &self, crmat in, rmat out, real_t γ)
template<Config Conf, class Weight = typename Conf::real_t>
struct L1NormComplex
#include <alpaqa/functions/l1-norm.hpp>

ℓ₁-norm of complex numbers.

Template Parameters:

Weight – Type of weighting factors. Either scalar or vector.

Public Types

using weight_t = Weight

Public Functions

inline L1NormComplex(weight_t λ)
inline L1NormComplex()
L1NormComplex() = default
inline real_t prox(crcmat in, rcmat out, real_t γ = 1)
inline real_t prox(crmat in, rmat out, real_t γ = 1)

Note: a complex vector in ℂⁿ is represented by a real vector in ℝ²ⁿ.

Public Members

weight_t λ

Public Static Attributes

static constexpr bool scalar_weight = std::is_same_v<weight_t, real_t>

Friends

inline friend real_t alpaqa_tag_invoke(tag_t<alpaqa::prox>, L1NormComplex &self, crmat in, rmat out, real_t γ)
template<Config Conf, class SVD = DefaultSVD<Conf>>
struct NuclearNorm
#include <alpaqa/functions/nuclear-norm.hpp>

Nuclear norm (ℓ₁-norm of singular values).

Public Functions

inline NuclearNorm(real_t λ = 1)

Construct without pre-allocation.

inline NuclearNorm(real_t λ, length_t rows, length_t cols)

Construct with pre-allocation.

inline real_t prox(crmat in, rmat out, real_t γ = 1)

Public Members

real_t λ
length_t rows = 0
length_t cols = 0
SVD svd
vec singular_values

Friends

inline friend real_t alpaqa_tag_invoke(tag_t<alpaqa::prox>, NuclearNorm &self, crmat in, rmat out, real_t γ)