yvdriess / mcc

Compiles a quantum computation in the form of Measurement Calculus command sequences and generates C++ code using intel Cnc
8 stars 2 forks source link

Q operator and N operator #3

Open TheFausap opened 10 years ago

TheFausap commented 10 years ago

Hello,

sorry if I bother you, but in several examples I found there's a reference to Q operator, besides of those called E, M, X, Z. Also, in some papers available on Internet, I found the N operator, but it seems not present in mcc.

Is there a paper describing all of them... are they somewhat standardized ?

thanks, Fausto

yvdriess commented 10 years ago

Hello,

No problem, I’m glad someone is looking at my previous research.

The Q in my MC program notation is not an operator, but refers to the qubit signal: the measurement result of the given qubit.

In the original Measurement Calculus paper by Danos et al. ’s’ or ’t’ were used with the qubit name as subscript. In earlier examples, I used (s 4) to denote s_4 in the original notation, for example. I changed this to (q 4) because it makes more sense to a computer scientists.

There is an early paper which formalises the syntax and operational semantics, see section 5.4.1 in : [1] E. D'Hondt and Y. Vandriessche, “Distributed quantum programming,” Nat Comput, vol. 10, no. 4, pp. 1313–1343, Dec. 2011.

If you feel like diving into the deep end, you can find a very detailed description in my phd thesis:

• A foundation for quantum programming and its highly-parallel virtual execution Yves Vandriessche, 2012

PS. The purpose of mcc was to demonstrate the parallel decomposition into dataflow of the MC simulation. If you are interested in a more practical/faster implementation of the same quantum virtual machine, check out the master or openmp branch of: https://github.com/yvdriess/qvm

On 09 Sep 2014, at 17:07, Fausto Saporito notifications@github.com wrote:

Hello,

sorry if I bother you, but in several examples I found there's a reference to Q operator, besides of those called E, M, X, Z. Also, in some papers available on Internet, I found the N operator, but it seems not present in mcc.

Is there a paper describing all of them... are they somewhat standardized ?

thanks, Fausto

— Reply to this email directly or view it on GitHub.

TheFausap commented 10 years ago

Hello Yves,

2014-09-09 19:44 GMT+02:00 Yves Vandriessche notifications@github.com:

Hello,

No problem, I'm glad someone is looking at my previous research.

The Q in my MC program notation is not an operator, but refers to the qubit signal: the measurement result of the given qubit.

In the original Measurement Calculus paper by Danos et al. 's' or 't' were used with the qubit name as subscript. In earlier examples, I used (s 4) to denote s_4 in the original notation, for example. I changed this to (q 4) because it makes more sense to a computer scientists.

ok. I understood.

There is an early paper which formalises the syntax and operational semantics, see section 5.4.1 in : [1] E. D'Hondt and Y. Vandriessche, "Distributed quantum programming," Nat Comput, vol. 10, no. 4, pp. 1313-1343, Dec. 2011.

thanks a lot! this is very interesting document.

If you feel like diving into the deep end, you can find a very detailed description in my phd thesis:

  • A foundation for quantum programming and its highly-parallel virtual execution Yves Vandriessche, 2012

ok. I'll start to read it later.

PS. The purpose of mcc was to demonstrate the parallel decomposition into dataflow of the MC simulation. If you are interested in a more practical/faster implementation of the same quantum virtual machine, check out the master or openmp branch of: https://github.com/yvdriess/qvm

thanks again. I'll checkout this one. I was intrigued about mcc compiler written in common lisp :-)

regards, Fausto

yvdriess commented 10 years ago

On 10 Sep 2014, at 01:26, Fausto Saporito notifications@github.com wrote:

Hello Yves,

2014-09-09 19:44 GMT+02:00 Yves Vandriessche notifications@github.com:

Hello,

No problem, I'm glad someone is looking at my previous research.

The Q in my MC program notation is not an operator, but refers to the qubit signal: the measurement result of the given qubit.

In the original Measurement Calculus paper by Danos et al. 's' or 't' were used with the qubit name as subscript. In earlier examples, I used (s 4) to denote s_4 in the original notation, for example. I changed this to (q 4) because it makes more sense to a computer scientists.

ok. I understood.

There is an early paper which formalises the syntax and operational semantics, see section 5.4.1 in : [1] E. D'Hondt and Y. Vandriessche, "Distributed quantum programming," Nat Comput, vol. 10, no. 4, pp. 1313-1343, Dec. 2011.

thanks a lot! this is very interesting document.

If you feel like diving into the deep end, you can find a very detailed description in my phd thesis:

  • A foundation for quantum programming and its highly-parallel virtual execution Yves Vandriessche, 2012

ok. I'll start to read it later.

PS. The purpose of mcc was to demonstrate the parallel decomposition into dataflow of the MC simulation. If you are interested in a more practical/faster implementation of the same quantum virtual machine, check out the master or openmp branch of: https://github.com/yvdriess/qvm

thanks again. I'll checkout this one. I was intrigued about mcc compiler written in common lisp :-)

