Skip to content

pmm_tools.utils

Functions

NameDescription
evaluate_hamiltonianCompute the Hamiltonian from terms for a set of parameters
fermionic_eigshDiagonalize a Hamiltonian using fermionic superselection rules.

evaluate_hamiltonianfunction#

def evaluate_hamiltonian(params, terms, sparse)

Compute the Hamiltonian from terms for a set of parameters

fermionic_eigshfunction#

def fermionic_eigsh(hamiltonian, parity, k=6)

Diagonalize a Hamiltonian using fermionic superselection rules. The Hamiltonian is assumed to be block-diagonal in the parity subspaces. The function returns the eigenvalues and eigenvectors of the Hamiltonian, sorted by increasing energy.

Parameters

NameTypeDefaultDescription
hamiltonianscipy.sparse.csr_matrixrequired

The Hamiltonian matrix to be diagonalized.

parityscipy.sparse.csr_matrixrequired

The parity operator matrix, which is assumed to be diagonal in the same basis as the Hamiltonian.

kint6

The number of eigenvalues and eigenvectors to compute. Default is 6.

Returns

evalslist of numpy.ndarray

The eigenvalues of the Hamiltonian separated in parity subspaces.

evecslist of numpy.ndarray

The eigenvectors of the Hamiltonian separated in parity subspaces.