Struct PhasePolynomial
pub struct PhasePolynomial {
pub terms: FxHashMap<Monomial, PhaseCoeff>,
}Fields§
§terms: FxHashMap<Monomial, PhaseCoeff>Implementations§
§impl PhasePolynomial
impl PhasePolynomial
pub fn new() -> Self
pub fn add_term(&mut self, monomial: Monomial, coeff: PhaseCoeff)
pub fn extract_terms_with_var( &self, var_id: u32, ) -> Vec<(&Monomial, &PhaseCoeff)>
pub fn get_used_vars(&self) -> FxHashSet<u32>
pub fn substitute_var_with_poly(
&mut self,
target_var: u32,
sub_poly: &FxHashSet<Monomial>,
)
pub fn substitute_var_with_poly( &mut self, target_var: u32, sub_poly: &FxHashSet<Monomial>, )
Substitute a Boolean polynomial without cloning source phase coefficients.
Remove every affected term before reinsertion: inserting early can merge into a term that still needs to be removed, silently losing its phase.
Trait Implementations§
§impl AddAssign<(&HashSet<Vec<u32>, FxBuildHasher>, PhaseCoeff)> for PhasePolynomial
impl AddAssign<(&HashSet<Vec<u32>, FxBuildHasher>, PhaseCoeff)> for PhasePolynomial
§fn add_assign(&mut self, (poly, phase): (&FxHashSet<Monomial>, PhaseCoeff))
fn add_assign(&mut self, (poly, phase): (&FxHashSet<Monomial>, PhaseCoeff))
Performs the
+= operation. Read more§impl AddAssign<(Vec<u32>, PhaseCoeff)> for PhasePolynomial
impl AddAssign<(Vec<u32>, PhaseCoeff)> for PhasePolynomial
§fn add_assign(&mut self, (mono, coeff): (Monomial, PhaseCoeff))
fn add_assign(&mut self, (mono, coeff): (Monomial, PhaseCoeff))
Performs the
+= operation. Read more§impl AddAssign<PhaseCoeff> for PhasePolynomial
impl AddAssign<PhaseCoeff> for PhasePolynomial
§fn add_assign(&mut self, rhs: PhaseCoeff)
fn add_assign(&mut self, rhs: PhaseCoeff)
Performs the
+= operation. Read more§impl Clone for PhasePolynomial
impl Clone for PhasePolynomial
§impl Debug for PhasePolynomial
impl Debug for PhasePolynomial
Auto Trait Implementations§
impl Freeze for PhasePolynomial
impl RefUnwindSafe for PhasePolynomial
impl Send for PhasePolynomial
impl Sync for PhasePolynomial
impl Unpin for PhasePolynomial
impl UnsafeUnpin for PhasePolynomial
impl UnwindSafe for PhasePolynomial
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