Instruction.params updates not reflected in definition (if definition already called)
See original GitHub issueInformation
- Qiskit Terra version: master
- Python version: 3.5
- Operating system: osx 10.14
What is the current behavior?
.params
values are fixed in gate definitions the first time ._define
is called, and not updated, even if Instruction.params
changes.
>>> from qiskit.extensions.standard import RZGate
>>> # Create a gate, and check the parameter values in its definition
...
>>> g = RZGate(0.1)
>>> g.definition
[(<qiskit.extensions.standard.u1.U1Gate object at 0x10b181208>, [Qubit(QuantumRegister(1, 'q'), 0)], [])]
>>> g.definition[0][0].params
[0.1]
>>> # Create a gate, change its parameters, then check parameter values in its definition
...
>>> g = RZGate(0.1)
>>> g.params[0] = 0.2
>>> g.definition[0][0].params
[0.2]
>>> # Create a gate, check its definition, updates its params, and see if the update is reflected in the definition
...
>>> g = RZGate(0.1)
>>> g.definition[0][0].params
[0.1]
>>> g.params[0] = 0.2
>>> g.definition[0][0].params
[0.1]
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Use parameters in queries, forms, and reports
This article explains how to use forms in Access to enhance your use of parameters in queries, forms, and reports.
Read more >parameter was not defined" Inserting data - Stack Overflow
Just to provide an answer - because this error is pretty common - here are a few causes: The :parameter name does not...
Read more >Parameters - Looker Studio Help - Google Help
Parameters let you interact with user-provided data. For example, you can create calculated fields that include input from people using your report, ...
Read more >HTTP/1.1: Header Field Definitions
When such a directive appears with a 1#field-name parameter, it applies only to the named field or fields, and not to the rest...
Read more >Manual Jobs - Ex Libris Knowledge Center
Name Content Type (set type) Type
Delete Local Authority Records Authority MMS Withdraw
Export Authority Records Authority MMS Export
Add Bib to Collection Bibliographic title MARC21...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Personally, I’m not convinced
params
should be publically writeable at all. It might be both safer to users and easier for us to handle if gates define setters for mutable attributes. Parameterized gates, for instance, can be bound (or re-bound in future?) to certain values but covering thebind_parameters
path and a direct access seems overcomplicated. ]Still valid. Here’s a cleanup of the example: