File: Fitter.cpp

package info (click to toggle)
ausaxs 1.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 72,592 kB
  • sloc: cpp: 49,853; ansic: 6,901; python: 730; makefile: 18
file content (17 lines) | stat: -rw-r--r-- 458 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// SPDX-License-Identifier: LGPL-3.0-or-later
// Author: Kristian Lytje

#include <fitter/Fitter.h>

#include <numeric>

using namespace ausaxs;

double fitter::Fitter::chi2(const std::vector<double>& params) {
    auto residuals = get_residuals(params);
    return std::accumulate(residuals.begin(), residuals.end(), 0.0, [] (double sum, double val) {return sum + val*val;});
}

double fitter::Fitter::fit_chi2_only() {
    return chi2(fit_params_only());
}