#ifndef GAUSSPOLYCOE_H #define GAUSSPOLYCOE_H #include class GaussPolyCoe { public: // 高斯消元法求解线性方程组 Ax = b static std::vector GaussianElimination(std::vector> A, std::vector b); // 多项式拟合:返回系数 [a0, a1, ..., an] 表示 y = a0 + a1*x + ... + an*x^n static std::vector PolynomialFit(const std::vector& x, const std::vector& y, int degree); // 计算拟合曲线在x处的值 static double Predict(const std::vector& coeffs, double x); // 计算均方误差 static double MeanSquareError(const std::vector& x, const std::vector& y, const std::vector& coeffs); }; #endif // GAUSSPOLYCOE_H