-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Adding circuits with the same name does not yield a circuit with the same name #5889
Comments
if they have different names (eg |
I don't think adding two circuits should combine names. If I stack together my circuit for an application out of many many small circuits the name would be huge and probably not very meaningful. If you want to preserve the name, could you not instead use qc1.name = 'test'
qc1.compose(qc2, inplace=True) or added = QuantumCircuit(n, name='test')
added.append(qc1, range(n))
added.append(qc2, range(n)) ? |
I agree with @Cryoris. If you create a new circuit, then I don't see any reason why you should favor naming it after the first circuit over the second when doing |
When I add circuits, it is because I want some additional gates from the second circuit to be appended to my main circuit. So it makes sense to me for the sum to have the same name as the first term. I suppose the Nevertheless, I guess we have should some expectation of how and why people will |
Yes, but there is a difference between adding to a circuit
It makes sense, but I would argue that it is pointless. I think that when using |
Let's survey it (non-binding, just to see what's the general feeling): if
|
This is fun. I personally never used qc.name. So for me it doesn't matter. I think a random name is fine. If the user want to keep name 1 or name 2, they can just specify it. Like @boschmitt said, |
So there is more to this then simple issues like naming a new Python class instance. In particular, appending names together gives one an indication of the composite structure of the combined circuit. This information is useful. Going further, this information is critical for building composite circuits where one of the sub-blocks has a known optimal representation, and should not be modified, or perhaps represented as an opaque circuit. I would not use the |
Well there is the metadata attribute on circuits now, we could have |
Yes, that could also work in this case. That would need to be flushed out a bit more to work in the larger context though. |
Agree with @nonhermitian that That said, |
I feel that "If the user want to keep name 1 or name 2, they can just specify it" is a strong argument from @HuangJunye . |
Closing as |
What is the expected enhancement?
When adding two circuits with the same name, I'd expect that name to carry over to the new circuit. But that doesn't happen
Furthermore, for adding circuits without different names, I'd expect the new circuit to have the name of the first one.
In any case, some consistent behaviour beyond the arbitrary generation of a new name would be nice.
The text was updated successfully, but these errors were encountered: