Skip to content

Commit 58bf558

Browse files
committed
Better semicorr
1 parent f2c5676 commit 58bf558

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cp-algo/math/poly.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,14 @@ namespace cp_algo::math {
580580

581581
// [x^k] (a semicorr b) = sum_i a{i+k} * b{i}
582582
static poly_t semicorr(poly_t const& a, poly_t const& b) {
583-
return corr(a, b).div_xk(b.deg());
583+
Vector ra = a.a;
584+
Vector rb = b.a;
585+
size_t N = std::bit_ceil(size(ra));
586+
std::ranges::reverse(rb);
587+
ra.resize(N);
588+
rb.resize(N);
589+
fft::cyclic_mul(ra, rb, N);
590+
return poly_t(ra).substr(b.deg(), a.deg() - b.deg() + 1);
584591
}
585592

586593
poly_t invborel() const { // ak *= k!

0 commit comments

Comments
 (0)