-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnumlib.h
More file actions
35 lines (32 loc) · 1.02 KB
/
numlib.h
File metadata and controls
35 lines (32 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef NUMLIB_NUMLIB_H
#define NUMLIB_NUMLIB_H
#include <vector>
class dataset
{
private:
std::vector<double> xData;
std::vector<double> yData;
bool isEqual() {return xData.size() == yData.size();}
//Least Square
double calSumA(int power);
double calSumB(int power);
double calSigma(std::vector<double> coef);
std::vector<double> getPolyCoef(int m);
//Gregory Newton
double comb(double s, int k);
double calPloy(std::vector<std::vector<double>> diffTable, double s);
std::vector<std::vector<double>> calDiffTable();
public:
dataset();
dataset(std::vector<double> x, std::vector<double> y);
dataset(dataset &d);
std::vector<double> getXData(){return xData;}
std::vector<double> getYData(){return yData;}
void resetXYData(std::vector<double> xData, std::vector<double> yData);
//Least Square
double leastSquareY(double x);
std::vector<double> leastSquareCoef();
//Gregory Newton
double gregoryNewton(double x);
};
#endif //NUMLIB_NUMLIB_H