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

Fix bug where scalar phase was not conjugated by BaseGraph.adjoint() #230

Merged
merged 5 commits into from
May 31, 2024

Conversation

rafaelha
Copy link
Contributor

Fixes issue #229

@jvdwetering
Copy link
Collaborator

I'm afraid the fix will be a bit more complicated than that. A Scalar has a phase, a list of phasenodes and a floatfactor. To calculate the conjugate of a Scalar, all of these must be conjugated. This is probably best done by a new method in Scalar, conjugate() that does that for you.

@jvdwetering jvdwetering merged commit 851fdf2 into zxcalc:master May 31, 2024
3 checks passed
@jvdwetering
Copy link
Collaborator

Thanks! This is great :)

@@ -176,6 +188,7 @@ def setUp(self):
g.set_outputs((o1, o2))
g.add_edges([(i1,v),(i2,w),(v,w),(v,o1),(w,o2)])
self.i1, self.i2, self.v, self.w, self.o1, self.o2 = i1, i2, v, w, o1, o2
print(self.graph.scalar.to_number())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this a debugging statement which was left in accidentally?

It causes the output of the test to look like this:

..................s............(1+0j)
.(1+0j)
.(1+0j)
.(1+0j)
.........................sssss.............................
----------------------------------------------------------------------
Ran 93 tests in 3.109s

OK (skipped=6)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, yes I left it accidentally. I saw that you already removed it, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants