Struct SparsePolynomial

Source
pub struct SparsePolynomial<P: PrimeMod> { /* private fields */ }
Expand description

疎な多項式

Implementations§

Source§

impl<P: PrimeMod> SparsePolynomial<P>

Source

pub fn zero() -> Self

零多項式を得る。

Source

pub fn constant(a: ConstModInt<P>) -> Self

定数項のみをもつ多項式を生成する。

Source

pub fn add_one_term<T>(&mut self, i: usize, k: T)
where ConstModInt<P>: From<T>,

$k x^i$となる項を足す。

Source

pub fn coeff_of(&self, i: usize) -> ConstModInt<P>

$x^i$の係数を得る。

Source

pub fn differential(&mut self)

多項式を微分する。

Source

pub fn integral(&mut self)

多項式を積分する。

Source

pub fn scale(&mut self, k: ConstModInt<P>)

多項式をk倍する。

Source

pub fn shift_lower(&mut self, k: usize)

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

Source

pub fn shift_higher(&mut self, k: usize)

係数をk次だけ高次側にずらす。

Source

pub fn iter(&self) -> impl Iterator<Item = (&usize, &ConstModInt<P>)>

項の次数と係数のペアへのイテレータを返す。

Trait Implementations§

Source§

impl<P: Clone + PrimeMod> Clone for SparsePolynomial<P>

Source§

fn clone(&self) -> SparsePolynomial<P>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<P: Debug + PrimeMod> Debug for SparsePolynomial<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: Default + PrimeMod> Default for SparsePolynomial<P>

Source§

fn default() -> SparsePolynomial<P>

Returns the “default value” for a type. Read more
Source§

impl<P: PrimeMod> FpsExpSparse for SparsePolynomial<P>

Source§

fn fps_exp_sparse(self, n: usize) -> Result<Self::Output, &'static str>

Time complexity $O(nk)$

Source§

type Output = Polynomial<P>

戻り値の型
Source§

impl<P: PrimeMod> FpsInvSparse for SparsePolynomial<P>

Source§

fn fps_inv_sparse(self, n: usize) -> Result<Self::Output, &'static str>

Time complexity $O(nk)$

Source§

type Output = Polynomial<P>

戻り値の型
Source§

impl<P: PrimeMod> FpsLogSparse for SparsePolynomial<P>

Source§

fn fps_log_sparse(self, n: usize) -> Result<Self::Output, &'static str>

Time complexity $O(nk)$

Source§

type Output = Polynomial<P>

戻り値の型
Source§

impl<P: PrimeMod> FpsPowSparse for SparsePolynomial<P>

Source§

fn fps_pow_sparse(self, m: u64, n: usize) -> Result<Self::Output, &'static str>

Time complexity $O(nk)$

Source§

type Output = Polynomial<P>

戻り値の型
Source§

impl<P: PrimeMod> FpsSqrtSparse for SparsePolynomial<P>

Source§

fn fps_sqrt_sparse(self, n: usize) -> Result<Self::Output, &'static str>

Time complexity $O(nk)$

Source§

type Output = Polynomial<P>

戻り値の型
Source§

impl<P: PrimeMod, T> From<Vec<(usize, T)>> for SparsePolynomial<P>
where ConstModInt<P>: From<T>,

Source§

fn from(value: Vec<(usize, T)>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<P> Freeze for SparsePolynomial<P>

§

impl<P> RefUnwindSafe for SparsePolynomial<P>
where P: RefUnwindSafe,

§

impl<P> Send for SparsePolynomial<P>
where P: Send,

§

impl<P> Sync for SparsePolynomial<P>
where P: Sync,

§

impl<P> Unpin for SparsePolynomial<P>

§

impl<P> UnwindSafe for SparsePolynomial<P>
where P: RefUnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.