Struct PolynomialOperator

Source
pub struct PolynomialOperator<'a, const P: u32, const PR: u32> { /* private fields */ }
Expand description

多項式の演算を扱う。

Implementations§

Source§

impl<'a, const P: u32, const PR: u32> PolynomialOperator<'a, P, PR>

Source

pub fn new(ntt: &'a NTT<P, PR>) -> Self

NTT<P>を基にPolynomialOperator<P>を生成する。

Source

pub fn add_assign(&self, a: &mut Polynomial<P>, b: Polynomial<P>)

多項式aに多項式bを足す。

Source

pub fn add(&self, a: Polynomial<P>, b: Polynomial<P>) -> Polynomial<P>

多項式aと多項式bの和を返す。

Source

pub fn sub_assign(&self, a: &mut Polynomial<P>, b: Polynomial<P>)

多項式aから多項式bを引く。

Source

pub fn sub(&self, a: Polynomial<P>, b: Polynomial<P>) -> Polynomial<P>

多項式aと多項式bの差を返す。

Source

pub fn mul_assign(&self, a: &mut Polynomial<P>, b: Polynomial<P>)

多項式aに多項式bを掛ける。

Source

pub fn mul(&self, a: Polynomial<P>, b: Polynomial<P>) -> Polynomial<P>

多項式aと多項式bの積を返す。

Source

pub fn sq(&self, a: Polynomial<P>) -> Polynomial<P>

多項式aの2乗を返す。

Source

pub fn scale(&self, a: Polynomial<P>, k: ConstModInt<P>) -> Polynomial<P>

多項式ak倍を返す。

Source

pub fn inv(&self, a: Polynomial<P>, n: usize) -> Polynomial<P>

Source

pub fn divmod( &self, a: Polynomial<P>, b: Polynomial<P>, ) -> (Polynomial<P>, Polynomial<P>)

多項式aの多項式bによる商と剰余を返す。

Source

pub fn differentiate(&self, a: Polynomial<P>) -> Polynomial<P>

多項式の微分を返す。

Source

pub fn integrate(&self, a: Polynomial<P>) -> Polynomial<P>

多項式の積分を返す。

Source

pub fn shift_higher(&self, a: Polynomial<P>, k: usize) -> Polynomial<P>

係数をk次だけ高次側にずらす。ただし、$x^n$の項以降は無視する。

$(a_0 + a_1 x + a_2 x^2 + \ldots + a_{n-1} x^{n-1}) \times x^k \pmod {x^n}$

Source

pub fn shift_lower(&self, a: Polynomial<P>, k: usize) -> Polynomial<P>

係数をk次だけ低次側にずらす。ただし、負の次数の項は無視する。

Trait Implementations§

Source§

impl<const P: u32, const PR: u32> FpsExp for PolynomialOperator<'_, P, PR>

Source§

type Poly = Polynomial<P>

多項式の型
Source§

fn fps_exp(&self, f: Self::Poly) -> Self::Poly

$f(x) = \sum_0^{n-1} a_ix^i$について、$\exp (f(x))$の先頭$n$項を求める。
Source§

impl<const P: u32, const PR: u32> FpsInv for PolynomialOperator<'_, P, PR>

Source§

type Poly = Polynomial<P>

多項式の型
Source§

fn fps_inv(&self, f: Self::Poly) -> Self::Poly

$f(x) = \sum_0^{n-1} a_ix^i$について、$\frac{1}{f(x)}$の先頭$n$項を求める。
Source§

impl<const P: u32, const PR: u32> FpsLog for PolynomialOperator<'_, P, PR>

Source§

type Poly = Polynomial<P>

多項式の型
Source§

fn fps_log(&self, f: Self::Poly) -> Self::Poly

$f(x) = \sum_0^{n-1} a_ix^i$について、$\log (f(x))$の先頭$n$項を求める。
Source§

impl<const P: u32, const PR: u32> FpsPow for PolynomialOperator<'_, P, PR>

Source§

type Poly = Polynomial<P>

多項式の型
Source§

fn fps_pow(&self, f: Self::Poly, m: u64) -> Self::Poly

$f(x) = \sum_0^{n-1} a_ix^i$について、$(f(x))^m$の先頭$n$項を求める。
Source§

impl<const P: u32, const PR: u32> FpsSqrt for PolynomialOperator<'_, P, PR>

Source§

type Poly = Polynomial<P>

多項式の型
Source§

fn fps_sqrt(&self, f: Self::Poly) -> Option<Self::Poly>

$f(x) = \sum_0^{n-1} a_ix^i$について、$\sqrt{f(x)}$の先頭$n$項を求める。
Source§

impl<const P: u32, const PR: u32> MultipointEval for PolynomialOperator<'_, P, PR>

Source§

type Poly = Polynomial<P>

多項式の型
Source§

type Value = ConstModInt<P>

多項式の係数の型
Source§

fn multipoint_eval( &self, a: Self::Poly, p: Vec<Self::Value>, ) -> Vec<Self::Value>

多項式の多点評価 Read more
Source§

impl<const P: u32, const PR: u32> TaylorShift for PolynomialOperator<'_, P, PR>

Source§

type Poly = Polynomial<P>

多項式の型
Source§

type Value = ConstModInt<P>

多項式の係数の型
Source§

fn taylor_shift(&self, p: Self::Poly, c: Self::Value) -> Self::Poly

多項式 p = $f(x) = a_0 + a_1x + \cdots + a_nx^n$に対して、
多項式 $f(x + c) = a_0 + a_1(x + c) + \cdots + a_n(x + c)^n = b_0 + b_0x + \cdots + b_nx^n$ を満たす、数列{$b_i$}を求める。

Auto Trait Implementations§

§

impl<'a, const P: u32, const PR: u32> Freeze for PolynomialOperator<'a, P, PR>

§

impl<'a, const P: u32, const PR: u32> RefUnwindSafe for PolynomialOperator<'a, P, PR>

§

impl<'a, const P: u32, const PR: u32> Send for PolynomialOperator<'a, P, PR>

§

impl<'a, const P: u32, const PR: u32> Sync for PolynomialOperator<'a, P, PR>

§

impl<'a, const P: u32, const PR: u32> Unpin for PolynomialOperator<'a, P, PR>

§

impl<'a, const P: u32, const PR: u32> UnwindSafe for PolynomialOperator<'a, P, PR>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.