You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The simulation algorithms under
StructuredState
expect the states are normalised and, in fact whenever there is a truncation, this is enforced. However, the current methodapply_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.The text was updated successfully, but these errors were encountered: