StationQ / Liquid

The Language-Integrated Quantum Operations (LIQUi|>) Simulator
http://StationQ.github.io/Liquid
Other
440 stars 97 forks source link

Access circuit output probabilities #37

Closed dhangleiter closed 7 years ago

dhangleiter commented 7 years ago

Hi,

I am new to both Liquid and F# and want to write a very simple code that brute-force simulates a quantum circuit on n qubits. Eventually I want to access all output probabilities of the form |<0| C | x>|^2 where x runs over all 2^n configurations of the qubits.

Is there a simple way to access these at once (for example, simply by accessing all amplitudes of C |0>)? How would I write this list to a file?

Thanks and Cheers, Dominik

dhangleiter commented 7 years ago

Hi again, I figured out how to access the output probabilities myself. Now I run into a new problem though:

When executing

let probs (k:Ket) :float[]  = k.Probs qs
let ps = probs k 

Liquid returns the following error in the log file. It seems as if Probs doesn't allow me to access output probabilities of qubit lists that are longer than 10. Is there a way to get around that? Thanks anc Cheers !

0:0000.0/ Doing columns: 0 - 24 0:0000.0/ Doing columns: 24 - 47 0:0000.0/Error running function RunCircuit(12,1): Exception has been thrown by the target of an invocation. 0:0000.0/Inner: Probs: Qubit list must be no more than 10 in length 0:0000.0/Error occured at Invoke 0:0000.0/!!!!!!!!!!!!!!!!!!!!!! Stack Trace !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 0:0000.0/ at ad.c (System.String A_0) [0x0023c] 0:0000.0/ in <16e8952738114e09bd59d5cb36925823>:0 0:0000.0/ at Microsoft.Research.Liquid.Parser.CommandRun (Microsoft.Research.Liquid.LiquidArgs las) [0x000c4] 0:0000.0/ in <16e8952738114e09bd59d5cb36925823>:0 0:0000.0/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 0:0000.0/!!! ERROR: Exiting Liquid 0:0000.0/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

dbwz8 commented 7 years ago

Please note that the error states:

Probs: Qubit list must be no more than 10 in length

We don't allow more than 10 joint probabilities (1,024) because the computations get unwieldy. Sorry, but it's a limitation of the academic version (at this time). Individual probabilities (and any combination of up to 10) can of course be done easily.