Note
This is the documentation for the current state of the development branch of Qiskit Experiments. The documentation or APIs here can change prior to being released.
LocalPreparationBasis¶
- class LocalPreparationBasis(name, instructions=None, default_states=None, qubit_states=None)[source]¶
Local tensor-product preparation basis.
This basis consists of a set of 1-qubit instructions which are used to define a tensor-product basis on N-qubits.
Initialize a fitter preparation basis.
- Parameters:
name (str) – a name to identify the basis.
instructions (Sequence[Instruction] | None) – list of 1-qubit instructions for preparing states from the \(|0\rangle\) state.
default_states (List[QuantumState] | Dict[Tuple[int, ...], QuantumState] | None) – Optional, default density matrices prepared by the input instructions. If None these will be determined by ideal simulation of the preparation instructions.
qubit_states (Dict[Tuple[int, ...], List[QuantumState] | Dict[Tuple[int, ...], QuantumState]] | None) – Optional, a dict with physical qubit keys and a list of density matrices prepared by the list of basis instructions for a specific qubit. The default states will be used for any qubits not specified in this dict.
- Raises:
QiskitError – If input states or instructions are not valid, or no instructions or states 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.
- Return type:
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, qubits=None)[source]¶
Return the density matrix data array for the index and qubits.
This state is used by tomography fitters for reconstruction and should correspond to the target state for the corresponding preparation
circuit()
.- Parameters:
index (Sequence[int]) – a list of subsystem basis indices.
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 density matrix prepared by the specified index and qubits.