There was also an IDE + framework written in Lispworks (which has a great IDE framework), but avoided open-sourcing that part due to possible licensing issues.

regards, Fausto — Reply to this email directly or view it on GitHub.

TheFausap commented 9 years ago

Hello

Yves, is it possible to have the source of that IDE? I'm using Lispworks for my LISP development, so I'd like to try it if it's possible.

thanks, Fausto

2014-09-10 11:18 GMT+02:00 Yves Vandriessche notifications@github.com:

On 10 Sep 2014, at 01:26, Fausto Saporito notifications@github.com wrote:

Hello Yves,

2014-09-09 19:44 GMT+02:00 Yves Vandriessche notifications@github.com:

Hello,

No problem, I'm glad someone is looking at my previous research.

The Q in my MC program notation is not an operator, but refers to the qubit signal: the measurement result of the given qubit.

In the original Measurement Calculus paper by Danos et al. 's' or 't' were used with the qubit name as subscript. In earlier examples, I used (s 4) to denote s_4 in the original notation, for example. I changed this to (q 4) because it makes more sense to a computer scientists.

ok. I understood.

There is an early paper which formalises the syntax and operational semantics, see section 5.4.1 in : [1] E. D'Hondt and Y. Vandriessche, "Distributed quantum programming," Nat Comput, vol. 10, no. 4, pp. 1313-1343, Dec. 2011.

thanks a lot! this is very interesting document.

If you feel like diving into the deep end, you can find a very detailed description in my phd thesis:

  • A foundation for quantum programming and its highly-parallel virtual execution Yves Vandriessche, 2012

ok. I'll start to read it later.

PS. The purpose of mcc was to demonstrate the parallel decomposition into dataflow of the MC simulation. If you are interested in a more practical/faster implementation of the same quantum virtual machine, check out the master or openmp branch of: https://github.com/yvdriess/qvm

thanks again. I'll checkout this one. I was intrigued about mcc compiler written in common lisp :-)

There was also an IDE + framework written in Lispworks (which has a great IDE framework), but avoided open-sourcing that part due to possible licensing issues.

regards,

Fausto

Reply to this email directly or view it on GitHub.

Reply to this email directly or view it on GitHub https://github.com/yvdriess/mcc/issues/3#issuecomment-55090231.

yvdriess commented 9 years ago

Hello,

Here you go. I do give this completely as-is. The asdf version is probably outdated and I really hope CAPI hasn’t changed :p

On 21 Oct 2014, at 17:57, Fausto Saporito notifications@github.com wrote:

Hello

Yves, is it possible to have the source of that IDE? I'm using Lispworks for my LISP development, so I'd like to try it if it's possible.

thanks, Fausto

2014-09-10 11:18 GMT+02:00 Yves Vandriessche notifications@github.com:

On 10 Sep 2014, at 01:26, Fausto Saporito notifications@github.com wrote:

Hello Yves,

2014-09-09 19:44 GMT+02:00 Yves Vandriessche notifications@github.com:

Hello,

No problem, I'm glad someone is looking at my previous research.

The Q in my MC program notation is not an operator, but refers to the qubit signal: the measurement result of the given qubit.

In the original Measurement Calculus paper by Danos et al. 's' or 't' were used with the qubit name as subscript. In earlier examples, I used (s 4) to denote s_4 in the original notation, for example. I changed this to (q 4) because it makes more sense to a computer scientists.

ok. I understood.

There is an early paper which formalises the syntax and operational semantics, see section 5.4.1 in : [1] E. D'Hondt and Y. Vandriessche, "Distributed quantum programming," Nat Comput, vol. 10, no. 4, pp. 1313-1343, Dec. 2011.

thanks a lot! this is very interesting document.

If you feel like diving into the deep end, you can find a very detailed description in my phd thesis:

  • A foundation for quantum programming and its highly-parallel virtual execution Yves Vandriessche, 2012

ok. I'll start to read it later.

PS. The purpose of mcc was to demonstrate the parallel decomposition into dataflow of the MC simulation. If you are interested in a more practical/faster implementation of the same quantum virtual machine, check out the master or openmp branch of: https://github.com/yvdriess/qvm

thanks again. I'll checkout this one. I was intrigued about mcc compiler written in common lisp :-)

There was also an IDE + framework written in Lispworks (which has a great IDE framework), but avoided open-sourcing that part due to possible licensing issues.

regards,

Fausto

Reply to this email directly or view it on GitHub.

Reply to this email directly or view it on GitHub https://github.com/yvdriess/mcc/issues/3#issuecomment-55090231.

— Reply to this email directly or view it on GitHub.

TheFausap commented 8 years ago

Hello Yves,

I'm trying the qvm version of mcc, but I don't understand a result of this simple code:

"((E 1 2) (M 1 0) (X 2 (q 1)))"

this is the Hadamard gate applied to 1 qubit (|0> + |1>), correct ? But the result is :

1.000000 +0.000000i|0> (1.000000e+00) (|0>)

why ?

Sorry for the stupid question, but if you could explain me this result, I'd appreciate it very much.

thanks, Fausto

yvdriess commented 8 years ago

Hello Fausto,

