9#ifndef IMPALGEBRA_LINEAR_FIT_H
10#define IMPALGEBRA_LINEAR_FIT_H
14#include <cereal/access.hpp>
17IMPALGEBRA_BEGIN_NAMESPACE
20class IMPALGEBRAEXPORT LinearFit2D :
public GeometricPrimitiveD<2> {
37 double get_a()
const {
return a_; }
40 double get_b()
const {
return b_; }
44 out <<
"y = " << a_ <<
"x + " << b_ << std::endl;
45 out <<
"Error = " << error_ << std::endl;
54 friend class cereal::access;
56 template<
class Archive>
void serialize(Archive &ar) {
68IMPALGEBRA_END_NAMESPACE
Base class for geometric types.
Calculate line that fits best the input data points (Linear least squares).
LinearFit2D(const Vector2Ds &data, const Floats &error_bars=Floats())
Constructor.
double get_fit_error() const
fit error
double get_b() const
get b value (constant)
double get_a() const
get a value (a*x)
IMP::Vector< LinearFit2D > LinearFit2Ds
Vector< VectorD< 2 > > Vector2Ds
IMP::Vector< Float > Floats
Standard way to pass a bunch of Float values.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.