Review: Cambridge Quantum’s TKET

Brian N. Siegelwax
Level Up Coding
Published in
3 min readOct 29, 2021

--

After sharing my review of Classiq’s Quantum Algorithm Design (QAD) platform, a Redditer suggested I review Cambridge Quantum’s TKET. Before I had a chance to do so, Oxford Quantum Circuits (OQC) published an article titled, “OQC integrates TKET, demonstrates 4x optimisation.”

I recreated the circuit that OQC optimized, because I had a hunch. Using TKET, OQC optimized the above circuit into a circuit with just a Hadamard gate on q0 and a CNOT gate with its control on q0 and its target on q1.

In other words, this is the “hello, quantum world” circuit that is used to teach new entrants into quantum computing about superposition and entanglement. OQC decided to use this highly-recognizable circuit to show off TKET’s optimization power. Unfortunately, because I use IBM Quantum’s OpenQASM editor, I’m used to examining transpiled circuits, and I’ve observed that the transpiler optimizes circuits.

Above is the result of BOTH transpilations. Whether you re-create the OQC circuit or the “hello, quantum world” circuit, IBM Quantum will transpile them into the same circuit without using TKET.

In other words, at least if using an IBM Quantum backend, OQC did not need to use TKET. For that matter, this one could’ve just been eyeballed, but IBM Quantum does, in fact, optimize circuits at runtime.

So, Why Bother Using TKET?

Maybe you would like to see recommended optimizations before you wait in a queue for real hardware. Or, maybe you would like to optimize a circuit that requires more real qubits than you have access to (simulators don’t transpile). Or, maybe you would just like to compare your circuit to TKET’s circuit to learn more about optimization.

Whatever your reason(s), a simplified way to get started with TKET follows:

Install TKET

pip install pytket

Import From TKET

--

--