Module: openfermion.utils


bch_expansion module: Module to efficiently compute the Baker-Campbell-Hausdorff formula.

channel_state module: Module to manipulate basic models of quantum channels

commutators module: Module to compute commutators, with optimizations for specific systems.

grid module

indexing module: Defines index mappings.

lattice module

operator_utils module: This module provides generic tools for classes in ops/

rdm_mapping_functions module: Mapping RDMs to other RDMs


class Grid: A multi-dimension grid of points with an assigned length scale.

class HubbardLattice: Base class for a Hubbard model lattice.

class HubbardSquareLattice: A square lattice for a Hubbard model.

class OperatorSpecificationError: Common base class for all non-exit exceptions.

class OperatorUtilsError: Common base class for all non-exit exceptions.

class Spin: An enumeration.

class SpinPairs: The spin orbitals corresponding to a pair of spatial orbitals.


amplitude_damping_channel(...): Apply an amplitude damping channel

anticommutator(...): Compute the anticommutator of two operators.

bch_expand(...): Compute log[e^{x_1} ... e^{x_N}] using the BCH formula.

commutator(...): Compute the commutator of two operators.

count_qubits(...): Compute the minimum number of qubits on which operator acts.

dephasing_channel(...): Apply a dephasing channel

depolarizing_channel(...): Apply a depolarizing channel

double_commutator(...): Return the double commutator [op1, [op2, op3]].

down_index(...): Function to return down-orbital index given a spatial orbital index.

get_file_path(...): Compute file_path for the file that stores operator.

hermitian_conjugated(...): Return Hermitian conjugate of operator.

is_hermitian(...): Test if operator is Hermitian.

is_identity(...): Check whether QubitOperator of FermionOperator is identity.


load_operator(...): Load FermionOperator or QubitOperator from file.

map_one_hole_dm_to_one_pdm(...): Convert a 1-hole-RDM to a 1-RDM

map_one_pdm_to_one_hole_dm(...): Convert a 1-RDM to a 1-hole-RDM

map_particle_hole_dm_to_one_pdm(...): Map the particle-hole-RDM to the 1-RDM

map_particle_hole_dm_to_two_pdm(...): Map the 2-RDM to the particle-hole-RDM

map_two_hole_dm_to_one_hole_dm(...): Map from 2-hole-RDM to 1-hole-RDM

map_two_hole_dm_to_two_pdm(...): Map from the 2-hole-RDM to the 2-RDM

map_two_pdm_to_one_pdm(...): Contract a 2-RDM to a 1-RDM

map_two_pdm_to_particle_hole_dm(...): Map the 2-RDM to the particle-hole-RDM

map_two_pdm_to_two_hole_dm(...): Map from the 2-RDM to the 2-hole-RDM

save_operator(...): Save FermionOperator or QubitOperator to file.

trivially_commutes_dual_basis(...): Determine whether the given terms trivially commute.

trivially_double_commutes_dual_basis(...): Check if the double commutator [term_a, [term_b, term_c]] is zero.

trivially_double_commutes_dual_basis_using_term_info(...): Return whether [op_a, [op_b, op_a_prime]] is trivially zero.

up_index(...): Function to return up-orbital index given a spatial orbital index.

up_then_down(...): up then down reordering, given the operator has the default even-odd ordering.