-
Notifications
You must be signed in to change notification settings - Fork 4
Example: Preparing abitrary state
Vu Tuan Hai edited this page Apr 10, 2024
·
2 revisions
We aim to prepare the below state:
import numpy as np
from qoop.compilation.qsp import QuantumStatePreparation
This state can be declared by creating a dictionary
# Define the target state
target_state = {
"000": 1 / np.sqrt(2),
"001": 1j / np.sqrt(6),
"010": -1j / np.sqrt(3),
"011": (1 + 1j) / (2 * np.sqrt(2)),
}
Then, use the default prepare() method.
# Run the compiler
compiler = QuantumStatePreparation.prepare(target_state)
# Call and draw circuit U
compiler.u.draw('mpl')
# Plot figure of metric
compiler.plot()
Copyright @ 2024 Hai et al
- Home
- Contribute guideline
- Installation guideline
- Package requirements
- Core
- GA-QAS
- Example
- Advanced