/** * CHP (Aaronson-Gottesman 2004) Clifford stabilizer simulator — bit-packed. * * Maintains a (2n+1) × ⌈n/32⌉ word tableau: * Rows 0..n-1: destabilizer generators * Rows n..2n-1: stabilizer generators * Row 2n: scratch row for deterministic measurement * * 32 tableau bits are packed per Int32Array element. * `rowmul` phase and XOR are both O(n/32) via vectorized popcount and word XOR. * Single-qubit gates are O(n) over the 2n rows; measurement is O(n²) worst-case. * `?? 0` guards on `_r` reads are required by noUncheckedIndexedAccess. */ export declare class CliffordSim { readonly n: number; private readonly W; private readonly _x; private readonly _z; private readonly _r; constructor(n: number); /** * Tableau row multiply: row_i ← row_i · row_h. * Phase accumulated via vectorized popcount on packed Pauli word pairs (O(n/32)): * +1 contributions: Y·Z, X·Y, Z·X * -1 contributions: Y·X, X·Z, Z·Y * XOR update in the same pass to avoid re-reading words. */ private rowmul; /** H: swap x↔z for column a, r[i] ^= x[i,a] & z[i,a]. */ h(a: number): void; /** S: z[i,a] ^= x[i,a], r[i] ^= x[i,a] & z_old[i,a]. */ s(a: number): void; /** S†: same z update as S, but r[i] ^= x[i,a] & ~z_old[i,a]. */ si(a: number): void; /** X: r[i] ^= z[i,a]. (X anticommutes with Z, commutes with X.) */ x(a: number): void; /** Y: r[i] ^= x[i,a] ^ z[i,a]. (Y anticommutes with X and Z, commutes with Y.) */ y(a: number): void; /** Z: r[i] ^= x[i,a]. (Z anticommutes with X, commutes with Z.) */ z(a: number): void; /** CNOT: x[i,b] ^= x[i,a], z[i,a] ^= z[i,b], r update per CHP §3. */ cnot(a: number, b: number): void; /** * CZ: z[i,a] ^= x[i,b], z[i,b] ^= x[i,a], r[i] ^= x[i,a] & x[i,b] & (z[i,a] ^ z[i,b]). * Derived from H_b · CNOT(a,b) · H_b. * Same-word case (a and b share a 32-bit word) handled with a single combined write. */ cz(a: number, b: number): void; /** CY: S†_b · CNOT(a,b) · S_b. */ cy(a: number, b: number): void; /** * SWAP: swap columns a and b in _x and _z. No phase change. * XOR-swap trick handles both same-word and different-word cases correctly. */ swap(a: number, b: number): void; /** Measure qubit a. rand uniform in [0,1). Returns 0 or 1. */ measure(a: number, rand: number): number; /** * Return the n stabilizer generators as signed Pauli strings, e.g. `['+XZZXI', '-IXZZX']`. * Rows n..2n-1 of the tableau; sign from the phase bit (0 → '+', 1 → '-'). */ stabilizerGenerators(): string[]; } //# sourceMappingURL=clifford.d.ts.map