LocalMeasurementBasis#

class LocalMeasurementBasis(name, instructions=None, default_povms=None, qubit_povms=None)[source]#

Local tensor-product measurement basis.

This basis consists of a set of 1-qubit instructions which are used to define a tensor-product basis on N-qubits to rotate a desired multi-qubit measurement basis to the Z-basis measurement.

Initialize a fitter preparation basis.

Parameters:
  • name (str) – a name to identity the basis.

  • instructions (Sequence[Instruction] | None) – list of instructions for rotating a desired measurement basis to the standard \(Z^{\otimes n}\) computational basis measurement.

  • default_povms (Sequence[List[Statevector] | List[DensityMatrix] | QuantumChannel] | None) – Optional, list if positive operators valued measures (POVM) for of the measurement basis instructions. A POVM can be input as a list of effects (Statevector or DensityMatrix) for each possible measurement outcome of that basis, or as a single QuantumChannel. For the channel case the effects will be calculated by evolving the computation basis states by the adjoint of the channel. If None the input instructions will be used as the POVM channel.

  • qubit_povms (Dict[Tuple[int, ...], Sequence[List[Statevector] | List[DensityMatrix] | QuantumChannel]] | None) – Optional, a dict with physical qubit keys and a list of POVMs corresponding to each basis measurement instruction for the specific qubit. The default POVMs will be used for any qubits not specified in this dict.

Raises:

QiskitError – If the input instructions or POVMs are not valid, or if no instructions or POVMs are provided.

Attributes

name#

Return the basis name

Methods

circuit(index, qubits=None)[source]#

Return the basis preparation circuit.

Parameters:
  • index (Sequence[int]) – a list of basis elements to tensor together.

  • qubits (Sequence[int] | None) – Optional, the physical qubit subsystems for the index. If None this will be set to (0, ..., N-1) for a length N index.

Returns:

The logical basis circuit for the specified index and qubits.

Note

This returns a logical circuit on the specified number of qubits and should be remapped to the corresponding physical qubits during experiment transpilation.

index_shape(qubits)[source]#

Return the shape for the specified number of indices.

Parameters:

qubits (Sequence[int]) – the basis subsystems to return the index shape for.

Returns:

The shape of allowed values for the index on the specified qubits.

Return type:

Tuple[int, …]

matrix(index, outcome, qubits=None)[source]#

Return the POVM element for the basis index and outcome.

This POVM element is used by tomography fitters for reconstruction and should correspond to the target measurement effect for the corresponding measurement circuit() and outcome.

Parameters:
  • index (Sequence[int]) – a list of subsystem basis indices.

  • outcome (int) – the composite system measurement outcome.

  • qubits (Sequence[int] | None) – Optional, the physical qubit subsystems for the index. If None this will be set to (0, ..., N-1) for a length N index.

Returns:

The POVM matrix for the specified index and qubits.

matrix_shape(qubits)[source]#

Return the shape of subsystem dimensions of a POVM matrix.

Parameters:

qubits (Sequence[int]) – the physical qubit subsystems.

Returns:

A tuple of subsystem dimensions for the specified qubits.

Return type:

Tuple[int, …]

outcome_shape(qubits)[source]#

Return the shape of allowed measurement outcomes on specified qubits.

Parameters:

qubits (Sequence[int]) – the physical qubit subsystems.

Returns:

A tuple of the number of measurement outcomes for specified qubits.

Return type:

Tuple[int, …]