-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculation.h
64 lines (43 loc) · 1.52 KB
/
calculation.h
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//
// calculation.hpp
// Project_v1217
//
// Created by Lu on 2021/12/18.
//
#ifndef calculation_hpp
#define calculation_hpp
#include <stdio.h>
#endif /* calculation_hpp */
#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <sstream>
#include <vector>
#include <locale>
#include <iomanip>
#include <fstream>
#include <map>
#include <algorithm>
#include"Vector.h"
using namespace std;
class calculation {
private:
int num_samples;
int num_dates;
int resample_times;
map<string, Vector>ARtable;
//vector<Vector>result;
public:
calculation() :num_samples(80) {};
//calculation(int num_samples_, int num_dates_, int resample_times_, map<string, Vector>ARtable_) :num_samples(num_samples_), num_dates(num_dates_), resample_times(resample_times_), ARtable(ARtable_){}
~calculation() {}
//According to bootstrap samples, find corresponding AR in ARtable
vector<Vector> getAR(int n, vector<vector<string>>vec, int num_samples, map<string, Vector> ARtable);
//compute AAR for all days
Vector getAAR(vector<Vector>vec, int num_dates, int num_samples);
Vector getCAAR(Vector aar, int num_dates);
Vector cal_avg(vector<Vector>pop, int num_dates, int resample_times);
Vector cal_std(vector<Vector>pop, Vector avg, int num_dates, int resample_times);
vector<Vector> calculate_all(vector<vector<string>>vec, int num_samples, int num_dates, int resample_times, map<string, Vector>ARtable);
};