/** * \file Parabolic \brief * * Copyright 2007-2013 IMP Inventors. All rights reserved. * */ #include "IMP/algebra/ParabolicFit.h" IMPALGEBRA_BEGIN_NAMESPACE ParabolicFit2D::ParabolicFit2D(const algebra::Vector2Ds& data) { // check that there are at least 3 points IMP_USAGE_CHECK(data.size() > 2, "At least 3 points are required for ParabolicFit2D " << data.size() << " given"); find_regression(data); evaluate_error(data); } void ParabolicFit2D::find_regression(const algebra::Vector2Ds& data) { // http://mathforum.org/library/drmath/view/72047.html double S00(0.0), S10(0.0), S20(0.0), S30(0.0), S40(0.0); double S01(0.0), S11(0.0), S21(0.0); S00 = (double)data.size(); for(unsigned int i=0; i