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

Defgate matrices should be type np.complex_ #1737

Open
2 tasks
bramathon opened this issue Feb 11, 2024 · 0 comments
Open
2 tasks

Defgate matrices should be type np.complex_ #1737

bramathon opened this issue Feb 11, 2024 · 0 comments
Labels
bug 🐛 An issue that needs fixing.

Comments

@bramathon
Copy link
Contributor

bramathon commented Feb 11, 2024

Pre-Report Checklist

  • I am running the latest versions of pyQuil and the Forest SDK
  • I checked to make sure that this bug has not already been reported

Issue Description

Matrices in DefGates contain complex numbers, but they are stored as objects rather than np.complex128 (or better yet np.complex256). This causes some common numpy operations such as np.real to fail.

How to Reproduce

image

import numpy as np
from pyquil.quilbase import DefGate

theta, phi = rng.random(2)*2*np.pi
defgate = DefGate(f"FSIM_{theta_deg}_{phi_deg}", matrix=matrices.FSIM(theta, phi))
defgate.matrix
@bramathon bramathon added the bug 🐛 An issue that needs fixing. label Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue that needs fixing.
Projects
None yet
Development

No branches or pull requests

1 participant