-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Setting strict=False
in QuantumCircuit.assign_parameters
has no effect
#13933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks Max - I think this might be specific to string inputs? They got added after |
Yes, you are right. Using a from qiskit.circuit import Parameter, QuantumCircuit
qc = QuantumCircuit(2)
a = Parameter("a")
print("Testing assignment by parameter")
qc.assign_parameters({a: 1.0}, strict=False)
print("Testing assignment by string")
qc.assign_parameters({"a": 1.0}, strict=False) Outputs:
I.e. only the last line of the code (with the string-based parameter assignment) fails |
hi @jakelishman |
Hi @jakelishman |
Thanks Kalyan - I'll assign you, and we'll start getting the permissions set up to make you a member of the Qiskit organisation. @Raghav-Bell: sorry, I'd not seen that message before, and now I need to assign the issue internally. Sorry for the lack of response. |
@jakelishman do you expect the argument to be ignored when strict = False, irrespective of whether it is a Parameter type or a string type? A string input is an error anyway right. |
Kalyan: strings are acceptable arguments; they're looked up with |
Environment
What is happening?
Specifying
strict=False
as part of aQuantumCircuit.assign_parameters
call does not ignore provided parameters that do not exist in the circuit (contradicting what the documentation says).Quoting from the docs:
How can we reproduce the issue?
This produces the error:
What should happen?
The error should not occur.
Any suggestions?
The
strict
argument could either be forwarded toQuantumCircuit._unroll_param_dict
here:qiskit/qiskit/circuit/quantumcircuit.py
Line 4267 in b9bdc5a
And then handled inside of that internal method.
The text was updated successfully, but these errors were encountered: