Welcome to hamnonlineng’s documentation!

Engineering Hamiltonians through Nonlinearities

Following the formalism described in “Black-box 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 non-linear 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 non-linear 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 off-resonant).

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 list monomials.

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 list to_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 in solution.

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 list monomials 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.retain_matching(monomials, to_retain)[source]

The inverse of drop_matching.

hamnonlineng.core.sin_terms(x, order)[source]

Given an argument return the order-th 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.

hamnonlineng.core.solve_linearprog_scipy(resonant_monomials, off_resonant_monomials, letters, maxfreq=10, detune=0.5)[source]

Uses scipy to solve the linear programming problem.

hamnonlineng.core.split_by_predicate(p, l)[source]

Separate an iterable in two iterators depending on predicate.

Indices and tables