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

apply method not working properly for gates.GeneralizedRBS #1592

Closed
renatomello opened this issue Feb 17, 2025 · 0 comments · Fixed by #1594
Closed

apply method not working properly for gates.GeneralizedRBS #1592

renatomello opened this issue Feb 17, 2025 · 0 comments · Fixed by #1594
Assignees
Labels
bug Something isn't working
Milestone

Comments

@renatomello
Copy link
Contributor

renatomello commented Feb 17, 2025

As per title. Here is a minimal code to reproduce the bug.

As seen in #1591 , the problem seems to be either in

def apply_gate_string(qubits, nqubits):
or
def prepare_strings(qubits, nqubits):

In [1]: import numpy as np
   ...: 
   ...: from qibo import gates
   ...: from qibo.backends import NumpyBackend
   ...: 
   ...: backend = NumpyBackend()
   ...: 
   ...: gate = gates.GeneralizedRBS([1], [0, 2], 0.1)
   ...: matrix = gate.matrix(backend)
   ...: 
   ...: state = np.array([0, 0, 1, 0, 0, 0, 0, 0], dtype=complex)
   ...: 
   ...: print(matrix @ state)
   ...: print()
   ...: print(gate.apply(backend, state, nqubits=3))
[0.        +0.j 0.        +0.j 0.99500417+0.j 0.        +0.j
 0.        +0.j 0.09983342+0.j 0.        +0.j 0.        +0.j]

[0.+0.j 0.+0.j 1.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j]
@renatomello renatomello added the bug Something isn't working label Feb 17, 2025
@renatomello renatomello added this to the Qibo 0.2.17 milestone Feb 17, 2025
@renatomello renatomello linked a pull request Feb 17, 2025 that will close this issue
4 tasks
@renatomello renatomello linked a pull request Feb 26, 2025 that will close this issue
4 tasks
@renatomello renatomello self-assigned this Feb 26, 2025
@renatomello renatomello removed a link to a pull request Feb 26, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant