Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Conversation

@kuzminrobin
Copy link
Contributor

No description provided.


public override Qubit CreateQubitObject(long id)
{
Debug.Assert(id < 50, "Using a qubit id > 50. This is a full-state simulator! Validating ids uniqueness might start becoming slow.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider keeping it in the full-state simulator.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the SparseSimulator and QuantumSimulator share as much as possible, including the QubitManager, it seems to me easier for the shared code to be the same for both simulators.

Of course I can add a parameter to the constructor of the CommonNativeSimulator, QSimQubitManager, QubitManager, telling
either which simulator has instantiated the QubitManager
or whether the qubit number limitation should be validated,
but that seems to me not worth the effort and not giving much value but obscuring the code.

I can be wrong, I realize that :-). Let me know. For now I would leave as is. Would you still like me to keep it for the QuantumSimulator case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, it doesn't make sense to put this check in the common code. Is there a way to put it in the full state simulator code that's not shared with the sparse simulator? If it is not possible - I approve.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

I double-checked, unfortunately
this function is only called from the code common for QuantumSimulator and SparseSimulator,
and the argument is also calculated in the common code,
and the returned value cannot be easily analyzed by the QuantumSimulator only.

So it seems more efficient to move forward with this change. Can you please actually approve the PR?

@kuzminrobin kuzminrobin force-pushed the kuzminrobin/sparseSimFixTests branch from 4d19213 to c0379af Compare February 18, 2022 19:03
@kuzminrobin kuzminrobin enabled auto-merge (squash) February 18, 2022 19:09
@kuzminrobin kuzminrobin merged commit 221644f into main Feb 18, 2022
@kuzminrobin kuzminrobin deleted the kuzminrobin/sparseSimFixTests branch February 18, 2022 21:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants