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

The Qmat functions is off by a complex conjugate #318

Open
1 task done
nquesada opened this issue Jan 13, 2022 · 0 comments
Open
1 task done

The Qmat functions is off by a complex conjugate #318

nquesada opened this issue Jan 13, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@nquesada
Copy link
Collaborator

nquesada commented Jan 13, 2022

Before posting a bug report

  • I have searched exisisting GitHub issues to make sure the issue does not already exist.

Expected behavior

from thewalrus.random import random_covariance
from thewalrus.quantum import Qmat
def rmat(l, hbar=2):
    """
    This is the R matrix in https://the-walrus.readthedocs.io/en/latest/gbs.html
    """
    idl = np.identity(l)/np.sqrt(2*hbar)
    return np.block([[idl, 1j*idl],[idl, -1j*idl]])

cov = random_covariance(m)
Q = Qmat(cov)
rr = rmat(m)
Qp = rr @ cov @ (rr.T.conj()) + np.identity(len(cov))*0.5
print(np.allclose(Q, Qp)) # Comes out to be False

Actual behavior

from thewalrus.random import random_covariance
from thewalrus.quantum import Qmat
def rmat(l, hbar=2):
    """
    This is the R matrix in https://the-walrus.readthedocs.io/en/latest/gbs.html
    """
    idl = np.identity(l)/np.sqrt(2*hbar)
    return np.block([[idl, 1j*idl],[idl, -1j*idl]])

cov = random_covariance(m)
Q = Qmat(cov)
rr = rmat(m)
Qp = rr @ cov @ (rr.T.conj()) + np.identity(len(cov))*0.5
print(np.allclose(Q, Qp.conj())) # Comes out to be True

Reproduces how often

Always

System information

Linux

Source code

No response

Tracebacks

No response

Additional information

No response

@nquesada nquesada added the bug Something isn't working label Jan 13, 2022
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

No branches or pull requests

1 participant