I've been learning quantum computing; the book I've been reading uses a different notation that visualises the qubit states. I've been duplicating things using Rigetti's QVM to sort get a feel for a real system. Also, Common Lisp is great. This is a capture of notes from my lab notebook. It's a snapshot of my knowledge at this point in time, and is subject to change.

I've read through parts of Quantum Country so I knew about Hadamard gates and Pauli gates; tinkering with other systems means I'm familiar with CNOT gates too. One thing I wasn't sure about and I need to go back and read more about is how the phase angles work; in the book's circle notation, it's always an absolute value and the relative phase is expressed separately. To get a sense for this, I compared two programs in QCEngine and Quil; I'm using a local instance of Rigetti's QVM.

One thing that helped me out was to set up a page in my lab notebook for single-qubit gate experiments; given some input, what's the output?

Another thing that was sort of confusing at first was translating the first program from QCEngine to Quil:

// Programming Quantum Computers
//   by Eric Johnston, Nic Harrigan and Mercedes Gimeno-Segovia
//   O'Reilly Media

// To run this online, go to http://oreilly-qc.github.io?p=2-1

// This sample generates a single random bit.

qc.reset(1);         // allocate one qubit
qc.write(1);         // write the value zero
qc.had();            // place it into superposition of 0 and 1
var result = qc.read();  // read the result as a digital bit

There isn't an explicit write statement in Quil; you can set a qubit to 1 by noting two things:

  1. A RESET (which, by default, happens at the start of every program) sets everything to |0>.
  2. An X gate, which is a quantum complement (aka a NOT gate), turning |0> to |1>.

So, in Quil, you would say (as best as I can tell right now):

X 0
H 0

The QVM is interesting, this program ends up running something like:

(0) <heidrun:kyle> $ quilc <ex.quil|qvm
* Welcome to the Rigetti QVM *
Copyright (c) 2016-2019 Rigetti Computing.

(Configured with 4096 MiB of workspace and 8 workers.)
(Gates parallelize at 19 qubits.)
(There are 3 kernels and they are used with up to 29 qubits.)
(Features enabled: none)

<134>1 2020-06-07T05:51:46Z heidrun qvm 422885 - - Compilation mode disabled.
<135>1 2020-06-07T05:51:46Z heidrun qvm 422885 - - Selected simulation method: pure-state
<135>1 2020-06-07T05:51:46Z heidrun qvm 422885 - - Reading program.
<135>1 2020-06-07T05:51:47Z heidrun qvm 422885 - - Allocating memory for QVM of 1 qubits.
<135>1 2020-06-07T05:51:47Z heidrun qvm 422885 - - Allocation completed in 8 ms.
<135>1 2020-06-07T05:51:47Z heidrun qvm 422885 - - Loading quantum program.
<135>1 2020-06-07T05:51:47Z heidrun qvm 422885 - - Executing quantum program.
<135>1 2020-06-07T05:51:47Z heidrun qvm 422885 - - Execution completed in 35 ms.
<135>1 2020-06-07T05:51:47Z heidrun qvm 422885 - - Printing classical memory and 1-qubit state.
Classical memory (low -> high indexes):
    No memory.
    |0>: 0.0,                                                   P=  0.0%
    |1>: -1.0+0.00000000000000015700924586837752i,              P=100.0%

Looking forward to learning more. I'm working on getting back up to speed on linear algebra.

Tags: , ,