Welcome to hamnonlineng’s documentation! — hamnonlineng 0.1.0a2 documentation

# 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).

# Example IPython Notebooks

Example 5th order Hamiltonian with integer frequencies in arbitrary units.

Example 5th order Hamiltonian with any positive-valued frequencies in arbitrary units.

Example 7th order Hamiltonian with no solutions in the specified range (integer frequencies lower than 50 units).

# API Documentation

class `hamnonlineng.core.` `Monomial`

  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`

  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)

  For the frequencies given in `solution` calculate the detuning of the Monomials given in the list `monomials`.

`hamnonlineng.core.` `drop_definitely_offresonant`(monomials)

  From the list `monomials` filter out Monomials that contain only annihilation or only creation operators.

`hamnonlineng.core.` `drop_matching`(monomials, to_drop)

  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)

  From the list `monomials` filter out Monomials that contain operators for only a single mode.

`hamnonlineng.core.` `filter_resonant`(solution, monomials, letters)

  Return only the resonant Monomials from the list `monomials` given the frequencies in `solution`.

`hamnonlineng.core.` `head_and_count`(iterator)

  Print the first 10 and store the first 100000 solutions.

`hamnonlineng.core.` `monomial_to_constraint`(monomial, letters)

  Given a monomial return the multiplicity of each letter, counting conjugates as negatives.

`hamnonlineng.core.` `monomials_to_matrix`(monomials, letters)

  Run `monomial_to_constraint` on each element of the list `monomials` and generate the matrix of constraints.

`hamnonlineng.core.` `operator_sum`(string)

  Given a string of letters return the sum of operators represented by those letters.

`hamnonlineng.core.` `retain_matching`(monomials, to_retain)

  The inverse of `drop_matching`.

`hamnonlineng.core.` `sin_terms`(x, order)

  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)

  Uses `gecode` to solve the constraints.

`hamnonlineng.core.` `solve_constraints_ortools`(resonant_monomials, off_resonant_monomials, letters, maxfreq=10)

  Uses `ortools` to solve the constraints.

`hamnonlineng.core.` `solve_linearprog_ortools_glop`(resonant_monomials, off_resonant_monomials, letters, maxfreq=10, detune=0.5)

  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)

  Uses `pulp` to solve the linear programming problem.

`hamnonlineng.core.` `solve_linearprog_scipy`(resonant_monomials, off_resonant_monomials, letters, maxfreq=10, detune=0.5)

  Uses `scipy` to solve the linear programming problem.

`hamnonlineng.core.` `split_by_predicate`(p, l)

  Separate an iterable in two iterators depending on predicate.

# Indices and tables

- Index
- Module Index
- Search Page