Skip to content
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

[StructuredState] Conflict between apply_scalar and normalisation #106

Open
PabloAndresCQ opened this issue May 9, 2024 · 1 comment
Open
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@PabloAndresCQ
Copy link
Collaborator

The simulation algorithms under StructuredState expect the states are normalised and, in fact whenever there is a truncation, this is enforced. However, the current method apply_scalar allows users to multiply the state by complex numbers with absolute value different to 1. This can lead to bugs when users work with non-normalised states.

As a related issue, the tensors updated by apply_scalar are not currently marked as non-canonicalised. I can't think of a case where the current features would have unexpected behaviour because of this, but there may be edge cases where this also causes a bug.

@PabloAndresCQ PabloAndresCQ added bug Something isn't working documentation Improvements or additions to documentation labels May 9, 2024
@PabloAndresCQ
Copy link
Collaborator Author

I possible solution to both problems is not to apply the scalar directly to the tensor network, but instead keep it in a separate variable (similarly to how pytket.Circuit does it), then take it into account where relevant (e.g. when the user asks for amplitudes or statevector).

Another possibility is to just remove apply_scalar altogether, or replace it by an apply_global_phase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant