# Cost Functions

The following cost functions are available

`Manopt.costIntrICTV12`

— Method`costIntrICTV12(M, f, u, v, α, β)`

Compute the intrinsic infimal convolution model, where the addition is replaced by a mid point approach and the two functions involved are `costTV2`

and `costTV`

. The model reads

\[E(u,v) = \frac{1}{2}\sum_{i ∈ \mathcal G} d_{\mathcal M}\bigl(g(\frac{1}{2},v_i,w_i),f_i\bigr) +\alpha\bigl( β\mathrm{TV}(v) + (1-β)\mathrm{TV}_2(w) \bigr).\]

`Manopt.costL2TV`

— Method`costL2TV(M, f, α, x)`

compute the $ℓ^2$-TV functional on the `PowerManifold manifold`

M`for given (fixed) data`

f`(on`

M`), a nonnegative weight`

α`, and evaluated at`

x`(on`

M`), i.e.

\[E(x) = d_{\mathcal M}^2(f,x) + \alpha \operatorname{TV}(x)\]

**See also**

`Manopt.costL2TV2`

— Method`costL2TV2(M, f, β, x)`

compute the $ℓ^2$-TV2 functional on the `PowerManifold`

manifold `M`

for given data `f`

, nonnegative parameter `β`

, and evaluated at `x`

, i.e.

\[E(x) = d_{\mathcal M}^2(f,x) + β\operatorname{TV}_2(x)\]

**See also**

`Manopt.costL2TVTV2`

— Method`costL2TVTV2(M, f, α, β, x)`

compute the $ℓ^2$-TV-TV2 functional on the `PowerManifold`

manifold `M`

for given (fixed) data `f`

(on `M`

), nonnegative weight `α`

, `β`

, and evaluated at `x`

(on `M`

), i.e.

\[E(x) = d_{\mathcal M}^2(f,x) + \alpha\operatorname{TV}(x) + β\operatorname{TV}_2(x)\]

**See also**

`Manopt.costTV`

— Function`costTV(M,x [,p=2,q=1])`

Compute the $\operatorname{TV}^p$ functional for data `x`

on the `PowerManifold`

manifold `M`

, i.e. $\mathcal M = \mathcal N^n$, where $n ∈ \mathbb N^k$ denotes the dimensions of the data `x`

. Let $\mathcal I_i$ denote the forward neighbors, i.e. with $\mathcal G$ as all indices from $\mathbf{1} ∈ \mathbb N^k$ to $n$ we have $\mathcal I_i = \{i+e_j, j=1,…,k\}\cap \mathcal G$. The formula reads

\[E^q(x) = \sum_{i ∈ \mathcal G} \bigl( \sum_{j ∈ \mathcal I_i} d^p_{\mathcal M}(x_i,x_j) \bigr)^{q/p}.\]

**See also**

`Manopt.costTV`

— Method`costTV(M, x, p)`

Compute the $\operatorname{TV}^p$ functional for a tuple `pT`

of pointss on a Manifold `M`

, i.e.

\[E(x_1,x_2) = d_{\mathcal M}^p(x_1,x_2), \quad x_1,x_2 ∈ \mathcal M\]

**See also**

`Manopt.costTV2`

— Function`costTV2(M,x [,p=1])`

compute the $\operatorname{TV}_2^p$ functional for data `x`

on the `PowerManifold`

manifoldmanifold `M`

, i.e. $\mathcal M = \mathcal N^n$, where $n ∈ \mathbb N^k$ denotes the dimensions of the data `x`

. Let $\mathcal I_i^{\pm}$ denote the forward and backward neighbors, respectively, i.e. with $\mathcal G$ as all indices from $\mathbf{1} ∈ \mathbb N^k$ to $n$ we have $\mathcal I^\pm_i = \{i\pm e_j, j=1,…,k\}\cap \mathcal I$. The formula then reads

\[E(x) = \sum_{i ∈ \mathcal I,\ j_1 ∈ \mathcal I^+_i,\ j_2 ∈ \mathcal I^-_i} d^p_{\mathcal M}(c_i(x_{j_1},x_{j_2}), x_i),\]

where $c_i(⋅,⋅)$ denotes the mid point between its two arguments that is nearest to $x_i$.

**See also**

`Manopt.costTV2`

— Method`costTV2(M,(x1,x2,x3) [,p=1])`

Compute the $\operatorname{TV}_2^p$ functional for the 3-tuple of points `(x1,x2,x3)`

on the Manifold `M`

. Denote by

\[ \mathcal C = \bigl\{ c ∈ \mathcal M \ |\ g(\tfrac{1}{2};x_1,x_3) \text{ for some geodesic }g\bigr\}\]

the set of mid points between $x_1$ and $x_3$. Then the function reads

\[d_2^p(x_1,x_2,x_3) = \min_{c ∈ \mathcal C} d_{\mathcal M}(c,x_2).\]

**See also**

`Manopt.cost_L2_acceleration_bezier`

— Method`cost_L2_acceleration_bezier(M,B,pts,λ,d)`

compute the value of the discrete Acceleration of the composite Bezier curve together with a data term, i.e.

\[\frac{λ}{2}\sum_{i=0}^{N} d_{\mathcal M}(d_i, c_B(i))^2+ \sum_{i=1}^{N-1}\frac{d^2_2 [ B(t_{i-1}), B(t_{i}), B(t_{i+1})]}{\Delta_t^3}\]

where for this formula the `pts`

along the curve are equispaced and denoted by $t_i$ and $d_2$ refers to the second order absolute difference `costTV2`

(squared), the junction points are denoted by $p_i$, and to each $p_i$ corresponds one data item in the manifold points given in `d`

. For details on the acceleration approximation, see `cost_acceleration_bezier`

. Note that the Beziér-curve is given in reduces form as a point on a `PowerManifold`

, together with the `degrees`

of the segments and assuming a differentiable curve, the segments can internally be reconstructed.

**See also**

`grad_L2_acceleration_bezier`

, `cost_acceleration_bezier`

, `grad_acceleration_bezier`

`Manopt.cost_acceleration_bezier`

— Method```
cost_acceleration_bezier(
M::AbstractManifold,
B::AbstractVector{P},
degrees::AbstractVector{<:Integer},
T::AbstractVector{<:AbstractFloat},
) where {P}
```

compute the value of the discrete Acceleration of the composite Bezier curve

\[\sum_{i=1}^{N-1}\frac{d^2_2 [ B(t_{i-1}), B(t_{i}), B(t_{i+1})]}{\Delta_t^3}\]

where for this formula the `pts`

along the curve are equispaced and denoted by $t_i$, $i=1,…,N$, and $d_2$ refers to the second order absolute difference `costTV2`

(squared). Note that the Beziér-curve is given in reduces form as a point on a `PowerManifold`

, together with the `degrees`

of the segments and assuming a differentiable curve, the segments can internally be reconstructed.

This acceleration discretization was introduced in^{[BergmannGousenbourger2018]}.

**See also**

`grad_acceleration_bezier`

, `cost_L2_acceleration_bezier`

, `grad_L2_acceleration_bezier`

- BergmannGousenbourger2018
Bergmann, R. and Gousenbourger, P.-Y.: A variational model for data fitting on manifolds by minimizing the acceleration of a Bézier curve. Frontiers in Applied Mathematics and Statistics (2018). doi 10.3389/fams.2018.00059, arXiv: 1807.10090