I'll be glad to help, although this has been a while for me :)

Short answer: the measurement calculus, which QVM implements, works in the +/- basis, rather than the 0/1 basis. I think you were expecting H|0> = |+>, but the above snippet realizes and H|+> = |0>.

Long answer:

The QVM's operations are an implementation of the measurement calculus by Danos et al. (arxiv version can be found here: http://arxiv.org/pdf/0704.1263v1.pdf) You can find a lot more detailed explanations of why and how there. The big differences with their notation and my QVM syntax is that I implicitely create qubits when needed and that I read operations from left-to-right as usual in computer science, instead of right-to-left in matrix algebra.

The Measurement Calculus uses the 'one way quantum computing model', which is very differently from the typical circuit model. Instead of starting with a bunch of isolated qubits, then applying unitary gates and finally doing measurement; the one-way model starts with a large amounts of entangled qubits and evolves the quantum state by applying measurements. For various reasons, the measurement calculus represents qubits in the in the diagonal basis |+>/|-> ( |+> = (|0> + |1>)/sqrt(2) and |-> = (|0> - |1>)/sqrt(2)); this basis is completely equivalent to the more traditional |0>/|1> basis. The hadamard gate is realized in a typical circuit model by

To break down the example, reading left to right (mind, the Danos et al. paper reads operators from right to left). (E 1 2) --> qubits 1 and 2 have not been encountered yet, so two qubits in the |+> state are created and appended to the quantum state: |+>_1 tensor |+>_2 (initial quantum state is empty) note that qubits are created in the diagonal + state, not as |0> or |1> as typical in the circuit model --> the 'E' operator is applied, which is the entanglement operator CZ (controlled-Z, similar to the controlled-X), creating a superposition of the two qubits. (M 1 0) --> the syntax of the measurement operator M is (M

), where angle is the measurement angle. As mentioned, measurement is performed in the +/- basis. --> This measurement has two effects. On the quantum state, it destroys the first qubit (projects the two-qubit space onto a one-qubit space), modifying the quantum state of the second qubit in the process. The second effect is that the result of the measurement is 'remembered' as a classical 0/1 bit. (X 2 (q 1)) --> The syntax of the X operator (the usual X gate) is (X ). The signal is a classical control: if it is evaluates to 0, the X operation is not performed. If the signal is 1, the operation is performed. In this case, the signal is (q 1), meaning "look up what the result of measuring qubit-1 was". In other words, X is performed on qubit-2, depending on the measurement result of qubit-1. Tracking the quantum state in the |0>/|1> basis (as qvm reports), we thus start with qubit 1 and 2 in |0>+|1> state, entangle them with a controlled-Z unitary, measure them in the +/- basis and then compensate for the non-deterministic result of the measurement by either flipping a |1> result to |0>, or keeping |0> as |0>. Treating qubit 1 as the 'input' qubit here and qubit 2 as output, we went from a |+> input to |0> output, realizing H|+> => |0> I describe this example a bit better in chapter 2 of my thesis: http://soft.vub.ac.be/Publications/2012/vub-soft-phd-12-05.pdf Hope this helps, -Yves On Tue, Feb 23, 2016 at 3:32 PM, Fausto Saporito notifications@github.com wrote: > Hello Yves, > > I'm trying the qvm version of mcc, but I don't understand a result of this > simple code: > > "((E 1 2) (M 1 0) (X 2 (q 1)))" > > this is the Hadamard gate applied to 1 qubit (|0> + |1>), correct ? > But the result is : > > 1.000000 +0.000000i|0> (1.000000e+00) (|0>) > > why ? > > Sorry for the stupid question, but if you could explain me this result, > I'd appreciate it very much. > > thanks, > Fausto > > — > Reply to this email directly or view it on GitHub > https://github.com/yvdriess/mcc/issues/3#issuecomment-187720724.
TheFausap commented 8 years ago

Hello Yves,

great explanation ! thanks a lot, now it's perfectly clear to me.

I really was expecting to evaluate H|0> not H|+> :)

I understood the non-input qubits are always in the state |+>, but is it possible, for the input qubit, use a specific state ?

thanks, fausto

2016-02-23 16:27 GMT+01:00 Yves Vandriessche notifications@github.com:

Hello Fausto,

I'll be glad to help, although this has been a while for me :)

Short answer: the measurement calculus, which QVM implements, works in the +/- basis, rather than the 0/1 basis. I think you were expecting H|0> = |+>, but the above snippet realizes and H|+> = |0>.

Long answer:

The QVM's operations are an implementation of the measurement calculus by Danos et al. (arxiv version can be found here: http://arxiv.org/pdf/0704.1263v1.pdf) You can find a lot more detailed explanations of why and how there. The big differences with their notation and my QVM syntax is that I implicitely create qubits when needed and that I read operations from left-to-right as usual in computer science, instead of right-to-left in matrix algebra.

