Welcome to hamnonlineng’s documentation!¶
Engineering Hamiltonians through Nonlinearities¶
Following the formalism described in “Blackbox superconducting circuit quantization” http://arxiv.org/abs/1204.0587 we can expand \(\sin(\hat{a}+\hat{b}+\dots+h.c.)\) or \(\cos(\hat{a}+\hat{b}+\dots+h.c.)\) or any other nonlinear \(f(\hat{a}+\hat{b}+\dots+h.c.)\) in order to obtain nonlinear terms in the Hamiltonian (a, b, and other letters represent the annihilation operators of various oscillator modes). If we drive some of the modes classically we can create any nonlinear term in the effective Hamiltonian.
This module helps solve the constraint on the frequencies of the modes (both the requirement that some of the monomials in the expansion are resonant and that all the other terms in the expansion of the nonlinearity are offresonant).
Example IPython Notebooks¶
Example 5th order Hamiltonian with integer frequencies in arbitrary units.
Example 5th order Hamiltonian with any positivevalued frequencies in arbitrary units.
Example 7th order Hamiltonian with a more complicated nonlinearity.
API Documentation¶

class
hamnonlineng.core.
Monomial
[source]¶ Bases:
object
A class representing a monomial of the type
number*operators + h.c.
.The h.c. part is implicit.
Operators have to be single letters. Capital letters stand for the hermitian conjugates of lower letters.
Monomial.n
is the numerical factor.Monomial.s
is the string of operators.>>> Monomial(1,'a')*Monomial(1,'b') 1.ab 1.aB

class
hamnonlineng.core.
Polynomial
[source]¶ Bases:
object
A class representing a sum of monomials (each monomial implicitly having its h.c.).
Polynomial.m
gives the list of monomials.

hamnonlineng.core.
detuning_of_monomial
(solution, monomials, letters)[source]¶ For the frequencies given in
solution
calculate the detuning of the Monomials given in the listmonomials
.

hamnonlineng.core.
drop_definitely_offresonant
(monomials)[source]¶ From the list
monomials
filter out Monomials that contain only annihilation or only creation operators.

hamnonlineng.core.
drop_matching
(monomials, to_drop)[source]¶ From the list
monomials
filter out Monomials present in the listto_drop
. Compare only the string part, neglect the numerical factor.

hamnonlineng.core.
drop_single_mode
(monomials)[source]¶ From the list
monomials
filter out Monomials that contain operators for only a single mode.

hamnonlineng.core.
filter_resonant
(solution, monomials, letters)[source]¶ Return only the resonant Monomials from the list
monomials
given the frequencies insolution
.

hamnonlineng.core.
head_and_count
(iterator)[source]¶ Print the first 10 and store the first 100000 solutions.

hamnonlineng.core.
monomial_to_constraint
(monomial, letters)[source]¶ Given a monomial return the multiplicity of each letter, counting conjugates as negatives.

hamnonlineng.core.
monomials_to_matrix
(monomials, letters)[source]¶ Run
monomial_to_constraint
on each element of the listmonomials
and generate the matrix of constraints.

hamnonlineng.core.
operator_sum
(string)[source]¶ Given a string of letters return the sum of operators represented by those letters.

hamnonlineng.core.
sin_terms
(x, order)[source]¶ Given an argument return the orderth term in the sine’s expansion.

hamnonlineng.core.
solve_constraints_gecode
(resonant_monomials, off_resonant_monomials, letters, maxfreq=10, elastic=0)[source]¶ Uses
gecode
to solve the constraints.

hamnonlineng.core.
solve_constraints_ortools
(resonant_monomials, off_resonant_monomials, letters, maxfreq=10)[source]¶ Uses
ortools
to solve the constraints.

hamnonlineng.core.
solve_linearprog_ortools_glop
(resonant_monomials, off_resonant_monomials, letters, maxfreq=10, detune=0.5)[source]¶ Uses
ortools
to solve the linear programming problem.

hamnonlineng.core.
solve_linearprog_pulp
(resonant_monomials, off_resonant_monomials, letters, maxfreq=10, detune=0.5, distinct=True, elastic=0)[source]¶ Uses
pulp
to solve the linear programming problem.