We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3fe590e commit 5ea7caaCopy full SHA for 5ea7caa
content/numerical/FFTPolynomial.h
@@ -68,8 +68,20 @@ poly deriv(poly a) {
68
}
69
poly integr(poly a) {
70
if (a.empty())
71
- return {};
+ return {0};
72
poly b(sz(a) + 1);
73
- rep(i, 0, sz(a) + 1) b[i + 1] = a[i] / num(i + 1);
+ rep(i,1,sz(b)) b[i] = a[i - 1] / num(i);
74
return b;
75
76
+poly log(poly a) { return modK(integr(deriv(a) * inverse(a)), sz(a)); }
77
+poly exp(poly a) {
78
+ poly b(1, num(1));
79
+ if (a.empty())
80
+ return b;
81
+ while (sz(b) < sz(a)) {
82
+ b.resize(sz(b)*2);
83
+ b *= (poly({num(1)}) + modK(a, sz(b)) - log(b));
84
+ b.resize(sz(b)/2 + 1);
85
+ }
86
+ return modK(b, sz(a));
87
+}
0 commit comments