Line data Source code
1 : #pragma once 2 : 3 : #include "LineSearchMethod.h" 4 : #include "LeastSquares.h" 5 : 6 : namespace elsa 7 : { 8 : /** 9 : * @brief Steepest Descent Step for Least Squares 10 : * 11 : * SteepestDescentStepLS returns the step size @f$\alpha@f$ that minimizes the objective 12 : * function along the descent direction using the analytical solution: 13 : * 14 : * @f[ 15 : * \alpha = \frac{b^T A d_i - x_i^T A^T A d_i}{d_i^TA^TAd_i} 16 : * @f] 17 : * 18 : * where @f$A: \mathbb{R}^{n \times m} is the system matrix@f$, 19 : * @f$ x_i: \mathbb{R}^n is the current solution guess@f$ 20 : * @f$b: \mathbb{R}^m data to use in the linear residual@f$, and 21 : * @f$ d_i: \mathbb{R}^n is the search direction @f$ 22 : * 23 : * @author 24 : * - Said Alghabra - initial code 25 : * 26 : * @tparam data_t data type for the domain and range of the problem, defaulting to real_t 27 : */ 28 : template <typename data_t = real_t> 29 : class SteepestDescentStepLS : public LineSearchMethod<data_t> 30 : { 31 : public: 32 : SteepestDescentStepLS(const LeastSquares<data_t>& problem); 33 20 : ~SteepestDescentStepLS() override = default; 34 : 35 : /// make copy constructor deletion explicit 36 : SteepestDescentStepLS(const SteepestDescentStepLS<data_t>&) = delete; 37 : 38 : data_t solve(DataContainer<data_t> xi, DataContainer<data_t> di) override; 39 : 40 : /// implement the polymorphic comparison operation 41 : bool isEqual(const LineSearchMethod<data_t>& other) const override; 42 : 43 : private: 44 : // the system matrix 45 : std::unique_ptr<LinearOperator<data_t>> _A{}; 46 : 47 : // the projections vector (sinogram) 48 : DataContainer<data_t> _b{}; 49 : 50 : /// implement the polymorphic clone operation 51 : SteepestDescentStepLS<data_t>* cloneImpl() const override; 52 : }; 53 : } // namespace elsa