pub struct BasicApproximationTable {
pub entries: Vec<(Vec<&'static str>, SU2)>,
}Expand description
Look up table of gate sequences for the universal gate set {H, T, Tdg, S, Sdg}.
Two-stage Clifford+T construction. The single-qubit Clifford group modulo global phase has only 24 elements, so a naïve BFS over the 5-atom alphabet quickly collapses every branch onto that 24-element coset and stalls. To get richer SU(2) coverage we decouple the order-24 Clifford subgroup from the T-count growth:
-
Stage 1 — Clifford enumeration. BFS over {H, S, Sdg} until saturation produces exactly 24 distinct unitaries (up to global phase). Each carries a sequence of length ≤ 6 — the Clifford diameter for this generator set.
-
Stage 2 — T-count strata. For each
k = 1 … max_t_count, buildS_kfromS_{k-1}by appendingTorTdg, then a Clifford from Stage 1. Every entry inS_ktherefore has T-count exactlyk, sandwiched between Cliffords. Global de-duplication across all strata via the spatial-hash grid keeps the table compact.
The resulting table covers the {H,T} normal form up to T-count
max_t_count, with Cliffords absorbed at no extra T-count. Each
additional stratum genuinely expands the SU(2) reach (the Clifford+T
group is dense) rather than re-deriving cosets the previous depth
already covered.
Fields§
§entries: Vec<(Vec<&'static str>, SU2)>(gate_sequence, SU2_matrix) pairs. Pub for test introspection.
Implementations§
Source§impl BasicApproximationTable
impl BasicApproximationTable
Sourcepub fn build(table_depth: usize) -> Self
pub fn build(table_depth: usize) -> Self
Build the basic approximation table via the two-stage Clifford+T BFS.
Stage 1 enumerates the 24-element single-qubit Clifford group from
{H, S, Sdg}. Stage 2 builds T-count strata S_1, …, S_K where each
S_k extends S_{k-1} by T or Tdg followed by an arbitrary
Clifford. Global dedup keeps the table compact while every stratum
genuinely extends SU(2) coverage (the Clifford+T group is dense).
table_depth is re-interpreted as the maximum T-count for the
new algorithm (it was the BFS depth previously). Internally capped at
MAX_T_COUNT_LIMIT to avoid combinatorial explosion at large values
— a table_depth of 10 collapses to the same internal cap.
Sourcepub fn find_closest<'a>(&'a self, target: &SU2) -> (&'a [&'static str], f64)
pub fn find_closest<'a>(&'a self, target: &SU2) -> (&'a [&'static str], f64)
Find the sequence in the table closest to target (up-to-global-phase distance).
Returns the slice of gate names and the distance achieved. O(N) linear scan over the entire table.
Auto Trait Implementations§
impl Freeze for BasicApproximationTable
impl RefUnwindSafe for BasicApproximationTable
impl Send for BasicApproximationTable
impl Sync for BasicApproximationTable
impl Unpin for BasicApproximationTable
impl UnsafeUnpin for BasicApproximationTable
impl UnwindSafe for BasicApproximationTable
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.