Liking cljdoc? Tell your friends :D

org.soulspace.qclojure.domain.result

Enhanced quantum circuit execution results with comprehensive result types.

This namespace provides a systematic way to extract different types of results from quantum circuit executions, supporting both hardware and simulation backends with QASM 3 and Amazon Braket compatible result types.

Design Philosophy:

  • Leverage existing functions from state, observables, and hamiltonian namespaces
  • Support QASM 3.0 and Amazon Braket result type specifications
  • Provide both simulation-only and hardware-compatible result types
  • Enable systematic extraction without code duplication
Enhanced quantum circuit execution results with comprehensive result types.

This namespace provides a systematic way to extract different types of
results from quantum circuit executions, supporting both hardware and
simulation backends with QASM 3 and Amazon Braket compatible result types.

Design Philosophy:
- Leverage existing functions from state, observables, and hamiltonian namespaces
- Support QASM 3.0 and Amazon Braket result type specifications
- Provide both simulation-only and hardware-compatible result types
- Enable systematic extraction without code duplication
raw docstring

compute-resultsclj

(compute-results result result-specs)

Compute specified results from the final quantum state after circuit execution.

Parameters:

  • result: Result map containing :final-state (the final quantum state after executinga circuit)
  • result-specs: Map specifying which results to extract

Result specs format (all optional): {:measurements {:shots 1000 :qubits [0 1]} :expectation {:observables [pauli-z pauli-x] :targets [0]} :variance {:observables [pauli-z] :targets [0]}
:hamiltonian my-hamiltonian :probabilities {:targets [[1 0] [0 1]] :qubits [0 1]} :amplitudes {:basis-states [0 1 2 3]} :state-vector true :density-matrix true :fidelity {:references [|0⟩ |1⟩]} :sample {:observables [pauli-z] :shots 1000 :targets [0]}}

Returns: Map of extracted results based on requested types

Compute specified results from the final quantum state after circuit execution.

Parameters:
- result: Result map containing :final-state (the final quantum state after executinga circuit)
- result-specs: Map specifying which results to extract

Result specs format (all optional):
{:measurements {:shots 1000 :qubits [0 1]}
 :expectation {:observables [pauli-z pauli-x] :targets [0]}
 :variance {:observables [pauli-z] :targets [0]}  
 :hamiltonian my-hamiltonian
 :probabilities {:targets [[1 0] [0 1]] :qubits [0 1]}
 :amplitudes {:basis-states [0 1 2 3]}
 :state-vector true
 :density-matrix true
 :fidelity {:references [|0⟩ |1⟩]}
 :sample {:observables [pauli-z] :shots 1000 :targets [0]}}

Returns:
Map of extracted results based on requested types
sourceraw docstring

extract-amplitude-resultsclj

(extract-amplitude-results final-state basis-states)

Extract amplitude results for specific computational basis states.

Leverages: qs/state-vector (direct access to amplitudes)

Parameters:

  • final-state: Final quantum state after circuit execution
  • basis-states: Vector of basis state indices to extract amplitudes for

Returns: Map with complex amplitudes (Braket Amplitude format)

Extract amplitude results for specific computational basis states.

Leverages: qs/state-vector (direct access to amplitudes)

Parameters:
- final-state: Final quantum state after circuit execution
- basis-states: Vector of basis state indices to extract amplitudes for

Returns:
Map with complex amplitudes (Braket Amplitude format)
sourceraw docstring

extract-density-matrix-resultclj

(extract-density-matrix-result final-state)

Extract density matrix representation (simulation only).

Leverages: qs/density-matrix, qs/trace-one?

Parameters:

  • final-state: Final quantum state after circuit execution

Returns: Density matrix representation (Braket style)

Extract density matrix representation (simulation only).

Leverages: qs/density-matrix, qs/trace-one?

Parameters:
- final-state: Final quantum state after circuit execution

Returns:
Density matrix representation (Braket style)
sourceraw docstring

extract-expectation-resultsclj

(extract-expectation-results final-state observables & {:keys [target-qubits]})

Extract expectation value results for observables.

Leverages: obs/expectation-value, obs/tensor-product, obs/identity-op

Parameters:

  • final-state: Final quantum state after circuit execution
  • observables: Collection of observables to measure
  • target-qubits: (optional) Specific qubits for each observable

Returns: Vector of expectation value results (Braket Expectation format)

Extract expectation value results for observables.

Leverages: obs/expectation-value, obs/tensor-product, obs/identity-op

Parameters:
- final-state: Final quantum state after circuit execution
- observables: Collection of observables to measure
- target-qubits: (optional) Specific qubits for each observable

Returns:
Vector of expectation value results (Braket Expectation format)
sourceraw docstring

extract-fidelity-resultclj

(extract-fidelity-result final-state reference-states)

Extract fidelity between final state and reference states.

Leverages: qs/state-fidelity

Parameters:

  • final-state: Final quantum state after circuit execution
  • reference-states: Vector of reference states to compare against