The Measurement Calculus uses the 'one way quantum computing model', which is very differently from the typical circuit model. Instead of starting with a bunch of isolated qubits, then applying unitary gates and finally doing measurement; the one-way model starts with a large amounts of entangled qubits and evolves the quantum state by applying measurements. For various reasons, the measurement calculus represents qubits in the in the diagonal basis |+>/|-> ( |+> = (|0> + |1>)/sqrt(2) and |-> = (|0> - |1>)/sqrt(2)); this basis is completely equivalent to the more traditional |0>/|1> basis. The hadamard gate is realized in a typical circuit model by

To break down the example, reading left to right (mind, the Danos et al. paper reads operators from right to left). (E 1 2) --> qubits 1 and 2 have not been encountered yet, so two qubits in the |+> state are created and appended to the quantum state: |+>_1 tensor |+>_2 (initial quantum state is empty) note that qubits are created in the diagonal + state, not as |0> or |1> as typical in the circuit model --> the 'E' operator is applied, which is the entanglement operator CZ (controlled-Z, similar to the controlled-X), creating a superposition of the two qubits. (M 1 0) --> the syntax of the measurement operator M is (M

), where angle is the measurement angle. As mentioned, measurement is performed in the +/- basis. --> This measurement has two effects. On the quantum state, it destroys the first qubit (projects the two-qubit space onto a one-qubit space), modifying the quantum state of the second qubit in the process. The second effect is that the result of the measurement is 'remembered' as a classical 0/1 bit. (X 2 (q 1)) --> The syntax of the X operator (the usual X gate) is (X ). The signal is a classical control: if it is evaluates to 0, the X operation is not performed. If the signal is 1, the operation is performed. In this case, the signal is (q 1), meaning "look up what the result of measuring qubit-1 was". In other words, X is performed on qubit-2, depending on the measurement result of qubit-1. Tracking the quantum state in the |0>/|1> basis (as qvm reports), we thus start with qubit 1 and 2 in |0>+|1> state, entangle them with a controlled-Z unitary, measure them in the +/- basis and then compensate for the non-deterministic result of the measurement by either flipping a |1> result to |0>, or keeping |0> as |0>. Treating qubit 1 as the 'input' qubit here and qubit 2 as output, we went from a |+> input to |0> output, realizing H|+> => |0> I describe this example a bit better in chapter 2 of my thesis: http://soft.vub.ac.be/Publications/2012/vub-soft-phd-12-05.pdf Hope this helps, -Yves On Tue, Feb 23, 2016 at 3:32 PM, Fausto Saporito wrote: > > Hello Yves, > > I'm trying the qvm version of mcc, but I don't understand a result of > this > simple code: > > "((E 1 2) (M 1 0) (X 2 (q 1)))" > > this is the Hadamard gate applied to 1 qubit (|0> + |1>), correct ? > But the result is : > > 1.000000 +0.000000i|0> (1.000000e+00) (|0>) > > why ? > > Sorry for the stupid question, but if you could explain me this result, > I'd appreciate it very much. > > thanks, > Fausto > > — > Reply to this email directly or view it on GitHub > https://github.com/yvdriess/mcc/issues/3#issuecomment-187720724. — Reply to this email directly or view it on GitHub https://github.com/yvdriess/mcc/issues/3#issuecomment-187742135.
yvdriess commented 8 years ago

Yes there is, at least for qvm (can't remember for mcc). You need to pass it a file that describes an initial (input) qubit state.

On Tue, Feb 23, 2016 at 4:49 PM, Fausto Saporito notifications@github.com wrote:

Hello Yves,

great explanation ! thanks a lot, now it's perfectly clear to me.

I really was expecting to evaluate H|0> not H|+> :)

I understood the non-input qubits are always in the state |+>, but is it possible, for the input qubit, use a specific state ?

thanks, fausto

2016-02-23 16:27 GMT+01:00 Yves Vandriessche notifications@github.com:

Hello Fausto,

I'll be glad to help, although this has been a while for me :)

Short answer: the measurement calculus, which QVM implements, works in the +/- basis, rather than the 0/1 basis. I think you were expecting H|0> = |+>, but the above snippet realizes and H|+> = |0>.

Long answer:

The QVM's operations are an implementation of the measurement calculus by Danos et al. (arxiv version can be found here: http://arxiv.org/pdf/0704.1263v1.pdf) You can find a lot more detailed explanations of why and how there. The big differences with their notation and my QVM syntax is that I implicitely create qubits when needed and that I read operations from left-to-right as usual in computer science, instead of right-to-left in matrix algebra.

The Measurement Calculus uses the 'one way quantum computing model', which is very differently from the typical circuit model. Instead of starting with a bunch of isolated qubits, then applying unitary gates and finally doing measurement; the one-way model starts with a large amounts of entangled qubits and evolves the quantum state by applying measurements. For various reasons, the measurement calculus represents qubits in the in the diagonal basis |+>/|-> ( |+> = (|0> + |1>)/sqrt(2) and |-> = (|0> - |1>)/sqrt(2)); this basis is completely equivalent to the more traditional |0>/|1> basis. The hadamard gate is realized in a typical circuit model by

