Skip to main content

PathSum

Struct PathSum 

pub struct PathSum {
    pub p: PhasePolynomial,
    pub f: BooleanState,
    pub v: VariableManager,
    pub stats: StatisticsManager,
    pub rr_tolerance: f64,
    pub rr_approximate: bool,
}

Fields§

§p: PhasePolynomial§f: BooleanState§v: VariableManager§stats: StatisticsManager§rr_tolerance: f64

Per-request tolerance for approximate RR matching (cycles).

§rr_approximate: bool

Whether a reduction rule used approximate coefficient matching.

Implementations§

§

impl PathSum

pub fn new(num_qubits: usize) -> Self

pub fn set_auto_reduce(&mut self, enable: bool)

pub fn is_auto_reduce(&self) -> bool

pub fn quantum_circuit(regs: &[Register], initial_state: Option<&[u8]>) -> Self

pub fn set_initial_state(&mut self, state: &[u8])

Set the initial quantum state (e.g., |010> passed as &[0, 1, 0]). This triggers algebraic substitution across both Phase Polynomial (P) and Boolean State (F).

pub fn is_identity(&self) -> bool

pub fn is_identity_up_to_phase(&self) -> bool

pub fn get_global_phase(&self) -> Option<PhaseCoeff>

pub fn print_status(&self) -> String

§

impl PathSum

pub fn load_from_qasm_file( file_path: &str, initial_state: Option<&[u8]>, ) -> Result<Self, String>

pub fn load_from_qasm_str( qasm_str: &str, initial_state: Option<&[u8]>, ) -> Result<Self, String>

§

impl PathSum

pub fn get_reducible_vars(&self) -> Vec<u32>

pub fn full_reduce(&mut self)

pub fn try_reduce_elim(&mut self, reducible_vars: &[u32]) -> bool

pub fn try_reduce_hh(&mut self, reducible_vars: &[u32]) -> bool

Attempt to execute HH Rule (Feynman path cancellation)

pub fn try_reduce_omega(&mut self, reducible_vars: &[u32]) -> bool

Attempt to execute ω-rule (Phase Gadget simplification)

Trait Implementations§

§

impl Clone for PathSum

§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
§

impl Debug for PathSum

§

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

Formats the value using the given formatter. Read more
§

impl QuantumGates for PathSum

§

fn apply_rx(&mut self, qubit: usize, theta: Angle, side: Side)

RX(theta) = U3(theta, -pi/2, pi/2)

§

fn apply_ry(&mut self, qubit: usize, theta: Angle, side: Side)

RY(theta) = U3(theta, 0, 0)

§

fn apply_u2(&mut self, qubit: usize, phi: Angle, lam: Angle, side: Side)

U2 Gate: X-Y plane rotation defined as U2(phi, lam) = U3(pi/2, phi, lam)

§

fn apply_u3( &mut self, qubit: usize, theta: Angle, phi: Angle, lam: Angle, side: Side, )

U3(theta, phi, lam)

§

fn apply_x(&mut self, qubit: usize, side: Side)

§

fn apply_z(&mut self, qubit: usize, side: Side)

§

fn apply_y(&mut self, qubit: usize, side: Side)

§

fn apply_h(&mut self, qubit: usize, side: Side)

§

fn apply_s(&mut self, qubit: usize, side: Side)

§

fn apply_sdg(&mut self, qubit: usize, side: Side)

§

fn apply_cx(&mut self, control: usize, target: usize, side: Side)

§

fn apply_cz(&mut self, control: usize, target: usize, side: Side)

§

fn apply_ccx( &mut self, control1: usize, control2: usize, target: usize, side: Side, )

§

fn apply_t(&mut self, qubit: usize, side: Side)

§

fn apply_tdg(&mut self, qubit: usize, side: Side)

§

fn apply_rz(&mut self, qubit: usize, theta: Angle, side: Side)

§

fn apply_p(&mut self, qubit: usize, theta: Angle, side: Side)

§

fn apply_u1(&mut self, qubit: usize, theta: Angle, side: Side)

§

fn apply_u( &mut self, qubit: usize, theta: Angle, phi: Angle, lam: Angle, side: Side, )

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.