25#include <Eigen/Householder>
51template <base::concepts::dense_matrix Coeff, base::concepts::dense_matrix Data>
66 static_assert(std::is_same_v<
typename coeff_type::Scalar,
67 typename data_type::Scalar>);
68 static_assert(data_type::RowsAtCompileTime == Eigen::Dynamic);
88 "The number of rows in the coefficient matrix must match the "
89 "number of rows in data.");
92 "The number of columns in the coefficient matrix must match the "
93 "number of columns in the coefficient matrix of the regularization "
97 "Coefficient matrix for the regularization term must have rows "
98 "less than columns.");
106 Eigen::ColPivHouseholderQR<coeff_type> qr_reg_adj;
107 qr_reg_adj.compute(reg_coeff.adjoint());
109 this->logger(),
"reg_coeff must have full row rank.");
110 const coeff_type v = qr_reg_adj.householderQ();
112 Eigen::ColPivHouseholderQR<coeff_type> qr_coeff_v2;
113 qr_coeff_v2.compute(coeff * v.rightCols(n - p));
116 "reg_coeff and coeff must not have common elements "
117 "other than zero in their kernel.");
118 const coeff_type q = qr_coeff_v2.householderQ();
121 qr_reg_adj.solve(coeff.adjoint() * q.rightCols(m - n + p))
123 const data_type data_arr = q.rightCols(m - n + p).adjoint() * data;
126 const coeff_type coeff_v2_inv_coeff = qr_coeff_v2.solve(coeff);
127 const coeff_type i_minus_v2_coeff_v2_inv_coeff =
128 coeff_type::Identity(n, n) -
129 v.rightCols(n - p) * coeff_v2_inv_coeff;
131 qr_reg_adj.solve(i_minus_v2_coeff_v2_inv_coeff.adjoint()).adjoint();
133 const data_type coeff_v2_inv_data = qr_coeff_v2.solve(data);
Definition of assertion macros.
Class of tags of logs without memory management.
Base class of solvers using explicit formulas for regularization.
Class to perform generalized Tikhonov regularization on the condition that the matrix in the regulari...
Data offset_actual_solution_
Offset vector to calculate actual solution.
auto second_derivative_of_regularization_term(const scalar_type ¶m) const -> scalar_type
Calculate the send-order derivative of the Regularization term.
full_gen_tikhonov()
Constructor.
auto sum_of_filter_factor(const scalar_type ¶m) const -> scalar_type
Calculate the sum of filter factors.
auto first_derivative_of_residual_norm(const scalar_type ¶m) const -> scalar_type
Calculate the first-order derivative of the squared norm of the residual.
tikhonov< coeff_type, data_type > tikhonov_
Object to perform Tikhonov regularization.
auto regularization_term(const scalar_type ¶m) const -> scalar_type
Calculate the regularization term.
void solve(const scalar_type ¶m, data_type &solution) const
Solve for a regularization parameter.
auto residual_norm(const scalar_type ¶m) const -> scalar_type
Calculate the squared norm of the residual.
void compute(const coeff_type &coeff, const data_type &data, const coeff_type ®_coeff)
Compute internal matrices.
Coeff coeff_type
Type of coefficient matrices.
auto first_derivative_of_regularization_term(const scalar_type ¶m) const -> scalar_type
Calculate the first-order derivative of the Regularization term.
auto data_size() const -> index_type
Get the size of data.
auto second_derivative_of_residual_norm(const scalar_type ¶m) const -> scalar_type
Calculate the second-order derivative of the squared norm of the residual.
auto internal_solver() const -> const tikhonov< coeff_type, data_type > &
Access to the internal solver (for debug).
auto singular_values() const -> const typename Eigen::BDCSVD< coeff_type >::SingularValuesType &
Get the singular values.
auto param_search_region() const -> std::pair< scalar_type, scalar_type >
Get the default region to search for the optimal regularization parameter.
Coeff coeff_actual_solution_
Coefficient matrix to calculate actual solution.
typename Eigen::NumTraits< typename data_type::Scalar >::Real scalar_type
Class to perform Tikhonov regularization.
auto singular_values() const -> const typename Eigen::BDCSVD< coeff_type >::SingularValuesType &
Get the singular values.
auto second_derivative_of_residual_norm(const scalar_type ¶m) const -> scalar_type
Calculate the second-order derivative of the squared norm of the residual.
auto data_size() const -> index_type
Get the size of data.
auto sum_of_filter_factor(const scalar_type ¶m) const -> scalar_type
Calculate the sum of filter factors.
void solve(const scalar_type ¶m, data_type &solution) const
Solve for a regularization parameter.
auto first_derivative_of_residual_norm(const scalar_type ¶m) const -> scalar_type
Calculate the first-order derivative of the squared norm of the residual.
auto param_search_region() const -> std::pair< scalar_type, scalar_type >
Get the default region to search for the optimal regularization parameter.
auto regularization_term(const scalar_type ¶m) const -> scalar_type
Calculate the regularization term.
auto first_derivative_of_regularization_term(const scalar_type ¶m) const -> scalar_type
Calculate the first-order derivative of the Regularization term.
auto residual_norm(const scalar_type ¶m) const -> scalar_type
Calculate the squared norm of the residual.
auto second_derivative_of_regularization_term(const scalar_type ¶m) const -> scalar_type
Calculate the send-order derivative of the Regularization term.
void compute(const coeff_type &coeff, const data_type &data)
Compute internal matrices.
Definition of dense_matrix concept.
Definition of exceptions.
Definition of explicit_regularized_solver_base class.
Definition of index_type type.
Definition of log_tag_view class.
Definition of macros for logging.
Namespace of Eigen library.
std::ptrdiff_t index_type
Type of indices in this library.
Namespace of regularization algorithms.
constexpr auto full_gen_tikhonov_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 tikhonov class.