TQIX

Python Quantum Computing

Welcome

TQIX

Quantum physIX

Discover TQIX


Cirq by Google: This open-source library allows you to design and manipulate quantum circuits. Cirq even lets you run your circuits on real quantum hardware or powerful simulators.

QuTiP: This library focuses on simulating quantum systems. With QuTiP, you can explore the intricacies of quantum mechanics and test your algorithms before venturing onto real hardware.

import cirq

Pick a qubit.


qubit = cirq.GridQubit(0, 0)

Create a circuit

circuit = cirq.Circuit(
cirq.X(qubit)**0.5, # Square root of NOT.
cirq.measure(qubit, key='m') # Measurement.
)
print("Circuit:")
print(circuit)

Simulate the circuit several times.


simulator = cirq.Simulator()
result = simulator.run(circuit, repetitions=20)
print("Results:")
print(result)

%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import datetime

from qutip import Qobj, identity, sigmax, sigmay, sigmaz, tensor
from qutip.qip.algorithms import qft
import qutip.logging_utils as logging
logger = logging.get_logger()

Set this to None or logging.WARN for 'quiet' execution

log_level = logging.INFO

QuTiP control modules

import qutip.control.pulseoptim as cpo
import qutip.control.pulsegen as pulsegen

example_name = 'QFT'

Defining the physics


Sy = sigmay()
Sz = sigmaz()
Si = 0.5*identity(2)

Drift Hamiltonian


H_d = 0.5*(tensor(Sx, Sx) + tensor(Sy, Sy) + tensor(Sz, Sz))

The (four) control Hamiltonians


H_c = [tensor(Sx, Si), tensor(Sy, Si), tensor(Si, Sx), tensor(Si, Sy)]

n_ctrls = len(H_c)

start point for the gate evolution


U_0 = identity(4)

Target for the gate evolution - Quantum Fourier Transform gate


U_targ = qft.qft(2)