Expand description
Quantum causal models on the causal monad.
This crate carries the quantum-information layer of DeepCausality: the
QuantumGates/QuantumOps traits and gate kernels migrated out of
deep_causality_physics, with HilbertState (the pure-state ket) staying
in deep_causality_multivector as the foundational carrier.
Two quantum senses share this crate but are kept strictly apart by modality: the verifiable path (deterministic simulated Choi–Jamiołkowski operators, checked at the freeze boundary) is the default build and the target of the Lean proofs; the emergent path (a physical QPU call as a monadic effect) is a seam only.
All metric signatures come from deep_causality_metric, the single source
of truth; this crate defines no metric type of its own.
Structs§
- Abstraction
- A downward abstraction from a low-level model
Lto a high-level modelH. - Adjudication
- What
adjudicateexamined and concluded. - Alignment
Entry - One aligned type: high-level wires, the low-level wires they abstract, the channel and its section.
- Alignment
Structure - What
check_alignment_structurecomputed. - Boundary
Warrant - What a boundary check certifies: the measured hypothesis and the bound it buys.
- Causal
Structure - A causal structure: a bipartite influence relation between input systems and
output systems.
contains(i, o)holds when inputiinfluences outputo. - Channel
- A quantum channel, CPTP-checked once, at construction.
- Check
- One decision: a measured quantity against a threshold, with the margin and the verdict.
- Check
Report - The records of one decision, with the count of what it examined.
- Circuit
Model - A compositional model in QC. See the module documentation.
- Circuit
Subject - A compositional model in QC: the circuit is the stored object, and its dilation is what the structural stages screen. The one subject that can enter an abstraction.
- Class
Invariance - What a class-invariance check examined and concluded.
- Clifford
Action - What a Clifford-action check examined and concluded.
- Code
Abstraction - A CSS code as an abstraction. See the module documentation.
- Code
Subject - A chain complex, evaluated exactly. No probes, no evidence.
- Commutator
Check - One recorded commutator check (the shared B1(c)/Q-TOL telemetry).
- Commutator
Tolerance - The depth-aware, condition-driven commutator tolerance (Q-TOL): an
incremental first-order forward-error budget over the real unit roundoff
u. The pair test accepts[ρ_j, ρ_k] = 0iff‖[ρ_j,ρ_k]‖_F ≤ C · (‖ρ_j‖·budget_k + ‖ρ_k‖·budget_j + 2·γ_n·‖ρ_j‖·‖ρ_k‖)withγ_n = n·u/(1−n·u)andCthe safety factor. Per-node budgets default tou·‖ρ‖_F; deeper/nested models can supply larger budgets that grew through their construction. - Config
- A built configuration: a subject that passed its preconditions, and what the stages share.
- Config
Builder - A configuration under construction.
- Control
- The control stage: observe, gate, fork, predict, compare, design, adjudicate. Failure is
sticky and is carried out by
finalizeas the structured error. - Control
Report - The report
controlfinalizes into: the root ledger, every world’s ledger side by side, the plan and the adjudication. - Control
World - One live world after
fork: a candidate, the plant under it, and its own ledger. - Count
Histogram - The concrete outcome-count histogram returned by the in-process simulator.
- CssCode
- A CSS code read off a chain complex:
nqubits from the 1-cells,klogical qubits fromβ₁over 𝔽₂, and the two check families as the raw columns of∂₂andδ₀. - Density
Matrix - A validated density matrix: Hermitian, positive semidefinite (checked via
the dense Hermitian eigendecomposition), and unit trace — every
constructor enforces the invariants and returns a typed
QuantumErroron violation. - Design
Plan - What
designreturns: the ordered experiments, their total cost, what each resolves, what no experiment resolves, and the separation report over every pair examined. - Diagonal
Phase - A diagonal logical gate:
exp(2πi · Q(a(γ)) / M)withMa power of two. - Diamond
Bound - The two-sided bound a Frobenius residual on Choi operators places on the diamond distance.
- Dilated
- A dilated circuit: the factorization, its supports, the default instruments and the wiring.
- Draw
- One draw against a budget: the shots granted and the seed they are drawn at.
- Environmental
Prep - A read-only handle to the environmental preparation
ρ_A. Cloneable and comparable, but never mutable: the only way to obtain one isSelf::new, and it exposes no write methods, keeping the simulated-CJ model in the verifiable region. - Evidence
- What a configuration declares: how many shots, at which seed.
- Exact
Naturality - The exact naturality check of a code abstraction over its gates.
- Exact
Program - A program the exact semantics can evaluate.
- Experiment
- An experiment a plan may choose: its cost, the shots it would take, and the read-out each hypothesis predicts for it.
- Factor
Supports - The Hilbert support of each factor: the ordered leg-ids it acts on
(ascending, the row-major factor layout) plus each leg’s dimension. For the
flat QCM the leg-id of a single-system node is the node index itself, and
support(Aᵢ) = {Aᵢ} ∪ Pa(Aᵢ). - Fault
- One fault: a Pauli error on distinct wires, inserted after a node of the low-level circuit or, with no node named, before its first box.
- Fault
Record - One fault’s verdict.
- Fault
Set - A finite signature of fault queries over the low-level model.
- Fault
Tolerance Report - The fault-tolerance report of one gate or one abstraction under a fault set.
- Gate
Naturality - One gate’s exact naturality verdict.
- Gauge
Field Gate - A diagonal gate in the algebra of its blocks’ logical
Z̄s. See the module documentation. - Haruna
Filter - The Haruna filter: which Table 1 gates of a code tolerate every weight-one Pauli fault.
- Hypothesis
- A structural or mechanism candidate.
- Ideal
Recovery - The isometry and the recovery of a code.
- Induced
Dag - The open DAG a compositional model induces (Lorenz & Tull, arXiv:2602.16612, Example 61): one vertex per node of the model’s grouping, one edge per wire leaving one node and entering another. Derived, never stored beside the model.
- Invariance
Witness - The basis state that witnessed a class-invariance failure.
- Ldpc
Weights - What
check_ldpc_weightsexamined and concluded. - Ledger
- The threaded state of a run: what was spent on the device, and what was only computed.
- Logical
Basis - The logical operators of a CSS code at one grade: a basis of
H_kand one ofH^k. - Logical
Pauli - A Pauli operator on the physical qubits, in symplectic form.
- Logical
Program - A logical gate as a physical-gate program, with the global phase the construction carries.
- Marginalised
- What a marginalisation returns when its warrant holds.
- Mechanisms
- Marker: the plant’s candidates are mechanisms, which carry no structural claim.
- MinCost
Cover - The objective
designsolves: cover every hypothesis pair atfloor_bitsof separation at least cost, refusing abovemax_hypotheses. - Model
Subject - A Choi–Jamiołkowski factorization over a frozen graph: the degenerate plant with one structural
candidate and no evidence, and what the shipped
freeze_quantumcallers map onto. - Naturality
Report - What
check_naturalityexamined and concluded. - NoCandidates
- Marker: the plant has no candidates yet.
- NoSubject
- The builder before a subject is named.
- NodeLeg
- One node’s leg: its wires ascending, their dimensions, and the node dimension
d. - Numeric
Caps - The two caps of the numeric semantics, both counted and refused before allocating.
- Observable
- A named projector carrying its own read-out.
- Plan
Entry - One chosen experiment and the pairs it resolves.
- Plant
Subject - A system that evolves and is measured, with the observables it exposes and its candidates.
- Process
Factors - The node-keyed store of CJ factors. Keys are intrinsic graph node indices
(never enumeration/insertion order); an absent key denotes a node with no
operator factor. This is an external parameter to the freeze, mirroring
LambdaEdges<V>; it is never carried on the runtime arity-5 STATE channel. - Projection
- A projection (Hermitian idempotent) on a fixed
D-dimensional Hilbert space. The type-level dimension is what letsVerdict::bottom/top(which take no arguments) know the space they live in. - Projection
Fold - The projection lattice’s fold of a commuting family: the meet and the join of every verdict.
- Propagated
- A Pauli pushed through an exact program: the Pauli it became and the diagonal remainder the
non-Clifford layers left,
U P U† = pauli · remainderup to the remainder’s own phases. - QcMorphism
- A morphism of QC carried at the Kraus level: for each pair of classical input values
xand classical output valuesy, a family of Kraus operatorsd_out × d_in, the completely positive mapf(y | x)of Lorenz & Tull’s Example 57. The Choi operator of a block is formed only when asked for, under the entry cap. - QclBuilder
- The one origin of every configuration, and the entry to each stage.
- QpuParams
- The requested-parameter summary routed to the STATE channel by
qpu_effect. - Quantum
Circuit - A storable circuit: a
num_qubitsregister, an ordered gate program, and a computational-basis measurement over a subset of qubits.Clone + Debug + PartialEq; carries no amplitudes. - Quantum
Error - The crate-local quantum error: an outer newtype over
QuantumErrorEnum, mirroring the repo convention (CausalityError(CausalityErrorEnum::…)). - Quantum
Markov Report - The instrumented report of a Markov check: one entry per intersecting-support factor pair.
- Quantum
Plant - A sealed, validated state that evolves by operation.
- Qubit
Operator - A single-qubit unitary, built by name and owning its shape.
- Query
Signature - A set of queries validated against the DAG they will be asked of.
- Query
Type - The wires a query’s morphism runs between, in the order the morphism’s legs take them: quantum wires ascending, classical wires in declaration order.
- Screened
- What
validateterminates in: the config, the admitted candidates, and the report. - Shot
Budget - The ledger of a shot budget: what remains, what was spent, and the run seed.
- Shot
Estimate - A Bernoulli point estimate from a histogram, with its standard error and the shots behind it.
- SimCalibration
- The calibration surfaced to the context channel by
qpu_effect. - SimQpu
- A deterministic dense state-vector simulator. Amplitudes never leave the
simulator —
samplereturns only a classicalCountHistogram. - Structural
- Marker: the plant’s candidates are structural, and must be screened before
control. - Survivor
- The hypothesis that survived, and how far it stood from its nearest rival.
- Type
Alignment - The type alignment of an abstraction. See the module documentation.
- Validate
- The validate stage: checks accumulate, the first failure is sticky, and
finalizeterminates in aScreenedor carries the structured error out. - World
- One live world after a fork: the hypothesis it ran under, the verdict it came back with, and the read-out the verdict was taken from.
Enums§
- Alignment
Side - Which side of a query’s type an entry aligns. A query has an input type and an output type (Lorenz & Tull, footnote 19), and a code’s low-level model in the shape of Example 58, encoder then gate, aligns its logical inputs by the identity and its physical outputs by the decoder.
- Ambiguity
- Why no single hypothesis survived.
- Axis
- The axis of a single-qubit rotation.
- Check
Item - What one
Checkexamined: the identifier the decision form is generic over. - Check
Matrix - Which check matrix an LDPC item came from.
- Check
Verdict - The three states a report can be in.
Vacuousis an acceptance that examined nothing. - Circuit
Box - One box of a
CircuitModel: a morphism of QC (Lorenz & Tull, arXiv:2602.16612, Figure 2) on the wires it names. - Exact
Layer - One layer of an exact program.
- Factorization
- Where the factors a Markov report certifies came from.
- Fault
Origin - Which constructor produced a fault set.
- GateOp
- A single reified gate over the migrated gate alphabet. Plain data — no function pointers, no amplitudes.
- Ldpc
Item - Whether an LDPC item is a column, one check, or a row, one qubit.
- Logical
Gate - A logical gate of Table 1 on the code’s logical qubits, by index.
- Pauli
Kind - A single-qubit Pauli error.
- Quantum
Error Enum - Detailed classification of quantum errors. Typed variants name the exact
failure; a
Stringpayload carries the operation-specific context. - Query
- A query on a compositional model, Lorenz & Tull, arXiv:2602.16612, §3.2 and §7.2.
- Screen
Origin - Where a screened subject’s factorization came from.
- Screen
Status - Why a screened report is or is not current.
- Semantics
Path - Which semantics decided a value derived from a
CircuitModel. - Spec
- A real-valued specification a read-out is judged against.
- Structure
Scope - What the predicates license.
- Tolerance
- The tolerance family: the policies the crate’s checks derive their thresholds from, named.
- Wire
Source - Where a wire enters a node from.
- Wire
Type - The type of a wire in the category QC (Lorenz & Tull, arXiv:2602.16612, Example 57): a finite-dimensional Hilbert space, drawn thick, or a finite set of classical outcomes, drawn thin.
- World
Verdict - The verdict a forked world came back with. Verdicts are extracted at the measurement
boundary, so there is no constructor from an operator: a world that reaches
adjudicatecarrying an operator noobserveturned into a verdict has nothing to fold.
Constants§
- ATOM_
ENUMERATION_ CAP - The largest block-occupancy enumeration
check_class_invariancewill attempt per shift. - DEFAULT_
MAX_ HYPOTHESES - The default cap on the hypotheses
designwill cover exactly.2^C(7,2) = 2^21subsets. - DILATION_
ENTRY_ CAP - The most entries one factor is allowed to occupy: a factor on legs of dimension
d²each is dense on their product, and three two-qubit nodes already reach2^24. - FAULT_
SET_ CAP - The default cap on the number of faults a set may enumerate.
- FROBENIUS_
ON_ CHOI - The norm a naturality report measured in.
- IDEAL_
RECOVERY_ MAX_ QUBITS - The widest register the dense construction takes.
- MAX_
GATE_ QUBITS - The widest gate a unitary is formed for: a
2^12 × 2^12matrix is the numeric semantics’ default entry cap, and a widerCmzwould allocate before any cap could refuse it. - MAX_
GAUGE_ BLOCKS - The most blocks one gate carries, so the phase table stays
2^m ≤ 2^16entries. - TUPLE_
ENUMERATION_ CAP - The largest tuple enumeration
logical_tandlogical_multi_czattempt by default. About a million tuples: under it, a weight-180T̄; over it, the cost is reported rather than paid.
Traits§
- Build
Subject - What
build()checks of a subject before any stage runs. - Control
Source - What may enter
control: a plant config whose candidates are mechanisms, or a screen. A plant config with structural candidates has no implementation, which is the compiler saying that structural candidates entercontrolonly throughvalidate. - QcModel
- A compositional model in QC that can answer queries: the low-level or high-level side of an
Abstraction. Static dispatch: each model type implements it directly. - QpuSampler
- The generic sampler seam. Implementations return measurement shots as
classical
ShotHistogramdata at the Kleisli cut; no concrete vendor adapter is shipped by this crate. Used only as a boundS: QpuSampler. - Quantum
Gates - Standard Quantum Gates interface.
- Quantum
Ops - Core Quantum State Operations (Dirac Notation), parameterized over the underlying real field $R$ so the operations can be carried out at f32, f64, f128, or any other real-field precision.
- Shot
Histogram - A classical measurement histogram: outcome bitstrings (packed LSB-first over the circuit’s measured qubits) to shot counts. Never exposes amplitudes.
- Subject
Origin - The origin a subject type reports.
Functions§
- adjudicate
- Fold the worlds’ verdicts under the verdict law, and separate the survivor from its rivals.
- apply_
choi - Applies a channel to a state through its Choi operator:
E(ρ)[j,l] = Σ_{ik} ρ[i,k] · J[(i,j),(k,l)]. - apply_
gate - Causal wrapper for
mechanics::apply_gate_kernel. - apply_
gate_ kernel - Applies a quantum gate to a state: $|\psi’\rangle = U |\psi\rangle$.
- apply_
kraus - Applies a channel to a state through its Kraus family:
E(ρ) = Σ K ρ Kᴴ. - bhattacharyya_
bits_ per_ shot - The per-shot Bhattacharyya distance between two Bernoulli distributions, in bits:
−log₂(√(pq) + √((1−p)(1−q)))(Bhattacharyya, Bull. Calcutta Math. Soc. 35, 1943). Zero whenp = q, and the coefficient inside the logarithm is the overlap of the two distributions. - born_
probability - Causal wrapper for
mechanics::born_probability_kernel. - born_
probability_ kernel - Calculates the Born probability: $P = |\langle \text{basis} | \text{state} \rangle|^2$.
- born_
projective_ prob - The Born-rule probability as the
ProbMV-algebra verdict — the boundary where a quantum measurement becomes a classical (fuzzy) verdict. - born_
projective_ probability - The Born-rule probability of the measurement outcome
projectionon staterho:Tr(P ρ), clamped to[0, 1]. Real for a HermitianPandρ; a non-negligible imaginary part signals a malformed input and errors. - channel_
compose - Causal wrapper for
Channel::compose. - channel_
from_ kraus - Causal wrapper for
Channel::from_kraus. - channel_
unitary - Causal wrapper for
Channel::unitary. - check_
alignment_ structure - Definition 49’s predicates on a partition.
partition[X]lists the low-level vertices of the high-level vertexX;high_inputsare the high-level input vertices, whose blocks fullness does not ask about. - check_
completely_ positive - Complete positivity check:
Eis CP iff its Choi operator is PSD (spectrum ≥ −tol via the Hermitian eigendecomposition). - check_
completely_ positive_ report - The report-returning form of
check_completely_positive. - check_
ldpc_ weights - Both weights of both check matrices against one declared bound.
- check_
trace_ preserving - Trace-preservation check:
Eis TP iffTr_out(J) = I_in, computed with the named-subset partial trace over theoutleg. - check_
trace_ preserving_ report - The report-returning form of
check_trace_preserving. - choi_
compose - Composes two channels through their Choi operators.
- choi_
from_ kraus - Builds the Choi operator
J(E)from a Kraus family{K_κ}ofd_out×d_inmatrices:J[(i,j),(k,l)] = Σ_κ K_κ[j,i]·conj(K_κ[l,k]). - choi_
identity - The Choi operator of the identity channel on a
d-dimensional space. - clifford_
conjugate - The image
U P U†of a Pauli under a Clifford program, up to phase. - clifford_
conjugation - The Clifford conjugation with coefficient conjugation: the grade-
kblade picks up the sign(−1)^(k(k+1)/2)(grade involution ∘ reversion) and every coefficient is complex-conjugated. On a negative-signature metric this is the adjoint whose minimal-left-ideal restriction matches the matrix-column Hermitian adjoint. - commutator
- Causal wrapper for
mechanics::commutator_kernel. - commutator_
kernel - Calculates commutator $[A, B] = AB - BA$.
- derive_
code - The CSS code of a chain complex at grade 1, composed from the shipped counts and columns.
- design
- The exact minimum-cost cover of the
C(n, 2)hypothesis pairs by the offered experiments. - dirac_
bracket_ kernel - The metric-correct Dirac inner product
⟨φ|ψ⟩on kets: the scalar part ofadj(φ)·ψ, whereadjisQuantumOps::dag(reversion + conjugation) for a positive-signature metric andclifford_conjugationfor a negative-signature metric. On the minimal left ideal this equals the raw column inner product ofto_ket(φ)andto_ket(ψ). - embed_
on_ legs - Embeds an operator acting on the legs
op_legsinto the fullspace(leg → dimension, ascending leg order = factor order), acting as the identity on every other leg — the Kronecker-with-identity alignment the freeze commutator uses to compare factors on their support union. - expectation_
value - Causal wrapper for
mechanics::expectation_value_kernel. - expectation_
value_ kernel - Calculates the expectation value: $\langle A \rangle = \langle \psi | A | \psi \rangle$.
- fidelity
- Causal wrapper for
mechanics::fidelity_kernel. - fidelity_
kernel - Calculates Quantum Fidelity: $F = |\langle \psi_{\text{ideal}} | \psi_{\text{actual}} \rangle|^2$.
- freeze_
quantum - Freezes
graphwith the built-in Stage-4 checks and the quantum Markov commutativity check as the level-specific hook, returning the instrumented report on success. On a quantum-check failure the graph is rolled back to the dynamic state (the hook’sunfreeze) and the structuredQuantumErroris recovered via an internal stash — not merely itsDisplaymessage. A failure in the built-in checks (acyclicity / single-writer) surfaces as aQuantumError::CalculationErrorcarrying the graph error’s message. - frobenius_
norm - The Frobenius norm
‖M‖_F = √(Σ |m_ij|²). - gate_
unitary - The unitary matrix of one gate over its qubits in ascending order, the first qubit most
significant, which is the row-major leg order
embed_on_legsand the numeric semantics use. - haruna_
cz_ gate - Causal wrapper for
gates_haruna::logical_cz. - haruna_
hadamard_ gate - Causal wrapper for
gates_haruna::logical_hadamard. - haruna_
s_ gate - Causal wrapper for
gates_haruna::logical_s. - haruna_
t_ gate - Causal wrapper for
gates_haruna::logical_t. - haruna_
x_ gate - Causal wrapper for
gates_haruna::logical_x. - haruna_
z_ gate - Causal wrapper for
gates_haruna::logical_z. - hermiticity_
defect - The Hermiticity defect
max_ij |M_ij − conj(M_ji)|(zero iffM = Mᴴ). - identity_
channel - An identity channel on
ddimensions, the box a noiseless wire carries. - identity_
matrix - The
d×dcomplex identity matrix. - is_
clifford_ gate - Whether a gate is Clifford.
- is_
diagonal_ gate - Whether a gate is diagonal in the computational basis.
- kraus_
from_ choi - Recovers a Kraus family from a (PSD) Choi operator via the Hermitian
eigendecomposition:
K_κ = √λ_κ · unvec(v_κ)forλ_κ > tol. - logical_
cz - The logical CZ gate, Table 1 row 5 and Eq. (3.42):
- logical_
hadamard - The logical Hadamard, Table 1 row 4 and Eq. (3.27):
- logical_
multi_ cz - The logical multi-controlled Z, Table 1 row 6:
- logical_
multi_ cz_ with_ cap logical_multi_czunder an explicit cap on the tuple enumeration.- logical_
s - The logical S gate, Table 1 row 3 and Eq. (3.17):
- logical_
t - The logical T gate, Table 1 row 7 and Eq. (3.59):
- logical_
t_ with_ cap logical_tunder an explicit cap on the tuple enumeration.- logical_
x - The logical X gate, Table 1 row 2:
X̄(γ̃) = ∏_k X_{ĩ_k}oversupp(γ̃). - logical_
z - The logical Z gate, Table 1 row 1:
Z̄(γ) = ∏_k Z_{i_k}oversupp(γ). - markov_
certificate - The certificate a Markov report grants, or the error its first rejection means.
- matrix_
commutator - The operator commutator
[A, B] = A·B − B·Aon complex matrices. - matrix_
trace - The matrix trace
Tr(M). - max_
modulus - The largest modulus over a sequence of complex numbers, or zero over an empty one.
- multi_
cz_ tuple_ count - The number of tuples
logical_multi_czemits over: the product of the supports’ weights. Saturates rather than overflowing. An empty support makes the product empty, so the count is zero wherever that chain sits, saturated prefix or not. - observable_
from_ ket - Causal wrapper for
Observable::from_ket. - observable_
read_ out - Causal wrapper for
Observable::read_out. - partial_
trace - The partial trace over a named subset of tensor legs.
- partial_
trace_ preservation_ boundary - The sound path past
partial_trace’s non-preservation: givenZon the kept factor andMon the whole space, measure how nearlyZ ⊗ 1_Bcommutes withM, and return the bound that buys on[Z, Tr_B(M)]. - plant_
evolve - Causal wrapper for
QuantumPlant::evolve. - plant_
from_ ket - Causal wrapper for
QuantumPlant::from_ket. - qpu_
effect - Lifts a physical-QPU call into a causaloid
fat the Kleisli boundary: on success the shot histogram rides the VALUE channel, the requested parameters the STATE channel, the device calibration the CONTEXT channel, and the provenance the LOG channel; a job failure rides the ERROR channel with the value absent. Generic overS: QpuSampler(nodyn). - quantum_
markov_ check - Runs the quantum Markov commutativity check over the external factor store,
pair by pair, on intersecting Hilbert supports only. Returns the instrumented
report on success, or a
QuantumError::CommutatorNonZeronaming the first offending pair. Sound: it never accepts a pair whose commutator exceeds the Q-TOL threshold. - quantum_
markov_ check_ report - The report-returning form of
quantum_markov_check, on the model’s own factors. - quantum_
markov_ check_ report_ as quantum_markov_check_reportwith the provenance of the factors stated.- qubit_
phase - Causal wrapper for
QubitOperator::phase. - qubit_
rotation - Causal wrapper for
QubitOperator::rotation. - reduce_
turns treduced to[0, 1)turns.- sample_
projector shotsBernoulli draws atTr(Pρ), seeded, as a one-bit histogram: outcome1is the projector accepting,0rejecting.- sample_
within_ budget requestshots of a projector read-out, drawn againstbudget.- separation_
bits - The separation of two Bernoulli read-outs at
shotsindependent draws, in bits. The Bhattacharyya distance is additive over a product of independent samples, so this isshotstimesbhattacharyya_bits_per_shot; it is what a floor in bits is compared against. - shots_
to_ observable - An observable
Uncertain<f64>from the histogram: each outcome is mapped to a real value byvalue_of, and the empirical mean and unbiased (n−1) sample variance are summarized as a normalUncertain.O(distinct outcomes)— the statistics are accumulated directly from the(outcome, count)entries, never by materializing one sample per shot. - shots_
to_ qubit_ bernoulli - A per-qubit
UncertainBool<f64>from the histogram: the Bernoulli distribution whose success probability is the measured frequency of1on thebit_index-th measured qubit (LSB-first in measurement order). - supports_
intersect - Whether two Hilbert supports (sets of leg indices) intersect — the freeze check computes a commutator only for intersecting supports.
- swap_
channel - The swap of two
d-dimensional systems as a channel. - symplectic_
dual_ basis - A symplectic dual basis: one cocycle
γ̃_jper homology generator, with⟨γ_i, γ̃_j⟩ = δ_ij. - t_
tuple_ count C(w, 2) + C(w, 3): the pair and triple tupleslogical_temits over for a chain of weightw. Saturates rather than overflowing, so a count that does not fit reads as “above any cap”.
Type Aliases§
- Alignment
Spec - One alignment entry as given to
TypeAlignment::new:(high wires, low wires, τ, E). - BoxId
- A box’s index in a
CircuitModel. - CjFactor
- A single Choi–Jamiołkowski factor
ρ_{Aᵢ|Pa(Aᵢ)}— a complex matrix on the composite Hilbert space of nodeAᵢand its parents. - Classical
Values - Classical values on a list of classical wires, in wire order.
- Gate
- NodeId
- A node’s index in a
CircuitModel’s grouping. - Operator
- Turns
- The phase a diagonal logical gate applies, as an exact rational multiple of
2π. - WireId
- A wire’s index in a
CircuitModel. - Word
- The word width of the 𝔽₂ chains the code stages carry.