Returns: Map with fidelity values for each reference state

Extract fidelity between final state and reference states.

Leverages: qs/state-fidelity

Parameters:
- final-state: Final quantum state after circuit execution
- reference-states: Vector of reference states to compare against

Returns:
Map with fidelity values for each reference state
sourceraw docstring

extract-hamiltonian-expectationclj

(extract-hamiltonian-expectation final-state hamiltonian)

Extract expectation value for a Hamiltonian (energy measurement).

Leverages: ham/hamiltonian-expectation, ham/group-commuting-terms

Parameters:

  • final-state: Final quantum state after circuit execution
  • hamiltonian: Hamiltonian to measure

Returns: Map with energy expectation value and measurement optimization info

Extract expectation value for a Hamiltonian (energy measurement).

Leverages: ham/hamiltonian-expectation, ham/group-commuting-terms

Parameters:
- final-state: Final quantum state after circuit execution  
- hamiltonian: Hamiltonian to measure

Returns:
Map with energy expectation value and measurement optimization info
sourceraw docstring

extract-measurement-resultsclj

(extract-measurement-results final-state
                             &
                             {:keys [measurement-qubits shots] :or {shots 1}})

Extract measurement results from circuit execution using existing state functions.

Leverages: qs/measure-state, qs/measurement-probabilities

Parameters:

  • final-state: Final quantum state after circuit execution
  • measurement-qubits: Qubits that were measured (optional, defaults to all)
  • shots: Number of measurement shots (default 1)

Returns: Map with measurement outcomes and probabilities (Braket Sample format)

Extract measurement results from circuit execution using existing state functions.

Leverages: qs/measure-state, qs/measurement-probabilities

Parameters:
- final-state: Final quantum state after circuit execution
- measurement-qubits: Qubits that were measured (optional, defaults to all)
- shots: Number of measurement shots (default 1)

Returns:
Map with measurement outcomes and probabilities (Braket Sample format)
sourceraw docstring

extract-probability-resultsclj

(extract-probability-results final-state
                             &
                             {:keys [target-qubits target-states]})

Extract probability results for specific computational basis states.

Leverages: qs/probability, qs/measurement-probabilities

Parameters:

  • final-state: Final quantum state after circuit execution
  • target-qubits: (optional) Specific qubits to measure (defaults to all)
  • target-states: (optional) Specific target basis state indices or bit patterns

Returns: Map with probabilities (Braket Probability format)

Extract probability results for specific computational basis states.

Leverages: qs/probability, qs/measurement-probabilities

Parameters:
- final-state: Final quantum state after circuit execution
- target-qubits: (optional) Specific qubits to measure (defaults to all)
- target-states: (optional) Specific target basis state indices or bit patterns

Returns:
Map with probabilities (Braket Probability format)
sourceraw docstring

extract-sample-resultsclj

(extract-sample-results final-state observables shots & {:keys [target-qubits]})

Extract sample results for observables (hardware measurement simulation).

Leverages: obs/measurement-probabilities, simulated sampling

Parameters:

  • final-state: Final quantum state after circuit execution
  • observables: Collection of observables to sample
  • shots: Number of measurement shots
  • target-qubits: (optional) Specific qubits for each observable

Returns: Vector of sample results (Braket Sample format)

Extract sample results for observables (hardware measurement simulation).

Leverages: obs/measurement-probabilities, simulated sampling

Parameters:
- final-state: Final quantum state after circuit execution
- observables: Collection of observables to sample
- shots: Number of measurement shots
- target-qubits: (optional) Specific qubits for each observable

Returns:
Vector of sample results (Braket Sample format)
sourceraw docstring

extract-state-vector-resultclj

(extract-state-vector-result final-state)

Extract complete state vector (simulation only).

Leverages: qs/state-vector, qs/basis-labels

Parameters:

  • final-state: Final quantum state after circuit execution

Returns: Complete state vector representation (Braket StateVector format)

Extract complete state vector (simulation only).

Leverages: qs/state-vector, qs/basis-labels

Parameters:
- final-state: Final quantum state after circuit execution

Returns:
Complete state vector representation (Braket StateVector format)
sourceraw docstring

extract-variance-resultsclj

(extract-variance-results final-state observables & {:keys [target-qubits]})

Extract variance results for observables.

Leverages: obs/variance

Parameters:

  • final-state: Final quantum state after circuit execution
  • observables: Collection of observables to measure
  • target-qubits: (optional) Specific qubits for each observable

Returns: Vector of variance results (Braket Variance format)

Extract variance results for observables.

Leverages: obs/variance

Parameters:
- final-state: Final quantum state after circuit execution
- observables: Collection of observables to measure
- target-qubits: (optional) Specific qubits for each observable

Returns:
Vector of variance results (Braket Variance format)
sourceraw docstring

summarize-resultsclj

(summarize-results results)

Create a human-readable summary of execution results.

Create a human-readable summary of execution results.
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