-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
79 lines (64 loc) · 2.52 KB
/
main.cpp
File metadata and controls
79 lines (64 loc) · 2.52 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
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <chrono>
#include <iostream>
#include "./include/md_complex/md_complex.hpp"
#include "./include/md_static/array_manipulation.hpp"
#include "./include/md_static/fft.hpp"
#include "./include/md_static/functions.hpp"
#include "./include/md_static/functions/md_static_array_utility.hpp"
#include "./include/md_static/linear_algebra.hpp"
#include "./include/md_static/md_static_array/md_static_array.hpp"
#include "./include/md_static/signal.hpp"
int main(i32 argc, const char **argv) {
// MdStaticArray<double>::set_threshold_size(1000);
constexpr usize sz = 1024;
// MdStaticArray<double>::set_thread_count(1);
// Array<f64> c({sz}, 0);
// Array<i64> a({sz, sz}, 0);
// Array<i64> b({sz, sz}, 0);
Array<f64> c({sz, sz}, 0);
Array<f64> d({sz, sz}, 0);
for (usize i = 0; i < sz; ++i) {
// a[i] = Utils::range<i64>(i * sz, i * sz + sz);
// b[i] = Utils::range<i64>(i * sz, i * sz + sz);
c[i] = Utils::range<i64>(i * sz, i * sz + sz);
d[i] = Utils::range<i64>(i * sz, i * sz + sz);
}
// c = Utils::range<f64>(sz);
// d = Utils::range<f64>(sz / 2);
// std::cout << c.get_size() << '\n';
auto start = std::chrono::system_clock::now();
// auto ans = FFT::fft<f64>(c);
// // auto ans = Signal::convolve1d<f64>(c, d);
// auto ans1 = Linalg::mat_multiply<i64>(a, b);
auto ans = Linalg::mat_multiply<f64>(c, d, 12);
// for (auto t : iter) {
// std::cout << t << ' ';
// }
auto end = std::chrono::system_clock::now();
std::chrono::duration<f64> time = end - start;
// std::cout << (Utils::range(10) == 5.5) << '\n';
// std::cout << c << "\n\n";
// std::cout << ans << '\n';
// std::cout << ans1 << '\n';
std::cout << "Time: " << time.count() << "s"
<< " " << std::endl;
// c64 *ss = aligned_allocate<c64>(64, sz);
// for (i32 i = 0; i < sz; ++i) ss[i] = i;
// c64 *dest = aligned_allocate<c64>(64, sz);
// start = std::chrono::system_clock::now();
// dft_subarray_inplace(ss, 0, sz);
// end = std::chrono::system_clock::now();
// time = end - start;
// std::cout << "SIMD Time: " << time.count() << "s"
// << " " << std::endl;
// std::cout << ans << '\n';
// std::cout << '[';
// for (i32 i = 0; i < sz; ++i) {
// std::cout << ss[i];
// if (i < sz - 1) {
// std::cout << ", ";
// }
// }
// std::cout << ']';
return 0;
}