To break down the example, reading left to right (mind, the Danos et al. paper reads operators from right to left). (E 1 2) --> qubits 1 and 2 have not been encountered yet, so two qubits in the |+> state are created and appended to the quantum state: |+>_1 tensor |+>_2 (initial quantum state is empty) note that qubits are created in the diagonal + state, not as |0> or |1> as typical in the circuit model --> the 'E' operator is applied, which is the entanglement operator CZ (controlled-Z, similar to the controlled-X), creating a superposition of the two qubits. (M 1 0) --> the syntax of the measurement operator M is (M

), where angle is the measurement angle. As mentioned, measurement is performed in the +/- basis. --> This measurement has two effects. On the quantum state, it destroys the first qubit (projects the two-qubit space onto a one-qubit space), modifying the quantum state of the second qubit in the process. The second effect is that the result of the measurement is 'remembered' as a classical 0/1 bit. (X 2 (q 1)) --> The syntax of the X operator (the usual X gate) is (X ). The signal is a classical control: if it is evaluates to 0, the X operation is not performed. If the signal is 1, the operation is performed. In this case, the signal is (q 1), meaning "look up what the result of measuring qubit-1 was". In other words, X is performed on qubit-2, depending on the measurement result of qubit-1. Tracking the quantum state in the |0>/|1> basis (as qvm reports), we thus start with qubit 1 and 2 in |0>+|1> state, entangle them with a controlled-Z unitary, measure them in the +/- basis and then compensate for the non-deterministic result of the measurement by either flipping a |1> result to |0>, or keeping |0> as |0>. Treating qubit 1 as the 'input' qubit here and qubit 2 as output, we went from a |+> input to |0> output, realizing H|+> => |0> I describe this example a bit better in chapter 2 of my thesis: http://soft.vub.ac.be/Publications/2012/vub-soft-phd-12-05.pdf Hope this helps, -Yves On Tue, Feb 23, 2016 at 3:32 PM, Fausto Saporito < notifications@github.com > wrote: > > Hello Yves, > > I'm trying the qvm version of mcc, but I don't understand a result of > this > simple code: > > "((E 1 2) (M 1 0) (X 2 (q 1)))" > > this is the Hadamard gate applied to 1 qubit (|0> + |1>), correct ? > But the result is : > > 1.000000 +0.000000i|0> (1.000000e+00) (|0>) > > why ? > > Sorry for the stupid question, but if you could explain me this result, > I'd appreciate it very much. > > thanks, > Fausto > > — > Reply to this email directly or view it on GitHub > https://github.com/yvdriess/mcc/issues/3#issuecomment-187720724. — Reply to this email directly or view it on GitHub https://github.com/yvdriess/mcc/issues/3#issuecomment-187742135.

— Reply to this email directly or view it on GitHub https://github.com/yvdriess/mcc/issues/3#issuecomment-187758499.

TheFausap commented 8 years ago

Thanks!

I'll try to find it in the examples.

By the way I noticed the starting point is always the circuit point of view. It seems to me this is quite a low level language, while the circuit-based description is an high-level one.

Do you know some books describing how to develop algorithms in this way, without starting with the circuit counterpart ?

thanks, Fausto

2016-02-23 16:53 GMT+01:00 Yves Vandriessche notifications@github.com:

Yes there is, at least for qvm (can't remember for mcc). You need to pass it a file that describes an initial (input) qubit state.

On Tue, Feb 23, 2016 at 4:49 PM, Fausto Saporito <notifications@github.com

wrote:

Hello Yves,

great explanation ! thanks a lot, now it's perfectly clear to me.

I really was expecting to evaluate H|0> not H|+> :)

I understood the non-input qubits are always in the state |+>, but is it possible, for the input qubit, use a specific state ?

thanks, fausto

2016-02-23 16:27 GMT+01:00 Yves Vandriessche notifications@github.com:

Hello Fausto,

I'll be glad to help, although this has been a while for me :)

Short answer: the measurement calculus, which QVM implements, works in the +/- basis, rather than the 0/1 basis. I think you were expecting H|0> = |+>, but the above snippet realizes and H|+> = |0>.

Long answer:

The QVM's operations are an implementation of the measurement calculus by Danos et al. (arxiv version can be found here: http://arxiv.org/pdf/0704.1263v1.pdf) You can find a lot more detailed explanations of why and how there. The big differences with their notation and my QVM syntax is that I implicitely create qubits when needed and that I read operations from left-to-right as usual in computer science, instead of right-to-left in matrix algebra.

The Measurement Calculus uses the 'one way quantum computing model', which is very differently from the typical circuit model. Instead of starting with a bunch of isolated qubits, then applying unitary gates and finally doing measurement; the one-way model starts with a large amounts of entangled qubits and evolves the quantum state by applying measurements. For various reasons, the measurement calculus represents qubits in the in the diagonal basis |+>/|-> ( |+> = (|0> + |1>)/sqrt(2) and |-> = (|0> - |1>)/sqrt(2)); this basis is completely equivalent to the more traditional |0>/|1> basis. The hadamard gate is realized in a typical circuit model by

