Coder Social home page Coder Social logo

[CLOSED] Hamiltonian Gates about liquid HOT 5 CLOSED

stationq avatar stationq commented on September 2, 2024
[CLOSED] Hamiltonian Gates

from liquid.

Comments (5)

dbwz8 avatar dbwz8 commented on September 2, 2024

Comment by dbwz8
Sunday Jan 31, 2016 at 01:00 GMT


This isn't really supported... but if you do a non-unitary gate, you will need to normalize the state vector yourself. First call let vec = ket.Single() which will pull any separate pieces of your state vector (ket) together into a single one and more importantly, will give you a handle to the actual state vector instance (vec). Then you can normalize it with vec.Normalize(). No guarantees, but I'd try this first and see if it gives you what you want.

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 ;)

from liquid.

dbwz8 avatar dbwz8 commented on September 2, 2024

Comment by dbwz8
Sunday Jan 31, 2016 at 20:11 GMT


Actually, why can't you just use a joint measurement gate (Liquid.chm/Operations/JM)? If you call JM "" "XYZ" qs, this will do a joint measurement where the first qubit is measured in X, the second in Y and the third in Z (any number of qubits and combinations of X,Y and Z). For example:

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).

from liquid.

dbwz8 avatar dbwz8 commented on September 2, 2024

Comment by rumschuettel
Sunday Jan 31, 2016 at 20:18 GMT


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 >.
If I simply measure the qubit in, say, the Z direction, that would force the state to collapse to either | 0 > or | 1 > . I guess that means I'd have to create measurement statistics and throw away the ones with | 1 >?

Thanks for the reply btw!

from liquid.

dbwz8 avatar dbwz8 commented on September 2, 2024

Comment by dbwz8
Sunday Jan 31, 2016 at 20:25 GMT


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 ket.Prob1(qubit), which will return the probability of measuring a 1 if you had done a measurement at this point. If you need all joint probabilities, you can just call the ket.Probs(qubits) routine with up to 10 qubits and then read off the probabilities of all possible measurement results. Both of these are non-destructive.

from liquid.

dbwz8 avatar dbwz8 commented on September 2, 2024

Comment by rumschuettel
Sunday Jan 31, 2016 at 20:52 GMT


Perfect, thanks a lot Dave! :-)

from liquid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.