Skip to main content

Crate caroli_walk

Crate caroli_walk 

Source
Expand description

Discrete-time quantum walks with spins: a walker jumps between the nodes of a graph and interacts with spins sitting on its edges (K. Sellapillay and A. D. Verga, “Quantum walk on a graph of spins: magnetism and entanglement”, Phys. Rev. E 103, 032123 (2021)).

The basis is |x c s⟩: node x, color c (one per edge at x: the half-edges of the node), spin configuration s. One step is U = V(J) M C (SpinWalk). The Hilbert space has dimension 2|E| · 2^|E|, about 2·10⁷ for the 19-node ring.

The state is stored half-edge by half-edge with the spin configuration fastest, so each part of a step is one sweep over memory: the coin pairs the rows of a node, the motion and the interaction pair the two rows of an edge and, inside them, the configurations with that edge’s spin up and down, like a one-qubit gate in a state-vector simulator. The CPU version runs these sweeps in parallel; gpu runs them on the GPU, checked against the CPU.

use caroli_walk::{PLUS, SpinWalk};

// Ring of 6 nodes, coin angle π/8, coupling 0.2, spins along +x, walker on node 0.
let walk = SpinWalk::ring(6, std::f64::consts::PI / 8.0, 0.2);
let mut psi = walk.product_state(&walk.localized(0, 0), &[PLUS; 6]);
walk.steps(&mut psi, 100);
let total: f64 = walk.node_probabilities(&psi).iter().sum();
assert!((total - 1.0).abs() < 1e-12);

Re-exports§

pub use gpu::Device;
pub use gpu::Options;
pub use gpu::Report;
pub use gpu::evolve;
pub use graph::Graph;
pub use scan::ScanOptions;
pub use scan::ScanReport;
pub use scan::scan;
pub use walk::PLUS;
pub use walk::Real;
pub use walk::SpinWalk;
pub use walk::UP;
pub use walk::fourier;
pub use walk::grover;
pub use walk::rotation;
pub use walk::to_double;
pub use walk::to_single;

Modules§

gpu
Running a walk on the GPU in reduced precision, checked against the CPU, which takes over when the error would exceed the tolerance.
graph
Graphs whose edges carry the spins, with an order on the edges at each node.
observables
Observables of a walk state (Sellapillay & Verga, section 2.2): position and color probabilities, edge spins, entanglement entropies (base-2 logarithm) and concurrence.
scan
Many walks of one graph side by side, as in a scan of parameters: one walk per CPU thread and, optionally, a stream of walks on the GPU fed by one more thread, all taking the next walk from one queue. Each walk returns the probability of every half-edge summed over its steps (time averages, Kolmogorov–Smirnov distances).
walk
The walk operator U = V(J) M C and its application on the CPU, in f64 or f32.

Enums§

Precision
Floating-point format of a Metal computation.