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

Bugfix parameter unpacking in gate_factory #42

Closed
wants to merge 1 commit into from

Conversation

MSRudolph
Copy link

Description

The function would break if the passed parameters are a 1d array. parameter would then be a float.

@roberCO found this bug in z-quantum-core. I thought I once made a PR about this, but apparently it was never merged.

Please verify that you have completed the following steps

  • [yes] I have self-reviewed my code.
  • [no] I have included test cases validating introduced feature/fix.
  • [no] I have updated documentation.

The function would break if the passed parameters are a 1d array. parameter would then be a float.

@roberCO  found this bug in z-quantum-core. I thought I once made a PR about this, but apparently it was never merged.
@AthenaCaesura
Copy link
Contributor

Can we add a test case where the user passes parameters with the wrong shape and ensures that an error is thrown? Just in case we refactor and this check gets deleted for some reason.

@AthenaCaesura
Copy link
Contributor

On second thought, this is not a bug this is a feature. You are supposed to provide an numpy array of parameters when you call this function. Is there a problem with this? If not, then I'm going to close this issue.

@MSRudolph
Copy link
Author

See this PR where it was seen as a bug:
zapatacomputing/z-quantum-core#486

from orquestra.quantum.circuits import Circuit, RX, apply_gate_to_qubits
apply_gate_to_qubits(Circuit(), (0, 1), RX, np.array([1, 2]))

parameters should be a np.ndarray, but when you iterate over its elements, it may break. Am I understanding the purpose of this function incorrectly?

@Boniface316 Boniface316 deleted the bugfix/mr/unpack_1dparameters branch August 15, 2022 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants