Noisy quantum simulator backend implementing realistic quantum computing device simulation with comprehensive noise modeling.
This backend provides local simulation of quantum devices with noise using the domain layer's quantum state and circuit functionality. It serves as both a reference implementation and testing backend for quantum algorithms under realistic noise conditions.
The simulator can be initialized with a device map or with max-qubits
This simulator models various types of quantum noise including:
The noise model can be configured with parameters such as T1 and T2 times, gate operation times, and noise strengths. It supports advanced noise configurations including correlated readout errors and coherent errors with specific rotation angles and axes. The simulator applies noise during gate operations and measurements, simulating realistic quantum device behavior.
The noise model map has the following structure:
{:gate-noise {
:h {:noise-type :depolarizing :noise-strength 0.01}
:x {:noise-type :amplitude-damping :noise-strength 0.02}
:cnot {:noise-type :phase-damping :noise-strength 0.03}
...}
:readout-error {:prob-0-to-1 0.05 :prob-1-to-0 0.02}}
Note: The simulator currently doesn't model crosstalk between qubits.
The simulator supports asynchronous job management, allowing users to submit circuits and retrieve results later. It can be used for testing algorithms, circuit designs, and quantum operations without requiring access to actual quantum hardware.
It also implements the CloudQuantumBackend protocol for mock cloud backend functionality, allowing it to be used in a cloud-like environment for testing purposes.
Noisy quantum simulator backend implementing realistic quantum computing device simulation with comprehensive noise modeling. This backend provides local simulation of quantum devices with noise using the domain layer's quantum state and circuit functionality. It serves as both a reference implementation and testing backend for quantum algorithms under realistic noise conditions. The simulator can be initialized with a device map or with max-qubits - max-qubits - native-gates - topology - noise-model This simulator models various types of quantum noise including: - Depolarizing noise using Kraus operators - Amplitude damping (T1 decay) modeling energy dissipation - Phase damping (T2 dephasing) modeling pure dephasing - Readout errors with configurable bit-flip probabilities - Coherent errors and systematic rotation biases - Gate-specific noise parameters based on real device calibration - Comprehensive Amazon Braket quantum hardware noise models The noise model can be configured with parameters such as T1 and T2 times, gate operation times, and noise strengths. It supports advanced noise configurations including correlated readout errors and coherent errors with specific rotation angles and axes. The simulator applies noise during gate operations and measurements, simulating realistic quantum device behavior. The noise model map has the following structure: ```clojure {:gate-noise { :h {:noise-type :depolarizing :noise-strength 0.01} :x {:noise-type :amplitude-damping :noise-strength 0.02} :cnot {:noise-type :phase-damping :noise-strength 0.03} ...} :readout-error {:prob-0-to-1 0.05 :prob-1-to-0 0.02}} ``` Note: The simulator currently doesn't model crosstalk between qubits. The simulator supports asynchronous job management, allowing users to submit circuits and retrieve results later. It can be used for testing algorithms, circuit designs, and quantum operations without requiring access to actual quantum hardware. It also implements the CloudQuantumBackend protocol for mock cloud backend functionality, allowing it to be used in a cloud-like environment for testing purposes.
(all-noise-models)
(all-noise-models devices)
Get all available noise models.
Returns: Map of platform names to noise models
Get all available noise models. Returns: Map of platform names to noise models
(cleanup-completed-jobs!)
(cleanup-completed-jobs! max-age-ms)
Remove completed jobs older than specified time (in milliseconds).
Parameters:
Returns: Number of jobs cleaned up
Remove completed jobs older than specified time (in milliseconds). Parameters: - max-age-ms: Maximum age for completed jobs (default: 1 hour) Returns: Number of jobs cleaned up
(coupling backend)
Get the qubit coupling of the backend.
Parameters:
Returns: Qubit coupling as vector of vectors
Get the qubit coupling of the backend. Parameters: - backend: Backend instance Returns: Qubit coupling as vector of vectors
(create-hardware-simulator device)
(create-hardware-simulator device config)
Create a hardware simulator for a specific device.
Parameters:
Returns: QuantumHardwareSimulator instance
Create a hardware simulator for a specific device. Parameters: - device: Device map with max-qubits, native-gates, topology and/or coupling and noise-model - config: Optional simulator configuration Returns: QuantumHardwareSimulator instance
(execute-noisy-circuit-simulation-with-trajectories circuit
initial-state
options
noise-model)
Execute a noisy quantum circuit simulation collecting state trajectories.
This enhanced version supports comprehensive result extraction similar to the ideal simulator, including expectation values, variances, probabilities, and other quantum mechanical observables computed from the noisy simulation.
Parameters:
Returns: Simulation results including trajectory-based density matrix and extracted results
Execute a noisy quantum circuit simulation collecting state trajectories. This enhanced version supports comprehensive result extraction similar to the ideal simulator, including expectation values, variances, probabilities, and other quantum mechanical observables computed from the noisy simulation. Parameters: - circuit: Quantum circuit to simulate - initial-state: Initial quantum state for simulation - options: Execution options including shot count, trajectory collection settings, and result specs - noise-model: Noise model configuration Returns: Simulation results including trajectory-based density matrix and extracted results
(execute-noisy-circuit-with-results circuit options)
(execute-noisy-circuit-with-results circuit initial-state options)
Execute a noisy quantum circuit with comprehensive result extraction.
This function provides a high-level interface similar to the ideal simulator but with realistic noise modeling. It automatically enables trajectory collection when density matrix-based calculations are needed.
Parameters:
Returns: Comprehensive results with both raw simulation data and extracted observables
Examples: (execute-noisy-circuit-with-results bell-circuit {:shots 1000 :result-specs {:measurement {:shots 1000} :expectation {:observables [obs/pauli-z obs/pauli-x]} :density-matrix true}})
(execute-noisy-circuit-with-results vqe-circuit qs/|00⟩ {:shots 2000 :result-specs {:hamiltonian {:hamiltonian h2-hamiltonian} :state-vector true} :noise-model {:depolarizing-rate 0.01}})
Execute a noisy quantum circuit with comprehensive result extraction. This function provides a high-level interface similar to the ideal simulator but with realistic noise modeling. It automatically enables trajectory collection when density matrix-based calculations are needed. Parameters: - circuit: Quantum circuit to simulate - initial-state: Initial quantum state (optional, defaults to |00...0⟩) - options: Execution options including: - :shots - Number of measurement shots (default: 1024) - :result-specs - Map specifying what results to extract - :noise-model - Noise model configuration (optional) - :collect-trajectories - Enable trajectory collection (auto-detected from result specs) - :max-trajectories - Maximum trajectories to collect (default: 100) Returns: Comprehensive results with both raw simulation data and extracted observables Examples: (execute-noisy-circuit-with-results bell-circuit {:shots 1000 :result-specs {:measurement {:shots 1000} :expectation {:observables [obs/pauli-z obs/pauli-x]} :density-matrix true}}) (execute-noisy-circuit-with-results vqe-circuit qs/|00⟩ {:shots 2000 :result-specs {:hamiltonian {:hamiltonian h2-hamiltonian} :state-vector true} :noise-model {:depolarizing-rate 0.01}})
(execute-single-noisy-shot circuit noise-model)
(execute-single-noisy-shot circuit initial-state noise-model)
Execute a single shot of a noisy quantum circuit.
Parameters:
Returns: Single measurement outcome as a basis string
Execute a single shot of a noisy quantum circuit. Parameters: - circuit: Quantum circuit to simulate - noise-model: Noise model configuration - num-qubits: Number of qubits in the circuit Returns: Single measurement outcome as a basis string
(execute-single-noisy-shot-with-trajectory circuit noise-model)
(execute-single-noisy-shot-with-trajectory circuit initial-state noise-model)
Execute a single shot of a noisy quantum circuit, returning both outcome and final state.
Parameters:
Returns: Map containing :outcome (measurement bitstring) and :final-state (quantum state)
Execute a single shot of a noisy quantum circuit, returning both outcome and final state. Parameters: - circuit: Quantum circuit to simulate - initial-state: Initial quantum state (optional, defaults to |00...0⟩) - noise-model: Noise model configuration Returns: Map containing :outcome (measurement bitstring) and :final-state (quantum state)
(get-simulator-stats)
Get statistics about the hardware simulator state.
Returns: Map with job counts and statistics
Get statistics about the hardware simulator state. Returns: Map with job counts and statistics
(max-qubits backend)
Get the maximum number of qubits supported by the backend.
Parameters:
Returns: Maximum qubit count (default: 16)
Get the maximum number of qubits supported by the backend. Parameters: - backend: Backend instance Returns: Maximum qubit count (default: 16)
(native-gates backend)
Get the set of native gates supported by the backend.
Parameters:
Returns: Set of native gate keywords (default: all QClojure gates)
Get the set of native gates supported by the backend. Parameters: - backend: Backend instance Returns: Set of native gate keywords (default: all QClojure gates)
(noise-model backend)
Get the noise model of the backend.
Parameters:
Returns: Noise model map or empty map if none defined
Get the noise model of the backend. Parameters: - backend: Backend instance Returns: Noise model map or empty map if none defined
(noise-model-for platform)
(noise-model-for devices platform)
Get the noise model for a specific platform.
Parameters:
Returns: Noise model map or nil if not found
Get the noise model for a specific platform. Parameters: - platform: Platform name (keyword) Returns: Noise model map or nil if not found
(reset-simulator-state!)
Reset the hardware simulator state, clearing all jobs and counters.
Returns: Updated state
Reset the hardware simulator state, clearing all jobs and counters. Returns: Updated state
(topology backend)
Get the topology of the backend.
Parameters:
Returns: The topology key
Get the topology of the backend. Parameters: - backend: Backend instance Returns: The topology key
cljdoc builds & hosts documentation for Clojure/Script libraries
Ctrl+k | Jump to recent docs |
← | Move to previous article |
→ | Move to next article |
Ctrl+/ | Jump to the search field |