Base Functions
QuantumAnnealing.binary_to_braket
— Methodconverts a binary state vector into a bra-ket notation string note: reverses qubit order for presentation
QuantumAnnealing.binary_to_int
— Methodconverts a binary state vector into an integer id following the package conventions valid ints are from 0-to-2^n-1
QuantumAnnealing.binary_to_spin
— Methodconverts a binary state vector (0/1) into an spin state vector (-1/1)
QuantumAnnealing.initial_state_default
— Methodground state of sumi A(0) Xi where A(0) > 0 and B(0) = 0
QuantumAnnealing.int_to_binary
— Methodconverts a integer id into a binary state vector following the package conventions valid ints are from 0-to-2^n-1 pad should be the total number qubits in the system
QuantumAnnealing.int_to_spin
— Methodconverts a integer id into a spin state vector following the package conventions valid ints are from 0-to-2^n-1 pad should be the total number qubits in the system
QuantumAnnealing.print_z_state_probabilities
— Methodgiven a 2^n vector of probably values, prints each value and its associated state vector. limit
is used to limit the total number of states that are printed. sort
is used to re-order the states by most likely instead of the default which is numerical order from 0-to-(2^n-1)
QuantumAnnealing.spin_to_binary
— Methodconverts a spin state vector (-1/1) into an binary state vector (0/1)
QuantumAnnealing.spin_to_braket
— Methodconverts a spin state vector (-1/1) into bra-ket notation (↓/↑) note: reverses qubit order for presentation
QuantumAnnealing.spin_to_int
— Methodconverts a spin state vector into an integer id following the package conventions valid ints are from 0-to-2^n-1
QuantumAnnealing.z_measure_probabilities
— Methodgiven a 2^n-by-2^n density matrix returns the probably of seeing each of the 2^n states on z-basis.
Simulate Functions
QuantumAnnealing.hamiltonian_transverse_ising
— MethodFunction to build the transverse field Ising model hamiltonian at a given unitless timestep s
.
Arguments: isingmodel - ising model represented as a dictionary. The qubits and couplings are represented as tuples, and the weights are numbers. For Example: im = Dict((1,) => 1, (2,) => 0.5, (1,2) => 2) annealingschedule - The annealing schedule, of the form given by the struct s - the imaginary timestep. This should usually be in the range from 0.0-to-1.0
QuantumAnnealing.simulate
— MethodMain function for performing quantum annealing simulation via a Magnus Expansion (second order). Noise can be simulated by running multiple times with randomized constant fields.
Arguments: isingmodel - ising model represented as a dictionary. The qubits and couplings are represented as tuples, and the weights are numbers. For Example: im = Dict((1,) => 1, (2,) => 0.5, (1,2) => 2) annealingschedule - The annealing schedule, of the form given by the struct
Parameters: initialstate - Initial state vector. Defaults to uniform superposition state on n qubits constantfieldx - vector of constant biases in the X basis on each qubit. Default is zeros(n) constantfieldz - vector of constant biases in the Z basis on each qubit. Default is zeros(n) The parameters `meantoland
max_tolspecify the desired simulation accuracy. The
silence` parameter can be used to suppress the progress log.
QuantumAnnealing.simulate_magnus_generic
— Methoda generic Magnus expansion solver with a fixed number of time steps
QuantumAnnealing.simulate_magnus_optimized
— Methoda Magnus expansion implementation simulate specialized to two quadratic functions of orders 1 to 4
QuantumAnnealing.simulate_de
— Methodsimulator that uses the OrdinaryDiffEq.jl differential equation solver to solve the Schrodinger Equation, rather than the Magnus Expansion. This simulator can run into issues at higher anneal times. The API is the same as for the simulate function.
Arguments: isingmodel - ising model represented as a dictionary. The qubits and couplings are represented as tuples, and the weights are numbers. For Example: im = Dict((1,) => 1, (2,) => 0.5, (1,2) => 2) annealingschedule - The annealing schedule, of the form given by the struct reltol - the relative tolerance that will be used in the ODE simulation
Parameters: initialstate - Initial state vector. Defaults to uniform superposition state on n qubits constantfieldx - vector of constant biases in the X basis on each qubit. Default is zeros(n) constantfield_z - vector of constant biases in the Z basis on each qubit. Default is zeros(n)
QuantumAnnealing.simulate_de
— MethodA simplified interface to the simulate_de
routine that determines suitable tolerance values to ensure a high accuracy simulation. The parameters mean_tol
and max_tol
specify the desired simulation accuracy. The silence
parameter can be used to suppress the progress log.
Annealing Schedules
QuantumAnnealing.AnnealingSchedule
— TypeA data structure containing two uni-variate functions defined in the domain of 0.0-to-1.0. The A
function drives the evolution of the X basis and the B
function drives the evolution of the Z basis. init_default
is a uni-variate function that given an integer n builds a initial state vector for an n qubit system.
QuantumAnnealing.AS_LINEAR
— ConstantAn AnnealingSchedule implementing a simple linear form
QuantumAnnealing.AS_QUADRATIC
— ConstantAn AnnealingSchedule implementing a simple quadratic form
QuantumAnnealing.AS_CIRCULAR
— ConstantAn AnnealingSchedule implementing uniform circular motion with an analytical solution on a single qubit
QuantumAnnealing.AS_DW_QUADRATIC
— ConstantAn AnnealingSchedule approximating those used in hardware by D-Wave Systems
NOTE: users are strongly encouraged to download annealing schedules for specific D-Wave Systems devices and load them using parse_dwave_annealing_schedule
.
Ising Functions
QuantumAnnealing.compute_ising_energy_levels
— Methodgiven an Ising model computes a mapping from energy values to collections of state integers
QuantumAnnealing.compute_ising_state_energies
— Methodgiven an Ising model computes a mapping from state integers to energy values
QuantumAnnealing.eval_ising_state_energy
— Methodgiven a state vector of spin values and an Ising model computes the energy of that spin configuration
QuantumAnnealing.print_ising_energy_levels
— Methodgiven an Ising model prints state strings by ascending energy levels. limit
is used the stop the printing after a number of energy levels have been presented (limit
<= 0 will print all states).
D-Wave Functions
QuantumAnnealing.annealing_protocol_dwave
— MethodFunction to modify an existing annealing schedule to use a customized annealing schedule (asch). These parameters are the same as those used in a dwisc call or a dwave schedule. Inputs: annealingschedule - annealingschedule
Parameters: asch - This is the annealing-schedule parameter. This is a list of tuples of the form [(s₀,seffective₀), (s₀,seffective₁), ..., (sₙ,s_effectiveₙ)].
QuantumAnnealing.initial_state_default_dwave
— Methodground state of sumi A(0)Xi where A(0) < 0 and B(0) = 0
QuantumAnnealing.read_bqpjson
— MethodThis function reads in a bqpjson file and generates the ising model dictionary inputs: bqpjson::String - a bqpjson file (v1.0.0) that can be run on D-Wave hardware outputs: n - number of qubits ising_model::Dict{Tuple => Float64} - Dictionary of qubits and couplings to weights mapping:Dict{Int => Int} - mapping of the qubits in the bqpjson file to simulation qubits
QuantumAnnealing.read_dwave_annealing_schedule
— Methodfunction to take a CSV of DWave annealing schedule values and convert it into an annealing schedule usable by the simulator. valid values for interpolation are :none, :linear, :quadratic
QuantumAnnealing.simulate_bqpjson
— Methodfunction that allows for simulation from a bqpjson data file
QuantumAnnealing.simulate_bqpjson_noisy
— Methodfunction that allows for simulation with x and z noise from a bqpjson data file. The x_bias
and z_bias
parameters provide vectors of noise realizations.