Quantum Computing Asked by Antonio Anna Mele on June 25, 2021
How can I make intervals for free parameters when I use VQE function? (https://qiskit.org/documentation/stubs/qiskit.algorithms.VQE.html)
I have built a parametrized ($theta_1,…,theta_n$) circuit without using ansatz in Qiskit Circuit Library and I would like to set e.g. $theta_i in left[0,piright]$.
You can set the attribute parameters_bounds of a circuit to the desired intervals like below:
from qiskit import QuantumCircuit
from qiskit.circuit import Parameter
a=Parameter('a')
b=Parameter('b')
ansatz=QuantumCircuit(2)
ansatz.ry(a,0)
ansatz.ry(b,1)
ansatz.parameter_bounds=[[0,np.pi]]*2
Then you can run your vqe program.
Answered by NABAT on June 25, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP