LCOV - code coverage report
Current view: top level - problems - TikhonovProblem.cpp (source / functions) Hit Total Coverage
Test: test_coverage.info.cleaned Lines: 0 20 0.0 %
Date: 2022-08-04 03:43:28 Functions: 0 16 0.0 %

          Line data    Source code
       1             : #include "TikhonovProblem.h"
       2             : #include "L2NormPow2.h"
       3             : #include "WeightedL2NormPow2.h"
       4             : 
       5             : namespace elsa
       6             : {
       7             :     template <typename data_t>
       8           0 :     TikhonovProblem<data_t>::TikhonovProblem(const LinearOperator<data_t>& A,
       9             :                                              const DataContainer<data_t> b, real_t weight)
      10             :         : Problem<data_t>{
      11           0 :             L2NormPow2<data_t>(A, b),
      12           0 :             RegularizationTerm<data_t>(weight, L2NormPow2<data_t>(A.getDomainDescriptor()))}
      13             :     {
      14           0 :     }
      15             : 
      16             :     template <typename data_t>
      17           0 :     TikhonovProblem<data_t>::TikhonovProblem(
      18             :         const WLSProblem<data_t>& wlsProblem,
      19             :         const std::vector<RegularizationTerm<data_t>>& regTerms)
      20           0 :         : Problem<data_t>{wlsProblem.getDataTerm(), regTerms, wlsProblem.getCurrentSolution()}
      21             :     {
      22             :         // make sure that at least one regularization term exists
      23           0 :         if (regTerms.empty()) {
      24           0 :             throw InvalidArgumentError(
      25             :                 "TikhonovProblem: at least one regularization term has to be supplied");
      26             :         }
      27             : 
      28             :         // make sure that all regularization terms are linear and of type (Weighted)L2NormPow2
      29           0 :         for (const auto& regTerm : regTerms) {
      30           0 :             const auto& func = regTerm.getFunctional();
      31           0 :             if (!is<L2NormPow2<data_t>>(func) && !is<WeightedL2NormPow2<data_t>>(func)) {
      32           0 :                 throw InvalidArgumentError("TikhonovProblem: all regularization terms should be "
      33             :                                            "of type L2NormPow2 or WeightedL2NormPow2");
      34             :             }
      35           0 :             if (!is<LinearResidual<data_t>>(func.getResidual())) {
      36           0 :                 throw InvalidArgumentError(
      37             :                     "TikhonovProblem: all regularization terms should be linear");
      38             :             }
      39             :         }
      40           0 :     }
      41             : 
      42             :     template <typename data_t>
      43           0 :     TikhonovProblem<data_t>::TikhonovProblem(const WLSProblem<data_t>& wlsProblem,
      44             :                                              const RegularizationTerm<data_t>& regTerm)
      45           0 :         : TikhonovProblem{wlsProblem, std::vector<RegularizationTerm<data_t>>{regTerm}}
      46             :     {
      47           0 :     }
      48             : 
      49             :     template <typename data_t>
      50           0 :     TikhonovProblem<data_t>* TikhonovProblem<data_t>::cloneImpl() const
      51             :     {
      52           0 :         return new TikhonovProblem(*this);
      53             :     }
      54             : 
      55             :     // ------------------------------------------
      56             :     // explicit template instantiation
      57             :     template class TikhonovProblem<float>;
      58             :     template class TikhonovProblem<double>;
      59             :     template class TikhonovProblem<complex<float>>;
      60             :     template class TikhonovProblem<complex<double>>;
      61             : 
      62             : } // namespace elsa

Generated by: LCOV version 1.14