qram_simulator.word_backend¶
Reference native backend for the ideal sparse wide-word query chain.
Executes the frozen SparseWordMemory.apply_xor operator protocol (see
qram_simulator.word_memory) on an exact dict-backed statevector
whose basis indices are arbitrary-precision Python ints. Registers are
named machine words of MACHINE_WORD_BITS bits, so logical registers
wider than 64 bits genuinely span several words — the same layout
discipline SparQSim's production native backend follows.
This module is QRAM-Simulator's own verification and product-demo
executor. Production-scale native execution is provided by the caller's
backend (SparQSim); both are validated against the shared fixture
bindings/python/test/fixtures/word_query_fixture.json.
Attributes¶
Classes¶
Protocol variant whose |
|
Named machine-word register file with exact X / controlled-X execution. |
|
Exact amplitudes over arbitrary-width basis indices (dict-backed). |
|
A native X on one machine-word bit, optionally controlled on |1>. |
Functions¶
|
OR the little-endian |
|
Little-endian coordinates of one logical register over machine words. |
Module Contents¶
- class qram_simulator.word_backend.InplaceWordBackend(machine_word_bits: int = 64)[源代码]¶
Bases:
ReferenceWordBackendProtocol variant whose
conditioned_by_bitreturns None (pure mutation).
- class qram_simulator.word_backend.ReferenceWordBackend(machine_word_bits: int = 64)[源代码]¶
Named machine-word register file with exact X / controlled-X execution.
Every operation is an exact unitary permutation of the amplitudes — a genuine statevector execution, not a call recorder. Bit indices are confined to one machine word; wider logical registers span several word registers (see
word_layout()).- X_Bool(name: str, bit_index: int) WordXOperator[源代码]¶
- make_state() SparseStateVector[源代码]¶
- class qram_simulator.word_backend.SparseStateVector[源代码]¶
Exact amplitudes over arbitrary-width basis indices (dict-backed).
- class qram_simulator.word_backend.WordXOperator(backend: ReferenceWordBackend, position: int)[源代码]¶
A native X on one machine-word bit, optionally controlled on |1>.
Follows the frozen protocol:
conditioned_by_bitaccepts the bit coordinate list, mutates the operator and returnsself.
- qram_simulator.word_backend.encode_basis(basis: int, pairs, value: int, backend: ReferenceWordBackend) int[源代码]¶
OR the little-endian
valueintobasisat the given coordinates.