-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.cpp
56 lines (53 loc) · 1.32 KB
/
test.cpp
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
//
// Created by rowan on 04/05/2024.
//
// #include "cwt.h"
#include "transforms.h"
#include <cmath>
#include <iostream>
#include <iomanip>
std::vector<float> testY(){
std::vector<float> y(15);
// std::cout << "[ ";
for(int i = 0; i < y.size(); i++){
y[i] = sin(2 * M_PI * i/32);
// std::cout << y[i] << " ";
}
// std::cout << "]" << std::endl;
return y;
}
std::vector<float> testX(){
std::vector<float> y(15);
// std::cout << "[ ";
for(int i = 0; i < y.size(); i++){
y[i] = 2 * sin(2 * M_PI * i/64 - 1);
// std::cout << y[i] << " ";
}
// std::cout << "]" << std::endl;
return y;
}
int main(){
std::vector<float> y = testY();
std::vector<float> scales(30);
for(int i = 2; i <= 31; i++){
scales[i-2] = i/2.;
}
std::vector<float> y2 = testX();
Scales scale(1, 16, 30);
Ricker ricker;
std::vector<float> res(30 * 15);
cwt(y, &scale, &ricker, &res[0], 5, 1);
// auto res = CWT.transform(1000);
std::cout << std::fixed;
std::cout << std::setprecision(3);
std::cout << "[ ";
for(int i = 0; i < 30 * 15; i++){
std::cout << res[i] << " ";
if(i % 15 == 14) {
std::cout << "]" << std::endl;
if(i != 30 * 15 - 1)
std::cout << "[ ";
}
}
return 0;
}