Skip to content

Commit 4021d95

Browse files
committed
refactor
1 parent d6de241 commit 4021d95

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

cp-algo/math/fft.hpp

+13-10
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace cp_algo::math::fft {
2828
auto splt = [&](size_t i, auto mul) {
2929
auto ai = i < size(a) ? (a[i] * mul).rem_direct() : 0;
3030
auto rem = ai % split;
31-
auto quo = (ai - rem) / split;
31+
auto quo = ai / split;
3232
return std::pair{(ftype)rem, (ftype)quo};
3333
};
3434
auto [rai, qai] = splt(i, cur);
@@ -44,15 +44,8 @@ namespace cp_algo::math::fft {
4444
}
4545
}
4646

47-
void mul(auto &&C, auto const& D, auto &res, size_t k) {
48-
assert(A.size() == C.size());
49-
size_t n = A.size();
50-
if(!n) {
51-
res = {};
52-
return;
53-
}
54-
55-
cvector::exec_on_evals<1>(n / flen, [&](size_t k, point rt) {
47+
void dot(auto &&C, auto const& D) {
48+
cvector::exec_on_evals<1>(A.size() / flen, [&](size_t k, point rt) {
5649
k *= flen;
5750
auto [Ax, Ay] = A.at(k);
5851
auto [Bx, By] = B.at(k);
@@ -79,6 +72,16 @@ namespace cp_algo::math::fft {
7972
B.at(k) = BD;
8073
});
8174
checkpoint("dot");
75+
}
76+
77+
void mul(auto &&C, auto const& D, auto &res, size_t k) {
78+
assert(A.size() == C.size());
79+
size_t n = A.size();
80+
if(!n) {
81+
res = {};
82+
return;
83+
}
84+
dot(C, D);
8285
A.ifft();
8386
B.ifft();
8487
C.ifft();

0 commit comments

Comments
 (0)