Skip to content

Commit 21a66df

Browse files
committed
Fixes
1 parent c8b6031 commit 21a66df

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

cp-algo/math/poly.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace cp_algo::math {
4444
return *this;
4545
}
4646
poly_t& div_xk_inplace(size_t k) {
47-
a.erase(begin(a), min(k, size(a)));
47+
a.erase(begin(a), begin(a) + std::min(k, size(a)));
4848
normalize();
4949
return *this;
5050
}
@@ -195,9 +195,8 @@ namespace cp_algo::math {
195195
// calculate log p(x) mod x^n
196196
poly_t& log_inplace(size_t n) {
197197
assert(a[0] == T(1));
198-
auto t = mod_xk_inplace(n).inv(n);
199-
deriv_inplace();
200-
return (*this *= t).mod_xk_inplace(n - 1).integr_inplace();
198+
mod_xk_inplace(n);
199+
return (inv_inplace(n) *= mod_xk_inplace(n).deriv()).mod_xk_inplace(n - 1).integr_inplace();
201200
}
202201
poly_t log(size_t n) const {
203202
return poly_t(*this).log_inplace(n);

0 commit comments

Comments
 (0)