GQC - A Quantum Compiler

  Which gates are universal for quantum computation? Although it is well known that certain gates on two-level quantum systems (qubits), such as the controlled-not (CNOT), are universal when assisted by arbitrary one-qubit gates, it has only recently become clear precisely what class of two-qubit gates is universal in this sense.

 In quant-ph/0207072 we present an elementary proof that any entangling two-qubit gate is universal for quantum computation, when assisted by one-qubit gates. The proof describes how an arbitrary entangling two-qubit unitary may be used to construct a CNOT. As a further demonstration of this construction this webpage allows you to enter your own two-qubit gate and (provided it's entangling) outputs the circuit constructing the CNOT.
Input

Enter the 2-qubit unitary matrix below (see syntax if you're unsure how)

M = Type:
Unitary (U = M)
Hermitian (U = exp(iM))

Examples
  • M( (1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,0,1) )     (as unitary)
  • II*cos(pi/67)+i*sin(pi/67)*YY     (as unitary)
  • .1*XX+pi/6*YY+ZZ/3     (as hermitian)
Syntax

The Unitary matrix can either be entered directly or as a Hermitian matrix which will be exponentiated to obtain the unitary matrix. In either case, there is a great deal of flexibility in entering the matrix itself.

A matrix can be entered directly with the syntax "M( (x,x,x,x) , (x,x,x,x), (x,x,x,x) , (x,x,x,x) )", or calculated from other matrices eg: "II*cos(pi/7)+i*sin(pi/7)*XX"

Note the following:

  • Whitespace is ignored
  • Complex numbers can be entered using 'i' such as: 1+2*i
  • constants e and pi are available
  • usual math operators are available
  • acos(x), acosh(x), asin(x), asinh(x), atan(x), atanh(x), cos(x), cosh(x) exp(x), log(x), log10(x), sin(x), sinh(x), sqrt(x), tan(x), tanh(x)
  • The pauli sigma-matrices are available as: I, X, Y, Z.
  • Some other matrices: H (Hadamard), CNOT, SWAP
  • single qubit matrices can be tensored together using tensor(A,B) or A&B, for convenience all tensored combinations of the Pauli matrices are available eg XY (= tensor(X,Y))
  • Matrices can be multiplied together e.g. XX*(H&Y)
  • The conjugate transpose is available as ".d" eg (H&Y).d