-
Notifications
You must be signed in to change notification settings - Fork 97
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
[CLOSED] Hamiltonian Gates #9
Comments
Comment by dbwz8 This isn't really supported... but if you do a non-unitary gate, you will need to normalize the state vector yourself. First call Note that this will only work in function mode. If you compile to a circuit (Circuit.Compile) you will have no way to do the normalization (not strictly true... but let's first try to get it working the simple way ;) |
Comment by dbwz8 Actually, why can't you just use a joint measurement gate (Liquid.chm/Operations/JM)? If you call JMz "3qs" !!(qs,1,3,4) will do a joint Z basis measurement on qubits 1, 3 and 4. This will do the projection correctly (and keep everything normalized). As an added bonus... now there's no restriction on building circuits and drawing/optimizing them. The first string can be any tag that you'd like to see in the drawing. The actual gate name for the example above would be JMz_{3qs} (JMz with a subscript of your tag). |
Comment by rumschuettel Good idea, but I don't think that would achieve what I'm trying to do. Assume I'm only simulating one qubit, and the 1-local interaction on it is something like H = | 1 >< 1 |, i.e. a projector on 1. Then the ground state of H as simulated by Spin.Test should be | 0 >. Thanks for the reply btw! |
Comment by dbwz8 I agree. What you're doing (for what you want) is probably the best way. The other thing you could do is to just get the complex state vector (with ket.Single()) and then do whatever math you like on it (since you're probably going to throw it away at that point anyway). One other thing to mention... if you don't want to destroy the state vector (and have it correctly normalized), you can always do a |
Comment by rumschuettel Perfect, thanks a lot Dave! :-) |
Issue by rumschuettel
Saturday Jan 30, 2016 at 13:42 GMT
Originally opened as https://github.com/msr-quarc/Liquid/issues/9
Hi! Brief question: in Hamiltonian mode, one can use gates such as ZR or ZZR to couple spins. What if I want to use a coupling that's Hermitian but not necessarily unitary, e.g. a projector? I tried creating a projector on |11> for the first 2 qubits out of 4 by defining a custom gate with a diagonal matrix with 1s in the corresponding entry and 0 everywhere, which is not unitary - the simulation somewhat works, but the normalization is now totally off:
0:0000.0/Ket of 4 qubits: 0:0000.0/=== KetPart[ 0]: 0:0000.0/Qubits (High to Low): 0 1 2 3 0:0000.0/0x00000000: 2.1601667977e-05 0:0000.0/0x00000001: 2.1601667977e-05 0:0000.0/0x00000002: 2.1601667977e-05 0:0000.0/0x00000003: 2.1601667977e-05 0:0000.0/0x00000004: 1.14743224743e-05 0:0000.0/0x00000005: 1.14743224743e-05 0:0000.0/0x00000006: 1.14743224743e-05 0:0000.0/0x00000007: 1.14743224743e-05 0:0000.0/0x00000008: 1.14743224743e-05 0:0000.0/0x00000009: 1.14743224743e-05 0:0000.0/0x0000000a: 1.14743224743e-05 0:0000.0/0x0000000b: 1.14743224743e-05 0:0000.0/0x0000000c: 1.48433500775e-10 0:0000.0/0x0000000d: 1.48433500775e-10 0:0000.0/0x0000000e: 1.48433500775e-10 0:0000.0/0x0000000f: 1.48433500775e-10
So one can see that indeed the states with 1100, 1101, 1110 and 1111 have the least amplitude (as expected), but the overall probabilities don't add up to 1.
Any hint would be appreciated.
Thanks!
J.
The text was updated successfully, but these errors were encountered: