[bugfix] Default value of chi causes an error when state is copied #93
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Users can only choose whether to use a bounded
chi
or a boundedtruncation_fidelity
when using simulation methods fromstructured_state
. If both are bounded by the user, an error is raised.However, internally, both of these are set to some default value when the user does not bound them. This caused the "user error" to be raised when copying a state with
truncation_fidelity
bounded by the user, because the initialiser of the copy would interpret that the default value ofchi
was also specified by the user. The fix I went for is to check whether the value ofchi
is the default one, before raising the error (something that was already done fortruncation_fidelity
.Checklist