Quantum Platforms Quantum Programming

The votes are in, t|ket takes the lead as the most popular language. We look at the language in more depth

August 31, 2020

The votes show that t|ket won our vote as being the most popular language framework for programming quantum computers. Followed by Qiskit. Surprisingly Q# and Cirq are not as popular as we expected. There are plenty of resources on Qiskit and is supported by IBM, Q# supported by Microsoft and Cirq is supported by Google.

In some ways the result was quite surprising, of course polls can only be indicators of real usage and preferences. We can certainly see there are lots in the community who love t|ket, so we thought we would take a brief look at what exactly t|ket > actually looks like!

What is t | ket > ?

Cambridge Quantum Computing created t|ket.

More than a language, it allows users to build circuits for a variety of back-ends, basically allowing users to run circuits on hardware from the likes of IBM, Honeywell or Google. Basically you can think of t|ket > as enabling you to use one language to describe your circuit and have it run effectively on whatever hardware you want. With multiple languages and hardware out there, users tend to fall into ecosystem camps because each code base becomes specialized for the hardware. t|ket > came from Cambridge Quantum Computing.

t|ket > allows Quantum programmers to use one language and compile that language efficiently to run on a variety of back-ends. Supported back-ends, architectures and hardware are:

  • Cirq
  • Q#
  • Qiskit
  • AQT
  • Honeywell
  • Pyzx
  • PyQuil
  • ProjectQ

More than simply a language t|ket is a compiler, which means that it can efficiently make quantum circuits on a variety of hardware. That means that a circuit created in the t|ket language can be compiled down to run on hardware from different providers.

t|ket⟩ – The world’s leading and most efficient architecture agnostic quantum compiler

Taken from cambridgequantum.com

Running a simple circuit a t|ket using python

Python is an invaluable tool for interacting with the t|ket language and framework. For two qubits, below shows the syntax for creating a simple Hadamard, performing a rotation about the z axis and a controlled not before measuring the two qubits.

from pytket import Circuit
c = Circuit(2,2) # define a circuit with 2 qubits and 2 bits
c.H(0)           # add a Hadamard gate to qubit 0
c.Rz(0.25, 0)    # add an Rz gate of angle 0.25*pi to qubit 0
c.CX(1,0)        # add a CX gate with control qubit 1 and target qubit 0
c.measure_all()  # measure qubits 0 and 1, recording the results in bits 0 and 1

After creating the circuit, a backend can be chosen, on which the actual circuit will be chosen. The compiler will then take your circuit described in t|ket and find an optimization for the gates. That is the special and ground breaking aspect of the framework, the efficient way that the circuits can be actually compiled for the specific hardware. Behind the scenes, several features are designed to minimize the influence of device error In terms of bench-marking, t|ket outperforms most competitors in terms of circuit optimisation and qubit routing. To run on an IBM backend, we can then use the following syntax.

from pytket.backends.ibm import AerBackend
b = AerBackend()                # connect to the backend
b.compile_circuit(c)            # compile the circuit to satisfy the backend's requirements
handle = b.process_circuit(c, 100)  # submit the job to run the circuit 100 times
counts = b.get_counts(handle)   # retrieve and summarise the results
print(counts)

Other back-ends can be easy swapped in and out depending on the target machine required.

You can go and get the pytket installation from the following documentation and read the paper highlighting how the t|ket language works.