SourceXtractorPlusPlus  0.12
Please provide a description of the project.
ResidualEstimator.icpp
Go to the documentation of this file.
1 /** Copyright © 2019 Université de Genève, LMU Munich - Faculty of Physics, IAP-CNRS/Sorbonne Université
2  *
3  * This library is free software; you can redistribute it and/or modify it under
4  * the terms of the GNU Lesser General Public License as published by the Free
5  * Software Foundation; either version 3.0 of the License, or (at your option)
6  * any later version.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  */
17 /**
18  * @file ResidualEstimator.icpp
19  * @date August 18, 2015
20  * @author Nikolaos Apostolakos
21  */
22 
23 namespace ModelFitting {
24 
25 template <typename DoubleIter>
26 void ResidualEstimator::populateResiduals(DoubleIter output_iter) const {
27  // In the general case we use an intermediate vector
28  std::vector<double> residuals (m_residual_no, 0.);
29  auto residuals_ptr = residuals.data();
30  for (auto& block_prov_ptr : m_block_provider_list) {
31  block_prov_ptr->populateResidualBlock(residuals_ptr);
32  residuals_ptr += block_prov_ptr->numberOfResiduals();
33  }
34  std::copy(residuals.begin(), residuals.end(), output_iter);
35 }
36 
37 } // end of namespace ModelFitting