pub struct Poly<C: Ring> { /* private fields */ }Expand description
稀疏有序多项式。exps 长度恒为 nvars × nterms,第 i 项指数为
exps[i*nvars..(i+1)*nvars];项按环的项序严格升序,系数零的项不存在。
Implementations§
Source§impl Poly<Rational>
impl Poly<Rational>
Sourcepub fn div_rem(&self, divs: &[&Self]) -> (Vec<Self>, Self)
pub fn div_rem(&self, divs: &[&Self]) -> (Vec<Self>, Self)
主单项式除法。确定性:每步消去被除式当前最大主单项式, 多除子按给定次序匹配。
Sourcepub fn gcd(&self, other: &Self) -> Self
pub fn gcd(&self, other: &Self) -> Self
最大公因子(本原规范化:ℚ 内容归一、主项系数为正)。 gcd(0, g) = normalize(g);gcd(c₁, c₂) = 1(ℚ 上常数互素)。
Sourcepub fn normalize_primitive(&self) -> Self
pub fn normalize_primitive(&self) -> Self
本原规范化:除以 ℚ 内容使分子整系、分子 gcd 为 1,主项(项序最大 项)系数取正。零多项式原样。
Source§impl<C: Ring> Poly<C>
impl<C: Ring> Poly<C>
Sourcepub fn from_terms<I: IntoIterator<Item = (Vec<u32>, C)>>(
ring: Arc<PolyRing>,
terms: I,
) -> Self
pub fn from_terms<I: IntoIterator<Item = (Vec<u32>, C)>>( ring: Arc<PolyRing>, terms: I, ) -> Self
由(指数向量, 系数)序列构造,构造即规范化:合并同类项、去零、排序。
pub fn zero(ring: Arc<PolyRing>) -> Self
pub fn constant(ring: Arc<PolyRing>, c: C) -> Self
pub fn ring(&self) -> &Arc<PolyRing> ⓘ
pub fn nterms(&self) -> usize
pub fn is_zero(&self) -> bool
pub fn is_constant(&self) -> bool
pub fn add(&self, other: &Self) -> Self
pub fn sub(&self, other: &Self) -> Self
pub fn neg(&self) -> Self
pub fn mul(&self, other: &Self) -> Self
pub fn pow(&self, e: u32) -> Self
Trait Implementations§
impl<C: Eq + Ring> Eq for Poly<C>
impl<C: PartialEq + Ring> StructuralPartialEq for Poly<C>
Auto Trait Implementations§
impl<C> Freeze for Poly<C>
impl<C> RefUnwindSafe for Poly<C>where
Vec<C>: RefUnwindSafe,
impl<C> Send for Poly<C>
impl<C> Sync for Poly<C>
impl<C> Unpin for Poly<C>
impl<C> UnsafeUnpin for Poly<C>where
Vec<C>: UnsafeUnpin,
impl<C> UnwindSafe for Poly<C>where
Vec<C>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more