[WSG23] Daily Study Group: Quantum Computation Framework (Oct 24, 2022)

A new WolframU study group devoted to Quantum Computation Framework begins Monday, October 24th! A list of daily topics can be found on our Daily Study Groups page. This group will be led by me and @Nikolay Murzin, from Wolfram Quantum Team. We will meet daily, Monday to Friday. Study group sessions include time for exercises, discussion and Q&A. This study group will help you acquire an intro knowledge of quantum computation and learn how to implement quantum algorithms in the Wolfram Quantum Computation Framework. Feel free to explore our framework.

REGISTER HERE

6 Likes

What’s the shorthand keyboard sequence for the MAC that allows me to toggle between formats?

How would you do this code in WQF in the most compact form

This seems to work for the POVM

Tr[QuantumTensorProduct[QuantumState["0"]["Dagger"], 
    QuantumState["Plus"]["Dagger"]][
   "DensityMatrix"] QuantumState["PhiPlus"]["DensityMatrix"]]

and the Projective measurement

((Abs[Normal[(QuantumTensorProduct[
        QuantumTensorProduct[QuantumState["0"]["Dagger"], 
         QuantumState["Plus"]["Dagger"]]]@ QuantumState["PhiPlus"])[
     "StateVector"]][[1]]
  ] ) ^2)  

So thats why I need a more compact form :slight_smile:
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=gates.jpg&userId=384115

It’s Cmd+Shift+T for TraditionalForm, and Cmd+Shift+N for StandardForm.

1 Like

I wouldn’t call it a measurement, because you only extract a single specific probability. So it is just composing certain state projectors, or their corresponding operators, with a target state:

Tr[QuantumState["0"]["Operator"]@QuantumState["+", "X"]["Operator", {2}]@QuantumState["PhiPlus"]]

If you like nice notation, then after evaluating each piece inline individually and turning them into their TraditionalForm, it would look like this inside an Output cell:

Notice that I make a plus state in X basis and turn it into an operator that acts on the 2nd qubit: QuantumState[“+”, “X”][“Operator”, {2}] (update the paclet to make it work).

If you want to do a measurement in computational and “X” basis and extract probabilities, you should act with QuantumMeasurementOperator on the state:

QuantumMeasurementOperator[{2, "X"}, {1, 2}][QuantumState["PhiPlus"]]["Probabilities"]

QuantumMeasurementOperator doesn’t look very nice in TraditionalForm, but you can still display it:

Screenshot2022-10-25at06.40.56.png

These extra output bold kets are eigenvalues for your measurement (it’s that vertical measurement wire that you see in circuit diagrams), it goes from 0 to D-1 by default. We will discuss it in more detail at the study group dedicated to measurement, stay tuned! :wink:

1 Like

(update the paclet to make it work).

I did but now it will not run on my version 13.0,1,0 (it runs on the cloud )

I am sure that “EntangledQ” was part of QuantumState[“Properties”] but it now it seems its missing

(found it QuantumEntangledQ )

This is not really a reply, but a new question. I hope it’s all right to put it here.
How do you get immediate information on a particular function? Normally you do that by hovering over the name, and then click on the “i” that comes up. But the “i” is grayed out for me. I can get the overloaded formats for the functions, but not the documentation.

Hi Mike, on Mac, if you hover your mouse over the function, then click Command+Shift+T, the documentation page will pop up. Also, for some of functions (not all of them, eventually for all of them), we have added the option of seeing their most common template

2 Likes

Hi
I am trying to work out how the built-in function/state "Werner " works i.e
QuantumState[{“Werner”,1/2, 2}]

see Notebookj

I don’t understand this problem:

  • create qubit trine (define as: |0>, -(1/2)|0>-Sqrt[3]/2 |1>,-(1/2)|0>+(Sqrt[3]/2) |1>
  • find their state vector in Pauli-Y basis

This looks like 3 state vectors. Is this supposed to be a basis?

no, 3 different states (a textbook example when discussing POVMs)
create each one separately, then transform them into Pauli-Y basis

1 Like

yes, they are mixture of projectors
try higher dimensions too and compare with

QuantumState[{"Werner",p,d}]

I have successfully used Qiskit to run examples on the IBM Quantum computer, but I am also an applied math person, I need to understand what I am trying to achieve. You have shown us an amazing number of functions, but I am struggling to work out how and where to start. Any chance of a quick example, say the addition circuit using Toffoli at the end of " section 4.3 " of Qiskit textbook into to Wolfram code? After that I might have some chance with the quiz.

Hi Declyn

I currently spend most of my time transferring code from the new qiskit text book into WQF. The first thing to realise is that qiskit numbers the qubits from right to left | 3 2 1 > and mathematica and WQF numbers qibits from left to right | 1 2 3> , this means you need to invert your circuit above and the circuit diagram will then be compatible with WQF . ( I am sure Nik will have a trick in WQF to automatically do this )

I am currently doing this using Simons algorithm in the new Qiskit textbook invert the circuits (using the qiskit function inverse() then writing the WQF code to represent the inverted circuit . I will do this in a notebook (you may need to increase the size of the images in the notebook)

2 Likes

Thank you for this great answer

https://www.wolframcloud.com/obj/wolframquantumframework/Published/Operators%20and%20measurement%20-%20Live.nb

Today’s live notebook

BTW, our framework works fine on cloud, too

1 Like

Nik is there a way to make this conversion from qiskit circuits to WQF easier .
Does WQF have a similar inverse() function that would take a WQF circuit and invert it to represent the circuit in Qiskit style .

There is a way to do it purely in Wolfram, you will have to set up Python external session for it to work.

1 Like

If you act with WQF circuit on a state, you can “Reverse” the final QuantumState, it will be the same as Qiskit’s final statevector. If you compile a WQF circuit to a QuantumOperator, its “Reverse” will make the same unitary as Qiskit. It’s trickier to reverse a measurement, I don’t have an easy way of doing it right now, sorry