inv
関数 · 形式的冪級数 (FPS)
// (1)
template <internal::static_modint_c mint>
std::vector<mint> inv(const std::vector<mint> &h, int deg);
// (2)
template <internal::static_modint_c mint>
std::vector<mint> inv(const std::vector<mint> &h);
概要
(1) 逆元 $1 / h \pmod{x^{deg}}$
ニュートン法で deg 項まで求める。定数項 h[0] は逆元を持つ必要がある。 条件を満たせば Montgomery + AVX2 NTT 実装へ振り分ける。
- テンプレートパラメータ
mint: static modint - パラメータ
h: 係数列(h[0] != 0が必要) - パラメータ
deg: 求める項数 - 戻り値:
std::vector<mint>$h \cdot res \equiv 1 \pmod{x^{deg}}$ を満たすres(長さdeg) - 計算量:
degを $d$ として $O(d \log d)$
(2) 逆元 1 / h (deg は h.size())
- テンプレートパラメータ
mint: static modint - パラメータ
h: 係数列(h[0] != 0が必要) - 戻り値:
std::vector<mint>長さ h.size() の逆元 - 計算量: $n = |h|$ として $O(n \log n)$
関連項目
plus— 形式的冪級数の加算log— 対数 $\log h \pmod{x^{deg}}$exp— 指数 $\exp h \pmod{x^{deg}}$pow— 冪乗 $h^m \pmod{x^{deg}}$sqrt— 平方根 $\sqrt h \pmod{x^{deg}}$composition— 合成 (composition) $f(g(x)) \pmod{x^{deg}}$compositional_inverse— 合成逆 (compositional inverse) $g \pmod{x^{deg}}$div_mod— 多項式の除算 (商と剰余)div— 多項式の商 f / gmod— 多項式の剰余 f mod gmultipoint_evaluation— 多点評価polynomial_interpolation— 多項式補間 (ラグランジュ補間)taylor_shift— Taylor shift (係数の平行移動)shift_of_sampling_points— 標本点のシフト (shift of sampling points)inv_of_polynomials— 多項式の逆元 (modular inverse of polynomials)