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 rotations #99

Closed
DevelopDaily opened this issue Jan 11, 2021 · 3 comments
Closed

The implementation of rotations #99

DevelopDaily opened this issue Jan 11, 2021 · 3 comments
Labels
mismatch Code doesn't match the expected specs

Comments

@DevelopDaily
Copy link

Here are two QASM files. I expect them to produce the same final states, but they don't. Could you please comment on them?

This file produces the correct state:

OPENQASM 2.0;
include "qelib1.inc";

qreg ctrl[1];
qreg q[1];

x ctrl[0];

h q[0];
rz((pi/4)+(pi/2)) q[0];

Its result is:

>> Final state:
0   0   0.707107   -0.5 + 0.5i

But, this file doesn't.

OPENQASM 2.0;
include "qelib1.inc";

qreg ctrl[1];
qreg q[1];

x ctrl[0];

ch ctrl[0], q[0];
crz((pi/4)+(pi/2)) ctrl[0], q[0];

Its result is:

>> Final state:
0   0   0.270598 - 0.653281i  0.270598 + 0.653281i

Well, it is almost correct -- the probabilities are correct. The phases of the state seem to be wrong.

The second file basically uses the ctrl[0] to control the other qubit. Since the ctrl[0] is 1, the two circuits should be deemed identical.

@vsoftco
Copy link
Member

vsoftco commented Jan 11, 2021

Thanks! Related to #70 , we ended up implementing rz as described in #70, but didn't do this for crz. will modify and document shortly

@vsoftco vsoftco reopened this Jan 11, 2021
@vsoftco
Copy link
Member

vsoftco commented Jan 11, 2021

@DevelopDaily Fixed, please let me know if there are still problems with it.

@DevelopDaily
Copy link
Author

Hooray! Like a charm.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mismatch Code doesn't match the expected specs
Projects
None yet
Development

No branches or pull requests

2 participants