Skip to content

Commit 2dbf3f2

Browse files
committed
Update
1 parent 63235e1 commit 2dbf3f2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

cp-algo/math/fft.hpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace cp_algo::math::fft {
1818
static constexpr size_t flen = vftype::size();
1919

2020
struct cvector {
21-
static constexpr size_t pre_roots = 1 << 19;
21+
static constexpr size_t pre_roots = 1 << 18;
2222
std::vector<vftype> x, y;
2323
cvector(size_t n) {
2424
n = std::max(flen, std::bit_ceil(n));
@@ -57,12 +57,12 @@ namespace cp_algo::math::fft {
5757
}
5858
}
5959
static const cvector roots;
60-
template<class pt = point, bool precalc = false>
61-
static pt root(size_t n, size_t k, auto &&arg) {
60+
template< bool precalc = false, class ft = point>
61+
static auto root(size_t n, size_t k, ft &&arg) {
6262
if(n < pre_roots && !precalc) {
63-
return roots.get<pt>(n + k);
63+
return roots.get<complex<ft>>(n + k);
6464
} else {
65-
return polar<typename pt::value_type>(1., arg);
65+
return complex<ft>::polar(1., arg);
6666
}
6767
}
6868
template<class pt = point, bool precalc = false>
@@ -78,7 +78,7 @@ namespace cp_algo::math::fft {
7878
}
7979
}();
8080
for(size_t i = 0; i < m; i += step, k += (ftype)step) {
81-
callback(i, root<pt, precalc>(n, i, arg * k));
81+
callback(i, root<precalc>(n, i, arg * k));
8282
}
8383
}
8484

@@ -93,7 +93,7 @@ namespace cp_algo::math::fft {
9393
set(k, get<pt>(k) + t);
9494
};
9595
if(i < flen) {
96-
exec_on_roots(i, i, butterfly);
96+
exec_on_roots<point>(i, i, butterfly);
9797
} else {
9898
exec_on_roots<vpoint>(i, i, butterfly);
9999
}
@@ -115,7 +115,7 @@ namespace cp_algo::math::fft {
115115
set(k + i, B * rt);
116116
};
117117
if(i < flen) {
118-
exec_on_roots(i, i, butterfly);
118+
exec_on_roots<point>(i, i, butterfly);
119119
} else {
120120
exec_on_roots<vpoint>(i, i, butterfly);
121121
}

0 commit comments

Comments
 (0)