Comments (5)
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.
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.
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.
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.
Comment by rumschuettel
Sunday Jan 31, 2016 at 20:52 GMT
Perfect, thanks a lot Dave! :-)
from liquid.
Related Issues (20)
- Generating Circuit Diagram for Shor's Algorithm in Microsoft LIQUi> HOT 2
- Missing Methods HOT 13
- incorrect BitControl QASM output from AltOutput.fs HOT 1
- Hope that Liquid uses lower .NETFramework version for portability HOT 1
- Operation with different kets or the use of more than 24 qubits HOT 4
- Looking for help in compiling the Liquid.sln with VS2017 and windows 10 HOT 2
- Blockchain in QC HOT 1
- Please solve the halting problem :) HOT 2
- Please help me cheat at video games :) HOT 2
- Get FS0193 error when executing fsi --use:Teleport.fsx HOT 3
- Source code of __QLSA HOT 1
- Depolarized and amplitude damping noise in __NoiseAmp() HOT 1
- Memory Issues HOT 2
- Apply gate to second qubit in ket? HOT 2
- CSP Mixed Content error HOT 2
- Behaviour Entanglement HOT 4
- Limited Number of Qubits HOT 3
- LiquidTikz as a standalone library HOT 1
- Some questions about the ensemble computations across the 5 machines
- How to run Liquid on more than one machine?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from liquid.