qp.labs.trotter_error

This module contains tools for estimating the Trotter error of product formulas used in Hamiltonian simulation.

Warning

This module is experimental. Frequent changes will occur, with no guarantees of stability or backwards compatibility.

Abstract Base Classes

Fragment()

Abstract class used to define a fragment object for product formula error estimation.

TrotterState()

Abstract class used to define a state object for perturbation error estimation.

Fragments

NumpyFragment(fragment)

A wrapper class for NumPy arrays to be used in the Trotter error functions

NumpyState(state)

State wrapper for Numpy objects.

SparseFragment(fragment)

A wrapper class for scipy sparse matrices to be used in the Trotter error functions.

SparseState(state)

A wrapper class to allow scipy sparse vectors to be used in the Trotter error estimation functions.

vibrational_fragments(modes, freqs, ...[, ...])

Returns a list of fragments summing to a vibrational Hamiltonian.

vibronic_fragments(states, modes, freqs, ...)

Returns a list of fragments summing to a vibronic Hamiltonian.

Product Formulas

ProductFormula(symbols[, exponent])

A symbolic representation of a product formula for Hamiltonian simulation.

ImportanceConfig(topk, weights[, history])

Enable the importance sampling feature of perturbation_error().

bch_expansion(product_formula, max_order)

Return the Baker--Campbell--Hausdorff (BCH) expansion of a product formula.

effective_hamiltonian(product_formula, ...)

Compute the effective Hamiltonian \(\hat{H}_{eff} = \hat{H} + \hat{\epsilon}\) that corresponds to a given product formula.

perturbation_error(product_formula, ...[, ...])

Computes the perturbation theory error using the effective Hamiltonian \(\hat{H}_{eff} = \hat{H} + \hat{\epsilon}\) for a given product formula.

Realspace Representations

HOState(modes, gridpoints, state)

Represent a wavefunction in the harmonic oscillator basis.

VibronicHO(states, modes, gridpoints, ho_states)

Represent the tensor product of harmonic oscillator states.

RealspaceCoeffs(tensor[, label])

Lightweight representation of a tensor of coefficients of a real space operator.

RealspaceMatrix(states, modes[, blocks])

Implements a dictionary of RealspaceSum objects.

RealspaceOperator(modes, ops, coeffs)

Represents a linear combination of a product of position and momentum operators.

RealspaceSum(modes, ops)

Represents a linear combination of RealspaceOperator objects.