54template <
typename Coeff,
typename Data>
85 void compute(
const Coeff& coeff,
const Data& data) {
100 "Coefficient matrix and data vector must have the same number of "
104 "The number of columns in the coefficient matrix must match the "
105 "number of rows in solution vector.");
108 "Data and solution must have the same number of columns.");
113 update_ = std::numeric_limits<scalar_type>::infinity();
124 * t_before * t_before));
134#pragma omp parallel default(shared)
138#pragma omp for nowait
149#pragma omp for reduction(+ : update_sum2)
154 if (cur_next_sol > trunc_thresh) {
155 cur_next_sol = cur_next_sol - trunc_thresh;
156 }
else if (cur_next_sol < -trunc_thresh) {
157 cur_next_sol = cur_next_sol + trunc_thresh;
162 const scalar_type current_update = cur_next_sol - solution(i);
163 update_sum2 += current_update * current_update;
165 y_(i) = cur_next_sol + coeff_update * current_update;
166 solution(i) = cur_next_sol;
176 const data_type& solution)
const ->
bool {
185 iteration_logger.template append<index_type>(
187 iteration_logger.template append<scalar_type>(
189 iteration_logger.template append<scalar_type>(
196 return ((*
coeff_) * solution - (*
data_)).squaredNorm();
202 return solution.template lpNorm<1>();
210 data = (*coeff_) * solution;
220 (
coeff_->transpose() * (*
data_)).cwiseAbs().maxCoeff();
222 constexpr auto tol_update_coeff_multiplier =
224 return {max_sol_est *
274 "Maximum number of iterations must be a positive integer.");
297 "Tolerance of update rate of the solution must be a positive "
Definition of max_eigen_aat function.
Class to write logs of iterations.
Class of tags of logs without memory management.
auto logger() const noexcept -> const num_collect::logging::logger &
Access to the logger.
Class for fast iterative shrinkage-thresholding algorithm (FISTA) beck2009 for L1-regularization of l...
auto tol_update_rate(scalar_type value) -> fista &
Set the tolerance of update rate of the solution.
auto residual_norm_rate() const -> scalar_type
Get the rate of the last residual norm.
auto tol_update_rate() const -> scalar_type
Get the tolerance of update rate of the solution.
void init(const scalar_type ¶m, data_type &solution)
Initialize.
auto regularization_term(const data_type &solution) const -> scalar_type
Calculate the regularization term.
void configure_iteration_logger(logging::iterations::iteration_logger< this_type > &iteration_logger) const
Configure an iteration logger.
scalar_type t_
Parameter for step size of y_.
void compute(const Coeff &coeff, const Data &data)
Compute internal parameters.
Coeff coeff_type
Type of coefficient matrices.
scalar_type tol_update_rate_
Tolerance of update rate of the solution.
auto iterations() const noexcept -> index_type
Get the number of iterations.
data_type residual_
Residual vector.
auto data_size() const -> index_type
Get the size of data.
scalar_type inv_max_eigen_
Inverse of maximum eigenvalue of for coefficient matrix .
auto update() const noexcept -> scalar_type
Get the norm of the update of the solution in the last iteration.
void iterate(const scalar_type ¶m, data_type &solution)
Iterate the algorithm once.
index_type iterations_
Number of iterations.
const coeff_type * coeff_
Coefficient matrix.
auto max_iterations(index_type value) -> fista &
Set the maximum number of iterations.
index_type max_iterations_
Maximum number of iterations.
auto is_stop_criteria_satisfied(const data_type &solution) const -> bool
Determine if stopping criteria of the algorithm are satisfied.
data_type y_
Another vector to update in FISTA.
void calculate_data_for(const data_type &solution, data_type &data) const
Calculate data for a solution.
auto max_iterations() const -> index_type
Get the maximum number of iterations.
const data_type * data_
Data vector.
auto param_search_region() const -> std::pair< scalar_type, scalar_type >
Get the default region to search for the optimal regularization parameter.
static constexpr index_type default_max_iterations
Default maximum number of iterations.
scalar_type update_
Norm of the update of the solution in the last iteration.
auto residual_norm(const data_type &solution) const -> scalar_type
Calculate the squared norm of the residual.
void change_data(const data_type &data)
Change data.
static constexpr auto default_tol_update_rate
Default tolerance of update rate of the solution.
Base class of solvers using iterative formulas for regularization.
typename Eigen::NumTraits< typename data_type::Scalar >::Real scalar_type
Type of scalars.
Data data_type
Type of data.
Definition of exceptions.
Definition of index_type type.
Definition of iteration_logger class.
Definition of iterative_regularized_solver_base class.
Definition of log_tag_view class.
Definition of macros for logging.
#define NUM_COLLECT_LOG_TRACE(LOGGER,...)
Write a trace log.
std::ptrdiff_t index_type
Type of indices in this library.
constexpr auto weak_coeff_min_param
Coefficient (minimum parameter to be searched) / (maximum singular value or eigen value).
auto approximate_max_eigen_aat(const Matrix &matrix) -> typename Matrix::Scalar
Approximate the maximum eigenvalue of for a matrix .
constexpr auto weak_coeff_max_param
Coefficient (maximum parameter to be searched) / (maximum singular value or eigen value).
Namespace of regularization algorithms.
constexpr auto fista_tag
Tag of fista.
Definition of NUM_COLLECT_PRECONDITION macro.
#define NUM_COLLECT_PRECONDITION(CONDITION,...)
Check whether a precondition is satisfied and throw an exception if not.
Definition of coefficients for regularization parameters.