StabilizerState#
- class qiskit.quantum_info.StabilizerState(data, validate=True)[ソース]#
ベースクラス:
QuantumState
StabilizerState class. Stabilizer simulator using the convention from reference [1]. Based on the internal class
Clifford
.from qiskit import QuantumCircuit from qiskit.quantum_info import StabilizerState, Pauli # Bell state generation circuit qc = QuantumCircuit(2) qc.h(0) qc.cx(0, 1) stab = StabilizerState(qc) # Print the StabilizerState print(stab) # Calculate the StabilizerState measurement probabilities dictionary print (stab.probabilities_dict()) # Calculate expectation value of the StabilizerState print (stab.expectation_value(Pauli('ZZ')))
StabilizerState(StabilizerTable: ['+XX', '+ZZ']) {'00': 0.5, '11': 0.5} 1
参照
S. Aaronson, D. Gottesman, Improved Simulation of Stabilizer Circuits, Phys. Rev. A 70, 052328 (2004). arXiv:quant-ph/0406196
Initialize a StabilizerState object.
- パラメータ:
or (data (StabilizerState or Clifford or Pauli or QuantumCircuit) – qiskit.circuit.Instruction): Data from which the stabilizer state can be constructed.
validate (boolean) – validate that the stabilizer state data is a valid Clifford.
Attributes
- clifford#
Return StabilizerState Clifford data
- dim#
Return total state dimension.
- num_qubits#
Return the number of qubits if a N-qubit state or None otherwise.
Methods
- copy()#
Make a copy of current operator.
- dims(qargs=None)#
Return tuple of input dimension for specified subsystems.
- equiv(other)[ソース]#
Return True if the two generating sets generate the same stabilizer group.
- パラメータ:
other (StabilizerState) – another StabilizerState.
- 戻り値:
True if other has a generating set that generates the same StabilizerState.
- 戻り値の型:
- evolve(other, qargs=None)[ソース]#
Evolve a stabilizer state by a Clifford operator.
- パラメータ:
other (Clifford or QuantumCircuit or qiskit.circuit.Instruction) – The Clifford operator to evolve by.
qargs (list) – a list of stabilizer subsystem positions to apply the operator on.
- 戻り値:
the output stabilizer state.
- 戻り値の型:
- 例外:
QiskitError – if other is not a StabilizerState.
QiskitError – if the operator dimension does not match the specified StabilizerState subsystem dimensions.
- expand(other)[ソース]#
Return the tensor product stabilizer state other ⊗ self.
- パラメータ:
other (StabilizerState) – a stabilizer state object.
- 戻り値:
the tensor product operator other ⊗ self.
- 戻り値の型:
- 例外:
QiskitError – if other is not a StabilizerState.
- expectation_value(oper, qargs=None)[ソース]#
Compute the expectation value of a Pauli operator.
- パラメータ:
- 戻り値:
the expectation value (only 0 or 1 or -1 or i or -i).
- 戻り値の型:
- 例外:
QiskitError – if oper is not a Pauli operator.
- measure(qargs=None)[ソース]#
Measure subsystems and return outcome and post-measure state.
Note that this function uses the QuantumStates internal random number generator for sampling the measurement outcome. The RNG seed can be set using the
seed()
method.- パラメータ:
qargs (list or None) – subsystems to sample measurements for, if None sample measurement of all subsystems (Default: None).
- 戻り値:
- the pair
(outcome, state)
whereoutcome
is the measurement outcome string label, and
state
is the collapsed post-measurement stabilizer state for the corresponding outcome.
- the pair
- 戻り値の型:
- probabilities(qargs=None, decimals=None)[ソース]#
Return the subsystem measurement probability vector.
Measurement probabilities are with respect to measurement in the computation (diagonal) basis.
- probabilities_dict(qargs=None, decimals=None)[ソース]#
Return the subsystem measurement probability dictionary.
Measurement probabilities are with respect to measurement in the computation (diagonal) basis.
This dictionary representation uses a Ket-like notation where the dictionary keys are qudit strings for the subsystem basis vectors. If any subsystem has a dimension greater than 10 comma delimiters are inserted between integers so that subsystems can be distinguished.
- パラメータ:
- 戻り値:
The measurement probabilities in dict (ket) form.
- 戻り値の型:
- purity()[ソース]#
Return the purity of the quantum state, which equals to 1, since it is always a pure state.
- 戻り値:
the purity (should equal 1).
- 戻り値の型:
- 例外:
QiskitError – if input is not a StabilizerState.
- reset(qargs=None)[ソース]#
Reset state or subsystems to the 0-state.
- パラメータ:
qargs (list or None) – subsystems to reset, if None all subsystems will be reset to their 0-state (Default: None).
- 戻り値:
the reset state.
- 戻り値の型:
- Additional Information:
If all subsystems are reset this will return the ground state on all subsystems. If only some subsystems are reset this function will perform a measurement on those subsystems and evolve the subsystems so that the collapsed post-measurement states are rotated to the 0-state. The RNG seed for this sampling can be set using the
seed()
method.
- sample_counts(shots, qargs=None)#
Sample a dict of qubit measurement outcomes in the computational basis.
- パラメータ:
- 戻り値:
sampled counts dictionary.
- 戻り値の型:
Additional Information:
This function samples measurement outcomes using the measure
probabilities()
for the current state and qargs. It does not actually implement the measurement so the current state is not modified.The seed for random number generator used for sampling can be set to a fixed value by using the stats
seed()
method.
- sample_memory(shots, qargs=None)[ソース]#
Sample a list of qubit measurement outcomes in the computational basis.
- パラメータ:
- 戻り値:
list of sampled counts if the order sampled.
- 戻り値の型:
np.array
Additional Information:
- seed(value=None)#
Set the seed for the quantum state RNG.
- tensor(other)[ソース]#
Return the tensor product stabilizer state self ⊗ other.
- パラメータ:
other (StabilizerState) – a stabilizer state object.
- 戻り値:
the tensor product operator self ⊗ other.
- 戻り値の型:
- 例外:
QiskitError – if other is not a StabilizerState.
- trace()[ソース]#
Return the trace of the stabilizer state as a density matrix, which equals to 1, since it is always a pure state.
- 戻り値:
the trace (should equal 1).
- 戻り値の型:
- 例外:
QiskitError – if input is not a StabilizerState.