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 implementation of bogoliubov for a general fermionic gaussian that doesn't mix spin up and spin down is broken #776

Open
wjhuggins opened this issue Apr 13, 2022 · 1 comment
Labels

Comments

@wjhuggins
Copy link

When bogoliubov_transform is called with a transformation_matrix that has shape N x 2N the check that determines whether or not the transformation mixes spin up and spin down and the subsequent code is broken. The current check (_is_spin_block_diagonal) and some of the subsequent code is only valid for a square transformation_matrix.

To reproduce:

Call bogoliubov_transform with the following arguments:
qubits = [cirq.LineQubit(0), cirq.LineQubit(1)]
trasformation_matrix = np.ndarray([[-9.57167901e-01-2.89533435e-01j, 0.00000000e+00+0.00000000e+00j,
-3.33066907e-16-5.55111512e-17j, 0.00000000e+00+0.00000000e+00j],
[ 0.00000000e+00+0.00000000e+00j, 1.00000000e+00+0.00000000e+00j,
0.00000000e+00+0.00000000e+00j, 0.00000000e+00+0.00000000e+00j]])

@wjhuggins
Copy link
Author

It can be circumvented by adding the following code to _is_spin_block_diagonal(matrix)
if matrix.shape[0] != matrix.shape[1]:
return False

It should be possible to implement properly for a general fermionic gaussian transformation though.

@fdmalone fdmalone added the bug label Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants