Crate paulistrings

Crate paulistrings 

Source
Expand description

The Rust core of paulistrings-rs: operators evolved in the Pauli basis under gates and noise channels, stored as a GF(2)-bucketed PauliSum and optionally partitioned over NUMA domains, MPI ranks or CUDA devices.

These docs are a developer guide; the user-facing API is the Python package, documented at https://lkdvos.github.io/paulistrings-rs/.

Structs§

And
Both policies: a term is kept if both keep it, and both layer passes run, first then second.
ApproxTopN
Retain n terms, cutting at an octave of |c|² instead of selecting exactly.
BuildAccumulator
Incremental builder for a crate::PauliSum from unsorted terms; repeated keys sum.
Circuit
An ordered list of channels on num_qubits qubits, user-defined crate::Channel impls included.
CoefficientThreshold
Drop terms whose coefficient magnitude is at most epsilon.
CollapseSample
Replace the sum by one Pauli string, drawn with probability |c|² / Σ|c|² and given coefficient 1, whenever it holds more than cache terms.
CpuSet
A set of logical CPU indices; an unsorted literal is tolerated, since every consumer normalizes.
DeviceLayerRecord
What one device partition counted for a layer beyond the shared record.
DistributedSum
One process’s partition of a sum split across a Transport’s group, held across calls so a driver scatters once, steps many times and gathers once.
Gf2Hash
The GF(2)-linear hash h(v) = H·v from a Pauli key v = (x, z) to a bucket index, for a dense random H drawn from a seed.
LayerScratch
Reusable layer working set for propagate_with, which keeps its capacity across layers and calls and carries the opt-in traces.
Or
Either of two per-term filters: a term is kept if either keeps it.
OutputBuffer
The terms one Channel::apply call emits, pushed with push.
PartitionConfig
Placement plus the knobs the partitioned engine reads alongside it.
PartitionLayerRecord
What one layer did across the whole group; the per-partition vectors are indexed by rank.
PartitionRows
The p GF(2) rows part(v) = P·v that split a sum across 2^p partitions: a partition holds exactly the terms with part(v) equal to its rank.
PartitionRuntime
The resolved placement and its pinned pools, built once and shared behind an Arc by every PartitionedSum that runs on it.
PartitionTrace
Per-layer records of propagations in application order, accumulated until drained by a driver’s take_trace.
PartitionedSum
A PauliSum split across the partitions of a PartitionRuntime, held across calls so a driver scatters and gathers once.
PauliRotation
A rotation U = exp(-i · θ · P / 2) about a Pauli generator P of any weight.
PauliString
A Pauli operator on up to 64·W qubits, W being the number of 64-bit words per x/z part.
PauliSum
Weighted sum of Pauli strings, stored as structure-of-arrays columns partitioned into buckets by a GF(2)-linear hash.
Phase
A phase factor i^k with k ∈ {0, 1, 2, 3}; + multiplies phases.
ProductBasis
A product of single-qubit stabilizer states, one per qubit: on qubit q an axis A_q ∈ {X, Y, Z} with a sign s_q ∈ {+1, -1}, i.e. |ψ⟩ = ⊗_q |A_q, s_q⟩.
PropagateOptions
Tuning knobs for propagate_with; Default is what propagate uses.
PtmChannel
A one- or two-qubit gate or noise channel, stored as its Pauli-transfer matrix.
ScatterOptions
How a scatter_with runs its partitions and picks the rows the sum splits by.
StabilizerState
A stabilizer state on num_qubits qubits, held as a reduced tableau of signed generators.
TopN
Retain the n terms of largest coefficient magnitude.
WeightCutoff
Drop terms whose Pauli weight (number of non-identity qubits) exceeds k.

Enums§

BuiltinTruncation
Any builtin policy or combinator as one runtime value, the form the device drivers take.
Direction
Propagation direction: channels in order, or in reverse with adjoints for backpropagating observables.
PartitionRowPolicy
Which partition rows a scatter splits by: a seeded GF(2)-random draw, or a qubit cut that keeps a channel local when its qubits share a block.
PauliAxis
One of the three single-qubit Pauli axes: the axis a ProductBasis qubit is an eigenstate of.
Placement
How partitions map onto the machine.
ScatterRows
The partition rows a scatter_with splits by.
StabilizerError
Why a set of generators does not define a stabilizer state.
TopologyError
What can go wrong discovering topology or resolving a PartitionConfig.

Constants§

P_MAX_BITS
Maximum number of partition bits, i.e. P ≤ 64 partitions.

Traits§

Channel
A gate or noise channel: maps a Pauli string to a small weighted sum of Pauli strings.
Collectives
The group operations a partition needs besides the exchange: its rank, the reductions, and a barrier.
Transport
The per-layer all-to-all exchange between the partitions of a group.
TruncationPolicy
A truncation strategy: a per-term filter, a per-layer pass, or both.

Functions§

numa_nodes
The NUMA nodes visible in the current affinity mask, ascending by node id, each intersected with the mask.
propagate
Propagate sum through circuit under policy.
propagate_partitioned
Propagates sum through circuit on a partitioned engine built from config, and gathers the result.
propagate_with
propagate with a caller-held LayerScratch and PropagateOptions.
support_mask
Pack qubit indices into a Channel::support bitmask; order and duplicates do not matter.