| |
- RunReconstruction(InputData, AllExtremaIndices, strSmoothness, DataWeight, Solver='quadprog')
- This function reconstructs a smooth function approximating the input data,
but only containing the given minima/maxima.
Adherence to the original data is controlled using the DataWeight term.
The reconstructed function can be C1 or C2 smooth.
This is controlled by the smoothness parameter,
which can be set to 'biharmonic' or 'triharmonic' accordingly.
All extrema given to the function are used for reconstruction.
Undesired extrema need to be filtered before using this function.
This can be done using Persistence1D.
This code just gets a list of indices representing the locations of extrema in the data.
One may ask whether this is enough to determine their type and so on,
since the type of the extrema is important for building the inequality constraints
(which values should be larger than others etc.).
The type of an extremum is inferable from a correct list of extrema:
(1) The leftmost and rightmost extrema are always minima.
(2) Minima and maxima alternate in the sequence (ordered from lowest to highest index).
(3) Hence, we have an odd number of extrema.
These statements are true for all 1D functions.
We test for this here, to make sure the right input comes in.
However, make sure you get your extrema indices from Persistence1D and you handle them correctly.
@param[in] InputData
Original data vector.
@param[in] AllExtremaIndices
Indices of (filtered) minima/maxima selected for reconstruction.
@param[in] strSmoothness
Determines smoothness of result. Valid values are 'biharmonic' or 'triharmonic'
@param[in] DataWeight
Weight for data term. Affects how closely the reconstructed results adhere to the data. Valid range: 0.0-1.0
@param[in] Solver
Software for solving the Quadratic Programming problem. Possible values are 'cvxpy', 'ecos', 'quadprog', and others supported by the qpsolvers project: https://github.com/stephane-caron/qpsolvers
@param[out] Solution
Reconstructed data.
The Matlab version of this code uses a different notation. Since it came first,
we provide a translation here (Python code notation on the left side, Matlab on the right):
Energy:
P == operator
q == f
Inequalities:
G == A
h == b
Equalities:
A == Aeq
b == beq
Author: Tino Weinkauf, based on code from Yeara Kozlov and Alec Jacobson
|