mirror of https://github.com/Qiskit/qiskit.git
23 lines
907 B
YAML
23 lines
907 B
YAML
---
|
|
features:
|
|
- |
|
|
Introduced a new class :class:`~qiskit.circuit.library.StatePreparation`.
|
|
This class allows users to prepare a desired state in the same fashion as
|
|
:class:`~qiskit.extensions.Initialize` without the reset being
|
|
automatically applied.
|
|
|
|
For example, to prepare a qubit in the state :math:`(|0\rangle - |1\rangle) / \sqrt{2}`::
|
|
|
|
import numpy as np
|
|
from qiskit import QuantumCircuit
|
|
|
|
circuit = QuantumCircuit(1)
|
|
circuit.prepare_state([1/np.sqrt(2), -1/np.sqrt(2)], 0)
|
|
circuit.draw()
|
|
|
|
The output is as::
|
|
|
|
┌─────────────────────────────────────┐
|
|
q_0: ┤ State Preparation(0.70711,-0.70711) ├
|
|
└─────────────────────────────────────┘
|