Liking cljdoc? Tell your friends :D

org.soulspace.qclojure.adapter.backend.hardware-simulator

Quantum hardware simulator backend implementation with realistic noise modeling.

This backend simulates quantum circuits on a virtual quantum device, incorporating various noise models to mimic real quantum hardware behavior. It supports asynchronous job execution, job tracking, and comprehensive result extraction including state trajectories and density matrix calculations. The backend adheres to the QuantumBackend protocol, ensuring compatibility with the broader QClojure framework.

The simulator backend supports predefined quantum devices with specific topologies and noise characteristics, as well as custom configurations. Noise models can include gate errors, readout errors, and decoherence effects, allowing for realistic simulation of quantum algorithms under noisy conditions.

The simulator backend is stateful, managing job submissions and their execution status. It also tracks the current device and allows for device selection.

Key Features:

  • Realistic noise modeling (depolarizing, amplitude damping, phase damping, etc.)
  • Asynchronous job submission and tracking
  • Comprehensive result extraction (measurement results, expectation values, density matrices)
  • Support for predefined quantum devices and custom configurations
  • Integration with QClojure's optimization and circuit transformation pipelines
  • Adherence to the QuantumBackend protocol for seamless integration
Quantum hardware simulator backend implementation with realistic noise modeling.

This backend simulates quantum circuits on a virtual quantum device,
incorporating various noise models to mimic real quantum hardware behavior.
It supports asynchronous job execution, job tracking, and comprehensive
result extraction including state trajectories and density matrix calculations.
The backend adheres to the QuantumBackend protocol, ensuring compatibility
with the broader QClojure framework.

The simulator backend supports predefined quantum devices with specific topologies
and noise characteristics, as well as custom configurations.
Noise models can include gate errors, readout errors, and decoherence effects,
allowing for realistic simulation of quantum algorithms under noisy conditions.

The simulator backend is stateful, managing job submissions and their execution status.
It also tracks the current device and allows for device selection.

Key Features:
- Realistic noise modeling (depolarizing, amplitude damping, phase damping, etc.)
- Asynchronous job submission and tracking
- Comprehensive result extraction (measurement results, expectation values, density matrices)
- Support for predefined quantum devices and custom configurations
- Integration with QClojure's optimization and circuit transformation pipelines
- Adherence to the QuantumBackend protocol for seamless integration
raw docstring

cleanup-completed-jobs!clj

(cleanup-completed-jobs!)
(cleanup-completed-jobs! max-age-ms)

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

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
sourceraw docstring

couplingclj

(coupling device)

Get the qubit coupling of the device.

Parameters:

  • device: Device map

Returns: Qubit coupling as vector of vectors

Get the qubit coupling of the device.

Parameters:
- device: Device map

Returns: Qubit coupling as vector of vectors
sourceraw docstring

create-hardware-simulatorclj

(create-hardware-simulator)
(create-hardware-simulator config)
(create-hardware-simulator config device)

Create a hardware simulator for a specific device.

Parameters:

  • config: Optional simulator configuration
    • :max-qubits - Maximum number of qubits to simulate (default: 16)
  • device: Optional device map with max-qubits, native-gates, topology and/or coupling and noise-model

Returns: QuantumHardwareSimulator instance

Create a hardware simulator for a specific device.

Parameters:
- config: Optional simulator configuration
   - :max-qubits - Maximum number of qubits to simulate (default: 16)
- device: Optional device map with max-qubits, native-gates, topology and/or coupling and noise-model

Returns: QuantumHardwareSimulator instance
sourceraw docstring

device-listclj

source

device-mapclj

source

execute-circuitclj

(execute-circuit circuit device 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:

  • 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-circuit bell-circuit {:shots 1000 :result-specs {:measurement {:shots 1000} :expectation {:observables [obs/pauli-z obs/pauli-x]} :density-matrix true}})

(execute-circuit 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-circuit bell-circuit
    {:shots 1000
     :result-specs {:measurement {:shots 1000}
                    :expectation {:observables [obs/pauli-z obs/pauli-x]}
                    :density-matrix true}})
  
  (execute-circuit vqe-circuit qs/|00⟩ 
    {:shots 2000
     :result-specs {:hamiltonian {:hamiltonian h2-hamiltonian}
                    :state-vector true}
     :noise-model {:depolarizing-rate 0.01}})
sourceraw docstring

execute-circuit-simulation-with-trajectoriesclj

(execute-circuit-simulation-with-trajectories circuit
                                              initial-state
                                              options
                                              noise-model)

Execute a 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 a 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
sourceraw docstring

execute-single-noisy-shot-with-trajectoryclj

(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:

  • 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)

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)
sourceraw docstring

max-qubitsclj

(max-qubits backend)

Get the maximum number of qubits supported by the backend.

Parameters:

  • backend: Backend instance

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)
sourceraw docstring

native-gatesclj

(native-gates device)

Get the set of native gates supported by the backend.

Parameters:

  • backend: Backend instance

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)
sourceraw docstring

reset-simulator-state!clj

(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
sourceraw docstring

simulator-stateclj

source

simulator-statisticsclj

(simulator-statistics)

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
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close