29 std::pair<double, double>
35 Assert(x.size() == y.size(),
36 ExcMessage(
"x and y are expected to have the same size"));
40 "at least two points are required for linear regression fit"));
42 double sum_1 = 0.0, sum_x = 0.0, sum_x2 = 0.0, sum_y = 0.0, sum_xy = 0.0;
44 for (
unsigned int i = 0; i < x.size(); i++)
48 sum_x2 += x[i] * x[i];
50 sum_xy += x[i] * y[i];
62 invK.
vmult(X, B,
false);
64 return std::make_pair(X(1), X(0));
void vmult(Vector< number2 > &w, const Vector< number2 > &v, const bool adding=false) const
void invert(const FullMatrix< number2 > &M)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcMessage(std::string arg1)
std::pair< double, double > linear_regression(const std::vector< double > &x, const std::vector< double > &y)