8 #include <catch2/catch_all.hpp>
22 #include "tools_for_tests/directories.h"
33 extern std::unique_ptr<std::mt19937_64>
mersenne;
34 std::string
const input =
"cameraman256";
38 sopt::t_uint const nmeasure = std::floor(0.5 * image.size());
44 auto const psi = sopt::linear_transform<Scalar>(wavelet, image.rows(), image.cols());
46 Vector const y0 = sampling * Vector::Map(image.data(), image.size());
47 auto constexpr snr = 30.0;
48 auto const sigma = y0.stableNorm() / std::sqrt(y0.size()) * std::pow(10.0, -(snr / 20.0));
49 auto const epsilon = std::sqrt(nmeasure + 2 * std::sqrt(y0.size())) *
sigma;
51 std::normal_distribution<> gaussian_dist(0,
sigma);
62 .regulariser_strength(regulariser_strength)
63 .relative_variation(1e-3)
64 .residual_tolerance(0)
70 auto gp = std::make_shared<sopt::algorithm::L1GProximal<Scalar>>(
false);
71 gp->l1_proximal_tolerance(1e-4)
73 .l1_proximal_itermax(50)
74 .l1_proximal_positivity_constraint(
true)
75 .l1_proximal_real_constraint(
true)
81 auto const diagnostic = fb();
83 CHECK(diagnostic.good);
84 CHECK(diagnostic.niters < 500);
90 Eigen::Map<const Eigen::VectorXd> flat_image(image.data(), image.size());
91 auto mse = (flat_image - diagnostic.x).array().square().sum() / image.size();
An operator that samples a set of measurements.
std::unique_ptr< std::mt19937_64 > mersenne(new std::mt19937_64(0))
Wavelet factory(const std::string &name, t_uint nlevels)
Creates a wavelet transform object.
int t_int
Root of the type hierarchy for signed integers.
double t_real
Root of the type hierarchy for real numbers.
size_t t_uint
Root of the type hierarchy for unsigned integers.
Eigen::Array< T, Eigen::Dynamic, Eigen::Dynamic > Image
A 2-dimensional list of elements of given type.
real_type< T >::type epsilon(sopt::LinearTransform< Vector< T >> const &sampling, sopt::Image< T > const &image)
Eigen::Matrix< T, Eigen::Dynamic, 1 > Vector
A vector of a given type.
real_type< T >::type sigma(sopt::LinearTransform< Vector< T >> const &sampling, sopt::Image< T > const &image)
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > Matrix
A matrix of a given type.
sopt::Vector< Scalar > Vector
sopt::Matrix< Scalar > Matrix
sopt::Image< Scalar > Image