6 const std::vector<float>&
y,
8 const std::vector<float>& sigx,
9 const std::vector<float>& sigy)
const {
12 std::vector<float> yScaled =
y;
13 std::vector<float> sigyScaled = sigy;
14 std::vector<float> sig(ndat);
15 for (
int i = 0;
i != ndat;
i++) {
18 sig[
i] =
sqrt(sigx[
i] * sigx[
i] + sigyScaled[
i] * sigyScaled[
i]);
23 float fs, fi, covss, covii, covsi;
24 lf.
fit(x, yScaled, ndat, sig, fs, fi, covss, covii, covsi);
32 const std::vector<float>&
y,
34 const std::vector<float>& sigx,
35 const std::vector<float>& sigy)
const {
36 float fs =
slope(x, y, ndat, sigx, sigy);
39 for (
int i = 0;
i != ndat;
i++) {
40 float wi = 1. / (sigy[
i] + fs * fs * sigx[
i]);
41 fi += wi * (y[
i] - fs * x[
i]);
49 double m1 = 0., m2 = 0.;
50 for (
int i = 0;
i != ndat;
i++) {
57 return float(m2 - m1 * m1);
void fit(const std::vector< float > &x, const std::vector< float > &y, int ndat, const std::vector< float > &sigy, float &slope, float &intercept, float &covss, float &covii, float &covsi) const
float slope(const std::vector< float > &x, const std::vector< float > &y, int ndat, const std::vector< float > &sigx, const std::vector< float > &sigy) const
float variance(const std::vector< float > &x, int ndat) const
float intercept(const std::vector< float > &x, const std::vector< float > &y, int ndat, const std::vector< float > &sigx, const std::vector< float > &sigy) const