Skip to content

Commit af8a82b

Browse files
committed
fix
1 parent c3aaab3 commit af8a82b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

cp-algo/math/poly.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ namespace cp_algo::math {
402402
}
403403
auto A = mulx_sq(z.inv());
404404
auto B = ones(n+deg()).mulx_sq(z);
405-
return semicorr(B, A).mod_xk(n).mulx_sq(z.inv());
405+
return inner_corr(B, A).mulx_sq(z.inv());
406406
}
407407

408408
// res[i] = prod_{1 <= j <= i} 1/(1 - z^j)
@@ -578,8 +578,12 @@ namespace cp_algo::math {
578578
return a * b.reversed();
579579
}
580580

581-
// [x^k] (a semicorr b) = sum_i a{i+k} * b{i}
582-
static poly_t semicorr(poly_t const& a, poly_t const& b) {
581+
// [x^k] (a forward_corr b) = sum_i a{i+k} * b{i}
582+
static poly_t forward_corr(poly_t const& a, poly_t const& b) {
583+
return corr(a, b).div_xk(b.deg());
584+
}
585+
// Dot product of b with all substrings of a
586+
static poly_t inner_corr(poly_t const& a, poly_t const& b) {
583587
Vector ra = a.a;
584588
Vector rb = b.a;
585589
size_t N = std::bit_ceil(size(ra));
@@ -607,7 +611,7 @@ namespace cp_algo::math {
607611
}
608612

609613
poly_t shift(T a) const { // P(x + a)
610-
return semicorr(invborel(), expx(deg() + 1).mulx(a)).borel();
614+
return forward_corr(invborel(), expx(deg() + 1).mulx(a)).borel();
611615
}
612616

613617
poly_t x2() { // P(x) -> P(x^2)

0 commit comments

Comments
 (0)