56template <
typename Coeff,
typename DerivativeMatrix,
63 tv_admm<Coeff, DerivativeMatrix, Data>, Data> {
98 void compute(
const Coeff& coeff,
const DerivativeMatrix& derivative_matrix,
111 "Coefficient matrix and data vector must have the same number of "
115 "The number of columns in the coefficient matrix must match the "
116 "number of rows in solution vector.");
119 "Data and solution must have the same number of columns.");
122 "The number of columns in the derivative matrix must match the "
123 "number of rows in solution vector.");
129 residual_ = (*coeff_) * solution - (*data_);
130 update_rate_ = std::numeric_limits<scalar_type>::infinity();
132 const scalar_type conjugate_gradient_tolerance_rate =
141 static_cast<scalar_type>(2) * (*coeff_).transpose() * (*data_) -
148 result =
static_cast<scalar_type>(2) * (*coeff_).transpose() *
151 (*derivative_matrix_).transpose() * (*derivative_matrix_) *
156 (solution.norm() + std::numeric_limits<scalar_type>::epsilon());
157 residual_ = (*coeff_) * solution - (*data_);
168 (
derivative_.norm() + std::numeric_limits<scalar_type>::epsilon());
176 std::numeric_limits<scalar_type>::epsilon());
183 const data_type& solution)
const ->
bool {
193 iteration_logger.template append<index_type>(
195 iteration_logger.template append<scalar_type>(
197 iteration_logger.template append<scalar_type>(
204 return ((*
coeff_) * solution - (*
data_)).squaredNorm();
218 data = (*coeff_) * solution;
234 this->
logger(),
"approx_order_of_param={}", approx_order_of_param);
235 constexpr auto tol_update_coeff_multiplier =
237 return {approx_order_of_param *
288 "Maximum number of iterations must be a positive integer.");
310 "Tolerance of update rate of the solution must be a positive "
Definition of apply_shrinkage_operator function.
Definition of max_eigen_aat function.
Class to perform conjugate gradient (CG) method golub2013 for linear operators.
Class to write logs of iterations.
Class of tags of logs without memory management.
void configure_child_algorithm_logger_if_exists(Child &child)
Configure a logger of a child algorithm if exists.
auto logger() const noexcept -> const num_collect::logging::logger &
Access to the logger.
iterative_regularized_solver_base(logging::log_tag_view tag)
typename Eigen::NumTraits< typename data_type::Scalar >::Real scalar_type
Type of scalars.
Data data_type
Type of data.
scalar_type tol_update_rate_
Tolerance of update rate of the solution.
auto param_search_region() const -> std::pair< scalar_type, scalar_type >
Get the default region to search for the optimal regularization parameter.
index_type iterations_
Number of iterations.
void iterate(const scalar_type ¶m, data_type &solution)
Iterate the algorithm once.
const data_type * data_
Data vector.
static constexpr index_type default_max_iterations
Default maximum number of iterations.
static constexpr auto default_derivative_constraint_coeff
Default coefficient of the constraint for the derivative.
data_type derivative_
Derivative.
scalar_type update_rate_
Rate of norm of the update of the solution in the last iteration.
auto update_rate() const noexcept -> scalar_type
Get the rate of the norm of the update of the solution in the last iteration.
const coeff_type * coeff_
Coefficient matrix to compute data vector.
data_type previous_derivative_
Previous derivative.
auto residual_norm_rate() const -> scalar_type
Get the rate of the last residual norm.
auto residual_norm(const data_type &solution) const -> scalar_type
Calculate the squared norm of the residual.
data_type lagrange_multiplier_
Lagrange multiplier.
const derivative_matrix_type * derivative_matrix_
Matrix to compute derivative.
iterative_regularized_solver_base< this_type, Data > base_type
Type of the base class.
auto data_size() const -> index_type
Get the size of data.
tv_admm< Coeff, DerivativeMatrix, Data > this_type
This type.
data_type previous_solution_
Previous solution.
auto max_iterations() const -> index_type
Get the maximum number of iterations.
data_type residual_
Residual vector.
Coeff coeff_type
Type of coefficient matrices.
void calculate_data_for(const data_type &solution, data_type &data) const
Calculate data for a solution.
static constexpr auto default_tol_update_rate
Default tolerance of update rate of the solution.
auto tol_update_rate(scalar_type value) -> tv_admm &
Set the tolerance of update rate of the solution.
static constexpr auto default_rate_of_cg_tol_rate_to_tol_update_rate
Default value of the ratio of the rate of tolerance in CG method to the tolerance of update rate of t...
auto iterations() const noexcept -> index_type
Get the number of iterations.
auto tol_update_rate() const -> scalar_type
Get the tolerance of update rate of the solution.
auto max_iterations(index_type value) -> tv_admm &
Set the maximum number of iterations.
void configure_iteration_logger(logging::iterations::iteration_logger< this_type > &iteration_logger) const
Configure an iteration logger.
data_type lagrange_multiplier_update_
Update of lagrange multiplier.
linear::impl::operator_conjugate_gradient< data_type > conjugate_gradient_
Conjugate gradient solver.
DerivativeMatrix derivative_matrix_type
Type of matrices to compute derivatives.
data_type temp_solution_
Temporary vector for the update of the solution.
void compute(const Coeff &coeff, const DerivativeMatrix &derivative_matrix, const Data &data)
Compute internal parameters.
scalar_type rate_of_cg_tol_rate_to_tol_update_rate_
Rate of the ratio of the rate of tolerance in CG method to the tolerance of update rate of the soluti...
void init(const scalar_type ¶m, data_type &solution)
Initialize.
auto is_stop_criteria_satisfied(const data_type &solution) const -> bool
Determine if stopping criteria of the algorithm are satisfied.
scalar_type derivative_constraint_coeff_
Coefficient of the constraint for the derivative.
index_type max_iterations_
Maximum number of iterations.
auto regularization_term(const data_type &solution) const -> scalar_type
Calculate the regularization term.
void change_data(const data_type &data)
Change data.
Concept of Eigen's dense matrices.
Concept of Eigen's dense vectors.
Concept of sparse matrices.
Definition of dense_matrix concept.
Definition of dense_vector concept.
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.
auto norm(const Matrix &matrix)
Calculate norm of a matrix.
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 .
void apply_shrinkage_operator(Vector &target, typename Vector::Scalar threshold)
Apply shrinkage operator to a vector.
constexpr auto weak_coeff_max_param
Coefficient (maximum parameter to be searched) / (maximum singular value or eigen value).
Namespace of regularization algorithms.
constexpr auto tv_admm_tag
Tag of tv_admm.
Definition of operator_conjugate_gradient class.
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 sparse_matrix concept.
Definition of coefficients for regularization parameters.