This module contains various examples which demonstrate the features of QIT. The tour function is a “guided tour” to the toolkit which runs all the demos in succession.
|adiabatic_qc_3sat([n, n_clauses, clauses, ...])||Adiabatic quantum computing demo.|
|bb84([n])||Bennett-Brassard 1984 quantum key distribution protocol demo.|
|bernstein_vazirani([n, linear])||Bernstein-Vazirani algorithm demo.|
|grover_search([n])||Grover search algorithm demo.|
|markov_decoherence(T1, T2[, B])||Markovian decoherence demo.|
|nmr_sequences([seqs, titles])||NMR control sequences demo.|
|phase_estimation_precision(t, U[, u])||Quantum phase estimation demo.|
|qft_circuit([dim])||Quantum Fourier transform circuit demo.|
|quantum_channels([p])||Visualization of simple one-qubit channels.|
|quantum_walk([steps, n, p, n_coin])||Quantum random walk demo.|
|qubit_and_resonator([d_r])||Qubit coupled to a microwave resonator demo.|
|shor_factorization([N, cheat])||Shor’s factorization algorithm demo.|
|superdense_coding([d])||Superdense coding demo.|
|teleportation([d])||Quantum teleportation demo.|
|tour()||Guided tour to the quantum information toolkit.|
|adiabatic_qc(H0, H1, s0[, tmax])||Adiabatic quantum computing.|
|phase_estimation(t, U, s[, implicit])||Quantum phase estimation algorithm.|
|find_order(a, N[, epsilon])||Quantum order-finding subroutine.|
Adiabatic quantum computing demo.
This example solves random 3-SAT problems by simulating the adiabatic quantum algorithm of .
Note that this is incredibly inefficient because we first essentially solve the NP-complete problem classically using an exhaustive search when computing the problem Hamiltonian H1, and then simulate an adiabatic quantum computer solving the same problem using the quantum algorithm.
Adiabatic quantum computing.
This is a helper function for simulating the adiabatic quantum algorithm of  and plotting the results.
Bennett-Brassard 1984 quantum key distribution protocol demo.
Simulate the protocol with n qubits transferred.
Bernstein-Vazirani algorithm demo.
Simulates the Bernstein-Vazirani algorithm , which, given a black box oracle implementing a linear Boolean function , returns the bit vector a (and thus identifies the function) with just a single oracle call. If the oracle function is not linear, the algorithm will fail.
Grover search algorithm demo.
Simulate the Grover search algorithm  formulated using amplitude amplification in a system of n qubits.
Markovian decoherence demo.
Given decoherence times T1 and T2, creates a markovian bath B and a coupling operator D which reproduce them on a single-qubit system.
NMR control sequences demo.
Compares the performance of different single-qubit NMR control sequences in the presence of systematic errors. Plots the fidelity of each control sequence as a function of both off-resonance error f and fractional pulse length error g.
Reproduces fidelity plots in .
Quantum phase estimation algorithm.
Estimate an eigenvalue of the unitary lmap U using t qubits, starting from the state s.
Returns the state of the index register after the phase estimation circuit, but before final measurement.
To get a result accurate to n bits with probability , choose
Quantum phase estimation demo.
Estimate an eigenvalue of unitary operator U using t bits, starting from the state u. Plots and returns the probability distribution of the resulting t-bit approximations. If u is not given, use a random eigenvector of U.
Quantum Fourier transform circuit demo.
Simulate the quadratic QFT circuit construction. dim is the dimension vector of the subsystems.
NOTE: If dim is not palindromic the resulting circuit also reverses the order of the dimensions in the SWAP cascade.
Visualization of simple one-qubit channels.
Visualizes the effect of different quantum channels on a qubit using the Bloch sphere representation.
Quantum random walk demo.
Simulates a 1D quantum walker controlled by a unitary quantum coin. On each step the coin is flipped and the walker moves either to the left or to the right depending on the result.
After each step, the position of the walker is measured with probability p. p == 1 results in a fully classical random walk, whereas p == 0 corresponds to the “fully quantum” case.
Qubit coupled to a microwave resonator demo.
Simulates a qubit coupled to a microwave resonator. Reproduces plots from the experiment in .
Shor’s factorization algorithm demo.
Simulates Shor’s factorization algorithm, tries to factorize the integer N. If cheat is False, simulates the full algorithm. Otherwise avoids the quantum part.
NOTE: This is a very computationally intensive quantum algorithm to simulate classically, and probably will not run for any nontrivial value of N (unless you choose to cheat, in which case instead of simulating the quantum part (implemented in find_order) we use a more efficient classical algorithm for the order-finding).
Quantum order-finding subroutine.
Finds the period of the function f(x) = a^x mod N. epsilon is the maximum allowed failure probability for the subroutine.
Returns r, s where r/s approximates period/T.
Superdense coding demo.
Simulate Alice sending two d-its of information to Bob using a shared EPR qudit pair.
Quantum teleportation demo.
Simulate the teleportation of a d-dimensional qudit from Alice to Bob.
Guided tour to the quantum information toolkit.