To break down the example, reading left to right (mind, the Danos et al. paper reads operators from right to left). (E 1 2) --> qubits 1 and 2 have not been encountered yet, so two qubits in the |+> state are created and appended to the quantum state: |+>_1 tensor |+>_2 (initial quantum state is empty) note that qubits are created in the diagonal + state, not as |0> or |1> as typical in the circuit model --> the 'E' operator is applied, which is the entanglement operator CZ (controlled-Z, similar to the controlled-X), creating a superposition of the two qubits. (M 1 0) --> the syntax of the measurement operator M is (M

), where angle is the measurement angle. As mentioned, measurement is performed in the +/- basis. --> This measurement has two effects. On the quantum state, it destroys the first qubit (projects the two-qubit space onto a one-qubit space), modifying the quantum state of the second qubit in the process. The second effect is that the result of the measurement is 'remembered' as a classical 0/1 bit. (X 2 (q 1)) --> The syntax of the X operator (the usual X gate) is (X ). The signal is a classical control: if it is evaluates to 0, the X operation is not performed. If the signal is 1, the operation is performed. In this case, the signal is (q 1), meaning "look up what the result of measuring qubit-1 was". In other words, X is performed on qubit-2, depending on the measurement result of qubit-1. Tracking the quantum state in the |0>/|1> basis (as qvm reports), we thus start with qubit 1 and 2 in |0>+|1> state, entangle them with a controlled-Z unitary, measure them in the +/- basis and then compensate for the non-deterministic result of the measurement by either flipping a |1> result to |0>, or keeping |0> as |0>. Treating qubit 1 as the 'input' qubit here and qubit 2 as output, we went from a |+> input to |0> output, realizing H|+> => |0> I describe this example a bit better in chapter 2 of my thesis: http://soft.vub.ac.be/Publications/2012/vub-soft-phd-12-05.pdf Hope this helps, -Yves On Tue, Feb 23, 2016 at 3:32 PM, Fausto Saporito < notifications@github.com > wrote: > > Hello Yves, > > I'm trying the qvm version of mcc, but I don't understand a result of > this > simple code: > > "((E 1 2) (M 1 0) (X 2 (q 1)))" > > this is the Hadamard gate applied to 1 qubit (|0> + |1>), correct ? > But the result is : > > 1.000000 +0.000000i|0> (1.000000e+00) (|0>) > > why ? > > Sorry for the stupid question, but if you could explain me this > result, > I'd appreciate it very much. > > thanks, > Fausto > > — > Reply to this email directly or view it on GitHub > https://github.com/yvdriess/mcc/issues/3#issuecomment-187720724. — Reply to this email directly or view it on GitHub https://github.com/yvdriess/mcc/issues/3#issuecomment-187742135.

— Reply to this email directly or view it on GitHub https://github.com/yvdriess/mcc/issues/3#issuecomment-187758499.

— Reply to this email directly or view it on GitHub https://github.com/yvdriess/mcc/issues/3#issuecomment-187760565.

yvdriess commented 8 years ago

Quickly checking the code:

./qvm -f ...

where the file is a text file with the initial quantum state descriped using an s-expression: For example, I had a file input-1-0: ((1) ((0 1))) which is a qubit state with qubit-1 = |0>

The syntax is something in the style of: ( ) *

