Advanced 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.
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.
Advanced 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. 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
(amplitude-damping-kraus-operators gamma)
Generate Kraus operators for amplitude damping (T1 decay).
Models energy dissipation where |1⟩ decays to |0⟩. Kraus operators: K₀ = [[1, 0], [0, √(1-γ)]], K₁ = [[0, √γ], [0, 0]]
Parameters:
Returns: Vector of Kraus operators using fastmath complex numbers
Generate Kraus operators for amplitude damping (T1 decay). Models energy dissipation where |1⟩ decays to |0⟩. Kraus operators: K₀ = [[1, 0], [0, √(1-γ)]], K₁ = [[0, √γ], [0, 0]] Parameters: - gamma: Damping parameter (0 <= gamma <= 1) Returns: Vector of Kraus operators using fastmath complex numbers
(apply-advanced-gate-noise state gate noise-config)
Apply advanced noise model during gate operation.
Parameters:
Returns: State after gate operation and noise
Apply advanced noise model during gate operation. Parameters: - state: Current quantum state - gate: Gate operation - noise-config: Advanced noise configuration Returns: State after gate operation and noise
(apply-advanced-readout-noise results readout-config)
Apply advanced readout noise with potential correlations.
Parameters:
Returns: Noisy measurement results
Apply advanced readout noise with potential correlations. Parameters: - results: Clean measurement results - readout-config: Advanced readout error configuration Returns: Noisy measurement results
(apply-matrix-to-amplitude amplitude-pair matrix)
Apply a 2x2 matrix to a single amplitude pair in a quantum state.
Performs proper complex matrix-vector multiplication: [new-a0] = [m00 m01] [a0] [new-a1] [m10 m11] [a1]
Parameters:
Returns: [new-a0 new-a1] as fastmath complex numbers
Apply a 2x2 matrix to a single amplitude pair in a quantum state. Performs proper complex matrix-vector multiplication: [new-a0] = [m00 m01] [a0] [new-a1] [m10 m11] [a1] Parameters: - amplitude-pair: [a0 a1] where each is a fastmath Vec2 complex number - matrix: 2x2 matrix [[m00 m01] [m10 m11]] with fastmath complex elements Returns: [new-a0 new-a1] as fastmath complex numbers
(apply-quantum-channel state kraus-operators qubit-index)
Apply a complete quantum channel defined by multiple Kraus operators.
For pure state simulators, implements quantum channels by randomly selecting one Kraus operator to apply based on the probabilities encoded in the Kraus operator coefficients. This provides correct noise simulation.
Parameters:
Returns: Output quantum state after channel application
Apply a complete quantum channel defined by multiple Kraus operators. For pure state simulators, implements quantum channels by randomly selecting one Kraus operator to apply based on the probabilities encoded in the Kraus operator coefficients. This provides correct noise simulation. Parameters: - state: Input quantum state - kraus-operators: Vector of Kraus operators with matrices and coefficients - qubit-index: Target qubit Returns: Output quantum state after channel application
(apply-single-qubit-kraus-operator state kraus-op qubit-index)
Apply a single Kraus operator to a specific qubit in a multi-qubit state.
This implements the proper quantum mechanics for Kraus operator application: |ψ'⟩ = K|ψ⟩ / ||K|ψ⟩||
The Kraus operator matrix should already include any coefficients.
Parameters:
Returns: New quantum state after applying Kraus operator and normalizing
Apply a single Kraus operator to a specific qubit in a multi-qubit state. This implements the proper quantum mechanics for Kraus operator application: |ψ'⟩ = K|ψ⟩ / ||K|ψ⟩|| The Kraus operator matrix should already include any coefficients. Parameters: - state: Quantum state - kraus-op: Kraus operator {:matrix matrix} - qubit-index: Target qubit (0-indexed) Returns: New quantum state after applying Kraus operator and normalizing
(calculate-decoherence-params t1 t2 gate-time)
Calculate decoherence parameters from T1, T2 times and gate duration.
Parameters:
Returns: {:gamma-1 gamma-2} decoherence parameters
Calculate decoherence parameters from T1, T2 times and gate duration. Parameters: - t1: T1 relaxation time (microseconds) - t2: T2 dephasing time (microseconds) - gate-time: Gate operation time (nanoseconds) Returns: {:gamma-1 gamma-2} decoherence parameters
(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
(coherent-error-kraus-operator angle axis)
Generate Kraus operator for coherent (systematic) errors.
Parameters:
Returns: Single Kraus operator for coherent rotation
Generate Kraus operator for coherent (systematic) errors. Parameters: - angle: Rotation angle in radians - axis: Rotation axis (:x, :y, or :z) Returns: Single Kraus operator for coherent rotation
(compare-hardware-platforms circuit platform-models)
Compare circuit fidelity across different quantum hardware platforms.
Parameters:
Returns: Map of platform comparisons with fidelity estimates and characteristics
Compare circuit fidelity across different quantum hardware platforms. Parameters: - circuit: Quantum circuit to analyze - platform-models: Map of platform names to noise models Returns: Map of platform comparisons with fidelity estimates and characteristics
(create-noisy-simulator noise-model)
(create-noisy-simulator noise-model config)
Create a local noisy quantum simulator with comprehensive noise modeling.
Parameters:
Returns: LocalNoisyQuantumSimulator instance
Create a local noisy quantum simulator with comprehensive noise modeling. Parameters: - noise-model: Advanced noise model configuration - config: Optional simulator configuration Returns: LocalNoisyQuantumSimulator instance
(depolarizing-kraus-operators p)
Generate Kraus operators for depolarizing noise channel.
The depolarizing channel applies each Pauli operator with probability p/4, and leaves the state unchanged with probability 1-3p/4.
For proper normalization: Σᵢ Kᵢ† Kᵢ = I
Parameters:
Returns: Vector of Kraus operators with coefficients applied to matrices
Generate Kraus operators for depolarizing noise channel. The depolarizing channel applies each Pauli operator with probability p/4, and leaves the state unchanged with probability 1-3p/4. For proper normalization: Σᵢ Kᵢ† Kᵢ = I Parameters: - p: Total error probability (0 <= p <= 3/4 for physical channel) Returns: Vector of Kraus operators with coefficients applied to matrices
(estimate-circuit-fidelity circuit noise-model)
Estimate the overall fidelity of a circuit under given noise model.
This provides a rough estimate based on gate counts and noise strengths.
Estimate the overall fidelity of a circuit under given noise model. This provides a rough estimate based on gate counts and noise strengths.
(get-simulator-stats)
Get statistics about the noisy simulator state.
Returns: Map with job counts and statistics
Get statistics about the noisy simulator state. Returns: Map with job counts and statistics
(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
(phase-damping-kraus-operators gamma)
Generate Kraus operators for phase damping (T2 dephasing).
Models random phase flips without energy loss. Kraus operators: K₀ = [[1, 0], [0, √(1-γ)]], K₁ = [[0, 0], [0, √γ]]
Parameters:
Returns: Vector of Kraus operators using fastmath complex numbers
Generate Kraus operators for phase damping (T2 dephasing). Models random phase flips without energy loss. Kraus operators: K₀ = [[1, 0], [0, √(1-γ)]], K₁ = [[0, 0], [0, √γ]] Parameters: - gamma: Dephasing parameter (0 <= gamma <= 1) Returns: Vector of Kraus operators using fastmath complex numbers
(reset-simulator-state!)
Reset the noisy simulator state, clearing all jobs and counters.
Returns: Updated state
Reset the noisy simulator state, clearing all jobs and counters. Returns: Updated state
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close