StationQ / Liquid

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

[CLOSED] Are there any source codes about some examples? #7

Closed dbwz8 closed 8 years ago

dbwz8 commented 8 years ago

Issue by klinus9542 Friday Jan 08, 2016 at 00:04 GMT Originally opened as https://github.com/msr-quarc/Liquid/issues/7


Are there any source codes about Fourier transform, phase estimation or other algorithms?

I am a student from UTS in Australia. I am now doing research of quantum computation. During the last months, I have used Liquid as my research tools to stimulate some ideas about Groover's search algorithm and quantum secret sharing telecommunication. It is interesting and very useful. However, when I want to code to verify basic quantum algorithms, for example quantum Fourier transform , phase estimation and order-finding, I find that your team have made Shor's factoring algorithm as inherent function. Then I regard that your team must have coded order-finding and reverse quantum Fourier transform successfully because it is an essential part of Shor's algorithm. I have tried my best to explorer the whole resource to find source code. Unfortunately, I can Not find any details about them. Is it possible to share some basic quantum algorithms source codes? In addition, more source codes would improve deep understanding of CHM file, brochure of LIQUid. The classes in Microsoft.Research.Liquid Namespace also have some unclear methods and properties. Thus given some advanced source examples, we also can make them clear and use them in other algorithms. Furthermore, a specific license, such as GNU or MPL, is an indivisible part of this platform. That often means how much time we should spend in studying this platform.

The version of .net framework and F# which is needed by LIQUid also are not very clear. With the rapid develop of VS, I think it would cost more and more time to test the correct version. If working environment is declared on User's Manual, it would be highly appreciated.

Thank you for your attention. Thank you for your LIQUid.

Shusen Liu (klinus 'at' outlook.com or Shusen.liu 'at' student.uts.edu.au) 08 Jan, 2016

dbwz8 commented 8 years ago

Comment by dbwz8 Friday Jan 08, 2016 at 20:57 GMT


Since this is an academic release, one of the main desires was not to give out sources to many of the circuits. Instead we've included examples that show what you can do with the simulator (but not necessarily how to do it... on purpose). I will help out by stating that almost everything implemented in the Shor example comes from the Beauregard Paper. This includes both the QFT and the Phase Estimation used.

I don't understand the license question. There is a very specific license available on this site.

The documentation specifies that using VS2015 Community Edition will give you the correct version of the .Net Framework (so there isn't really any "choice to make"). The specific version used is F# 4.0 built on the .Net Framework v4.6.1

Having said all that, I think one complete example of a basic circuit would be a good idea (to show how all the various pieces go together). What follows is the complete definition of QFT used in Shor. It will do an N qubit QFT (based on the length of the list of qubits it is handed). It defines the QFT as a primitive gate that can be rendered at various levels of detail and is a good example of how to write a new "gate" in LIQUi|>:

/// <summary>
/// Take QFT
/// </summary>
/// <param name="qs">Qubits to take QFT of</param>
let QFT (qs:Qubits) =
    let gate (qs:Qubits)    =
        let op (qs:Qubits) =
            let n   = qs.Length
            for aIdx in n-1..-1..0 do
                let a   = qs.[aIdx]
                H [a]
                for k in 2..aIdx+1 do
                    let c   = qs.[aIdx-(k-1)]
                    CR k [c;a]
        Gate.Build("QFT_" + qs.Length.ToString() ,fun () ->
            new Gate(
                Qubits  = qs.Length,
                Name    = "QFT",
                Help    = "QFT",
                Draw    = sprintf "\\multigate{#%d}{QFT}" (qs.Length-1),
                Op      = WrapOp op
        ))
    (gate qs).Run qs

A high level render look like this:

image

and a low level one, like this:

image

I'll leave this issue open for a while in case I missed something in your request.

dbwz8 commented 8 years ago

Comment by klinus9542 Sunday Jan 10, 2016 at 22:54 GMT


Dbwz8, Thank you for your response.

Your answer is clear and make sense of my question. Thus I have a clear routine about the application of LIQUid.

The distribution license question is about how much we can use the LIQUid. For example, If one software is under "GNU General Public License", It often guarantees end users the freedoms to run, study, share (copy), and modify the software. Analogically, LIQUid catalog includes a VS project "Liquid.sln" which can produce a self-included "LIQUid.exe". The executable file includes the Common Intermediate Language(IL) which produced by your team "QuArc" and some features and modules which are added by users' code. When considering the new "LIQUid.exe", we may feel confusing about the owner's right. Can we decompile the new "LIQUid.exe" to find some evidences about circuit optimization? Furthermore, can we call the new executable file with new module "Our work" when we want to make a set of toolkit of LIQUid? It is indefinite without a distribution license. Thus, if you can make it clear, we would be highly inspired to use it more innovation.

Thank you for you QFT circuit. I could learn a lot from this, the more complex circuit.

Thank you for your answers.

dbwz8 commented 8 years ago

Comment by dbwz8 Monday Jan 11, 2016 at 00:30 GMT


The licensing is described very explicitly in the license.md file on this site. Your example of decompiling is not allowed. However... there should be no need. Any circuit you create and optimize can be dumped and rendered directly by the software, so there's no problem in learning what the system has done. In addition, any new circuits written by you are of course owned by you and we encourage the sharing of new software layered on LIQUi|> by the community. This software is meant for academic use and as such we would love to see examples/projects posted here that others can leverage/use. The main restriction is the use of LIQUi|> for commercial purposes.

I should also mention that we've just announced the intention to run a Quantum Challenge using LIQUi|> for academic projects (including a chance to intern with the QuArC team in Redmond). More details will be forthcoming on the referenced site.

dbwz8 commented 8 years ago

Comment by redjbishop Monday Jan 11, 2016 at 00:31 GMT


From: Dave Wecker [mailto:notifications@github.com] Sent: Sunday, January 10, 2016 4:31 PM To: msr-quarc/Liquid Liquid@noreply.github.com Subject: Re: [Liquid] Are there any source codes about some examples? (#7)

Closed #7https://github.com/msr-quarc/Liquid/issues/7.

— Reply to this email directly or view it on GitHubhttps://github.com/msr-quarc/Liquid/issues/7#event-510638805.