::= ( \+ ) ( ( )+ ) ::= ( ) ::= double | double double If I remember correctly, you can pass enagled qubit states this way: ((1 2) ((0 ...) (1 ...) (2 ...) (3 ...))) and can specify complex float amplitudes (0 0.4 0.6) ==> (0.4+0.6i)|0> On Tue, Feb 23, 2016 at 4:52 PM, Yves Vandriessche yvdriess@gmail.com wrote: > Yes there is, at least for qvm (can't remember for mcc). You need to pass > it a file that describes an initial (input) qubit state. > > On Tue, Feb 23, 2016 at 4:49 PM, Fausto Saporito > > wrote: > > > > Hello Yves, > > > > great explanation ! thanks a lot, now it's perfectly clear to me. > > > > I really was expecting to evaluate H|0> not H|+> :) > > > > I understood the non-input qubits are always in the state |+>, but is it > > possible, for the input qubit, use a specific state ? > > > > thanks, > > fausto > > > > 2016-02-23 16:27 GMT+01:00 Yves Vandriessche notifications@github.com: > > > > > Hello Fausto, > > > > > > I'll be glad to help, although this has been a while for me :) > > > > > > Short answer: the measurement calculus, which QVM implements, works in > > > the > > > +/- basis, rather than the 0/1 basis. I think you were expecting H|0> = > > > |+>, but the above snippet realizes and H|+> = |0>. > > > > > > Long answer: > > > > > > The QVM's operations are an implementation of the measurement calculus > > > by > > > Danos et al. (arxiv version can be found here: > > > http://arxiv.org/pdf/0704.1263v1.pdf) You can find a lot more detailed > > > explanations of why and how there. The big differences with their > > > notation > > > and my QVM syntax is that I implicitely create qubits when needed and > > > that > > > I read operations from left-to-right as usual in computer science, > > > instead > > > of right-to-left in matrix algebra. > > > > > > The Measurement Calculus uses the 'one way quantum computing model', > > > which > > > is very differently from the typical circuit model. Instead of starting > > > with a bunch of isolated qubits, then applying unitary gates and finally > > > doing measurement; the one-way model starts with a large amounts of > > > entangled qubits and evolves the quantum state by applying measurements. > > > For various reasons, the measurement calculus represents qubits in the > > > in > > > the diagonal basis |+>/|-> ( |+> = (|0> + |1>)/sqrt(2) and |-> = (|0> - > > > |1>)/sqrt(2)); this basis is completely equivalent to the more > > > traditional > > > |0>/|1> basis. The hadamard gate is realized in a typical circuit model > > > by > > > > > > To break down the example, reading left to right (mind, the Danos et al. > > > paper reads operators from right to left). > > > (E 1 2) --> qubits 1 and 2 have not been encountered yet, so two qubits > > > in the |+> state are created and appended to the quantum state: |+>_1 > > > tensor |+>_2 (initial quantum state is empty) > > > note that qubits are created in the diagonal + state, not > > > as |0> or |1> as typical in the circuit model > > > --> the 'E' operator is applied, which is the entanglement > > > operator CZ (controlled-Z, similar to the controlled-X), creating a > > > superposition of the two qubits. > > > (M 1 0) --> the syntax of the measurement operator M is (M > > > ), where angle is the measurement angle. As mentioned, > > > measurement > > > is performed in the +/- basis. > > > --> This measurement has two effects. On the quantum state, it > > > destroys the first qubit (projects the two-qubit space onto a one-qubit > > > space), modifying the quantum state of the second qubit in the process. > > > The > > > second effect is that the result of the measurement is 'remembered' as a > > > classical 0/1 bit. > > > (X 2 (q 1)) --> The syntax of the X operator (the usual X gate) is (X > > > ). The signal is a classical control: if it is > > > evaluates > > > to 0, the X operation is not performed. If the signal is 1, the > > > operation > > > is performed. In this case, the signal is (q 1), meaning "look up what > > > the > > > result of measuring qubit-1 was". In other words, X is performed on > > > qubit-2, depending on the measurement result of qubit-1. > > > > > > Tracking the quantum state in the |0>/|1> basis (as qvm reports), we > > > thus > > > start with qubit 1 and 2 in |0>+|1> state, entangle them with a > > > controlled-Z unitary, measure them in the +/- basis and then compensate > > > for > > > the non-deterministic result of the measurement by either flipping a |1> > > > result to |0>, or keeping |0> as |0>. Treating qubit 1 as the 'input' > > > qubit here and qubit 2 as output, we went from a |+> input to |0> > > > output, > > > realizing H|+> => |0> > > > > > > I describe this example a bit better in chapter 2 of my thesis: > > > http://soft.vub.ac.be/Publications/2012/vub-soft-phd-12-05.pdf > > > > > > Hope this helps, > > > > > > -Yves > > > > > > On Tue, Feb 23, 2016 at 3:32 PM, Fausto Saporito < > > > notifications@github.com > > > > > > > wrote: > > > > > > > > Hello Yves, > > > > > > > > I'm trying the qvm version of mcc, but I don't understand a result of > > > > this > > > > simple code: > > > > > > > > "((E 1 2) (M 1 0) (X 2 (q 1)))" > > > > > > > > this is the Hadamard gate applied to 1 qubit (|0> + |1>), correct ? > > > > But the result is : > > > > > > > > 1.000000 +0.000000i|0> (1.000000e+00) (|0>) > > > > > > > > why ? > > > > > > > > Sorry for the stupid question, but if you could explain me this > > > > result, > > > > I'd appreciate it very much. > > > > > > > > thanks, > > > > Fausto > > > > > > > > — > > > > Reply to this email directly or view it on GitHub > > > > https://github.com/yvdriess/mcc/issues/3#issuecomment-187720724. > > > > > > — > > > Reply to this email directly or view it on GitHub > > > https://github.com/yvdriess/mcc/issues/3#issuecomment-187742135. > > > > — > > Reply to this email directly or view it on GitHub > > https://github.com/yvdriess/mcc/issues/3#issuecomment-187758499.
yvdriess commented 8 years ago

Not that I know of. The circuit model has been used from the start as the mental framework for quantum-computing. The mathematicians developing new algorithms like to stick to this relatively simple model. I was using both the Kruska and Nielsen & Chuan book, but both are indeed circuit-based.

You might find some books that start from the one-way quantum computing point of view, but I did not know of any anno 2012. Similarly, you also have adiabatic quantum computing. The closest I remember of more 'high level' quantum computing were the quantum language guys or those doing quantum computing using category theory. Although, the latter seemed more about doing proof, I was interested in the computation simulation/work itself.

On Tue, Feb 23, 2016 at 5:01 PM, Fausto Saporito notifications@github.com wrote:

Thanks!

I'll try to find it in the examples.

By the way I noticed the starting point is always the circuit point of view. It seems to me this is quite a low level language, while the circuit-based description is an high-level one.

Do you know some books describing how to develop algorithms in this way, without starting with the circuit counterpart ?

thanks, Fausto

2016-02-23 16:53 GMT+01:00 Yves Vandriessche notifications@github.com:

Yes there is, at least for qvm (can't remember for mcc). You need to pass it a file that describes an initial (input) qubit state.

On Tue, Feb 23, 2016 at 4:49 PM, Fausto Saporito < notifications@github.com

wrote:

Hello Yves,

great explanation ! thanks a lot, now it's perfectly clear to me.

I really was expecting to evaluate H|0> not H|+> :)

I understood the non-input qubits are always in the state |+>, but is it possible, for the input qubit, use a specific state ?

thanks, fausto

2016-02-23 16:27 GMT+01:00 Yves Vandriessche <notifications@github.com :

Hello Fausto,

I'll be glad to help, although this has been a while for me :)

Short answer: the measurement calculus, which QVM implements, works in the +/- basis, rather than the 0/1 basis. I think you were expecting H|0> = |+>, but the above snippet realizes and H|+> = |0>.

Long answer:

The QVM's operations are an implementation of the measurement calculus by Danos et al. (arxiv version can be found here: http://arxiv.org/pdf/0704.1263v1.pdf) You can find a lot more detailed explanations of why and how there. The big differences with their notation and my QVM syntax is that I implicitely create qubits when needed and that I read operations from left-to-right as usual in computer science, instead of right-to-left in matrix algebra.

The Measurement Calculus uses the 'one way quantum computing model', which is very differently from the typical circuit model. Instead of starting with a bunch of isolated qubits, then applying unitary gates and finally doing measurement; the one-way model starts with a large amounts of entangled qubits and evolves the quantum state by applying measurements. For various reasons, the measurement calculus represents qubits in the in the diagonal basis |+>/|-> ( |+> = (|0> + |1>)/sqrt(2) and |-> = (|0> - |1>)/sqrt(2)); this basis is completely equivalent to the more traditional |0>/|1> basis. The hadamard gate is realized in a typical circuit model by

To break down the example, reading left to right (mind, the Danos et al. paper reads operators from right to left). (E 1 2) --> qubits 1 and 2 have not been encountered yet, so two qubits in the |+> state are created and appended to the quantum state: |+>_1 tensor |+>_2 (initial quantum state is empty) note that qubits are created in the diagonal + state, not as |0> or |1> as typical in the circuit model --> the 'E' operator is applied, which is the entanglement operator CZ (controlled-Z, similar to the controlled-X), creating a superposition of the two qubits. (M 1 0) --> the syntax of the measurement operator M is (M

), where angle is the measurement angle. As mentioned, measurement is performed in the +/- basis. --> This measurement has two effects. On the quantum state, it destroys the first qubit (projects the two-qubit space onto a one-qubit space), modifying the quantum state of the second qubit in the process. The second effect is that the result of the measurement is 'remembered' as a classical 0/1 bit. (X 2 (q 1)) --> The syntax of the X operator (the usual X gate) is (X ). The signal is a classical control: if it is evaluates to 0, the X operation is not performed. If the signal is 1, the operation is performed. In this case, the signal is (q 1), meaning "look up what the result of measuring qubit-1 was". In other words, X is performed on qubit-2, depending on the measurement result of qubit-1. Tracking the quantum state in the |0>/|1> basis (as qvm reports), we thus start with qubit 1 and 2 in |0>+|1> state, entangle them with a controlled-Z unitary, measure them in the +/- basis and then compensate for the non-deterministic result of the measurement by either flipping a |1> result to |0>, or keeping |0> as |0>. Treating qubit 1 as the 'input' qubit here and qubit 2 as output, we went from a |+> input to |0> output, realizing H|+> => |0> I describe this example a bit better in chapter 2 of my thesis: http://soft.vub.ac.be/Publications/2012/vub-soft-phd-12-05.pdf Hope this helps, -Yves On Tue, Feb 23, 2016 at 3:32 PM, Fausto Saporito < notifications@github.com > wrote: > > Hello Yves, > > I'm trying the qvm version of mcc, but I don't understand a result > of > this > simple code: > > "((E 1 2) (M 1 0) (X 2 (q 1)))" > > this is the Hadamard gate applied to 1 qubit (|0> + |1>), correct ? > But the result is : > > 1.000000 +0.000000i|0> (1.000000e+00) (|0>) > > why ? > > Sorry for the stupid question, but if you could explain me this > result, > I'd appreciate it very much. > > thanks, > Fausto > > — > Reply to this email directly or view it on GitHub > https://github.com/yvdriess/mcc/issues/3#issuecomment-187720724. — Reply to this email directly or view it on GitHub https://github.com/yvdriess/mcc/issues/3#issuecomment-187742135.

— Reply to this email directly or view it on GitHub https://github.com/yvdriess/mcc/issues/3#issuecomment-187758499.

— Reply to this email directly or view it on GitHub https://github.com/yvdriess/mcc/issues/3#issuecomment-187760565.

— Reply to this email directly or view it on GitHub https://github.com/yvdriess/mcc/issues/3#issuecomment-187764005.