hybridlane.devices.default_hybrid.sampled

Implementation of finite-shot measurements in Fock space

Functions

measure_with_shots(measurements, state, shots, ...[, ...])

Perform finite-shot measurements on a given state.

measure_with_diagonalizing_gates(mp, state, shots, ...)

Perform a measurement by diagonalizing the state in the basis of the measurement.

measure_hamiltonian(mp, state, shots, is_state_batched)

Measure a Hamiltonian observable.

sample_state(state, shots, is_state_batched[, wires, ...])

Sample basis states from the given state

Module Contents

hybridlane.devices.default_hybrid.sampled.measure_with_shots(measurements, state, shots, is_state_batched, rng=None, prng_key=None, wire_map=None, mid_measurements=None)[source]

Perform finite-shot measurements on a given state.

Parameters:
  • measurements (Sequence[SampleMeasurement])

  • state (pennylane.typing.TensorLike)

  • shots (Shots)

  • is_state_batched (bool)

  • rng (Any | None)

  • prng_key (Array | None)

  • wire_map (dict | None)

  • mid_measurements (dict | None)

Return type:

list[pennylane.typing.TensorLike]

hybridlane.devices.default_hybrid.sampled.measure_with_diagonalizing_gates(mp, state, shots, is_state_batched, rng=None, prng_key=None, wire_map=None)[source]

Perform a measurement by diagonalizing the state in the basis of the measurement.

Parameters:
  • mp (SampleMeasurement)

  • state (pennylane.typing.TensorLike)

  • shots (Shots)

  • is_state_batched (bool)

  • rng (Any | None)

  • prng_key (Array | None)

  • wire_map (dict | None)

Return type:

list[pennylane.typing.TensorLike]

hybridlane.devices.default_hybrid.sampled.measure_hamiltonian(mp, state, shots, is_state_batched, rng=None, prng_key=None, wire_map=None)[source]

Measure a Hamiltonian observable.

Parameters:
  • mp (ExpectationMP)

  • state (pennylane.typing.TensorLike)

  • shots (Shots)

  • is_state_batched (bool)

  • rng (Any | None)

  • prng_key (Array | None)

  • wire_map (dict | None)

Return type:

list[pennylane.typing.TensorLike]

hybridlane.devices.default_hybrid.sampled.sample_state(state, shots, is_state_batched, wires=None, rng=None, prng_key=None)[source]

Sample basis states from the given state

This returns an array of shape (B, shots, num_wires) if the state is batched, or (shots, num_wires) if the state is not batched.

Parameters:
  • state (pennylane.typing.TensorLike)

  • shots (Shots)

  • is_state_batched (bool)

  • wires (Wires | None)

  • rng (Any | None)

  • prng_key (Array | None)

Return type:

pennylane.typing.TensorLike