1 #include <catch2/catch_all.hpp>
12 extern std::unique_ptr<std::mt19937_64>
mersenne;
13 std::uniform_int_distribution<sopt::t_int> uniform_dist(min, max);
23 TEST_CASE(
"Proximal ADMM with ||x - x0||_2 functions",
"[padmm][integration]") {
25 t_Vector const target0 = t_Vector::Random(
N);
26 t_Vector const target1 = t_Vector::Random(
N) * 4;
30 t_Matrix const mId = -t_Matrix::Identity(
N,
N);
32 t_Vector const translation = t_Vector::Ones(
N) * 5;
35 auto const result = padmm();
37 t_Vector const segment = (target1 - target0).normalized();
38 t_real const alpha = (result.x - target0).transpose() * segment;
40 CHECK((target1 - target0).transpose() * segment >= alpha);
42 CAPTURE(segment.transpose());
43 CAPTURE((result.x - target0).transpose());
44 CAPTURE((result.x - target1).transpose());
45 CHECK((result.x - target0 - alpha * segment).stableNorm() < 1e-8);
50 :
public std::is_same<sopt::algorithm::ImagingProximalADMM<double> &, T> {};
51 TEST_CASE(
"Check type returned on setting variables") {
74 admm.
is_converged(std::declval<ConvFunc const &>()))>::value);
sopt::Vector< Scalar > t_Vector
sopt::Matrix< Scalar > t_Matrix
ImagingProximalADMM< Scalar > & is_converged(std::function< bool(t_Vector const &x)> const &func)
Convergence function that takes only the output as argument.
t_Vector const & target() const
Vector of target measurements.
ImagingProximalADMM< Scalar > & residual_convergence(Real const &tolerance)
Helper function to set-up default residual convergence function.
ImagingProximalADMM &::type Phi(ARGS &&... args)
t_LinearTransform const & Psi() const
Analysis operator Ψ
Proximal Alternate Direction method of mutltipliers.
ProximalADMM &::type Phi(ARGS &&... args)
Proximal of euclidian norm.
std::unique_ptr< std::mt19937_64 > mersenne(new std::mt19937_64(0))
Translation< FUNCTION, VECTOR > translate(FUNCTION const &func, VECTOR const &translation)
Translates given proximal by given vector.
int t_int
Root of the type hierarchy for signed integers.
double t_real
Root of the type hierarchy for real numbers.
Eigen::Matrix< T, Eigen::Dynamic, 1 > Vector
A vector of a given type.
std::function< bool(Vector< SCALAR > const &)> ConvergenceFunction
Typical function signature for convergence.
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > Matrix
A matrix of a given type.
sopt::t_int random_integer(sopt::t_int min, sopt::t_int max)
TEST_CASE("Proximal ADMM with ||x - x0||_2 functions", "[padmm][integration]")