DressedBasis

class DressedBasis(subsystems, basis_vectors, evals, indices=None)[source]

Bases: ONBasis

A basis with labels of the form {“index”: index, “eval”: eval}, where each eval is a float representing an eigenvalue.

Initialize a basis where each element has an associated eval.

The labels for the basis vectors will be dictionaries with keys “index” and “eval”. Note that the ground_state property will always return the first basis vector.

Parameters:
  • subsytems – List of subsystems.

  • basis_vectors – 2d array of basis vectors.

  • evals – 1d array or list of eigenvalues.

  • indices (Optional[List]) – Optional indexing of basis vectors (defaults to standard).

Methods

decompose(x)

Return the coefficients of the projection of a vector x in the basis.

classmethod from_hamiltonian(hamiltonian, subsystems, ordering='default')[source]

Build a DressedBasis instance from the eigendecomposition of a Hamiltonian, ordered in terms of non-decreasing eigenvalues.

Parameters:
  • hamiltonian (Union[ndarray, AbstractSubsystemOperator]) – The Hamiltonian operator.

  • subsystems (List[Subsystem]) – A list of subsystem instances.

  • ordering (str) – The ordering with which to set the basis. The value "default" returns the basis ordered according to the entries of the vectors with the maximum absolute value.

low_energy_states(cutoff_energy)[source]

Return a DressedBasis object corresponding to a low energy subspace.

probabilities(x)

Treating x as a state vector or density matrix, compute the probabilities of observing the outcomes of a measurement defined by the basis vectors.

Parameters:

x (ndarray) – The statevector or density matrix. Which case is determined by x.ndim.

Returns:

A 1-d array representing probabilities computed according to the Born rule.

project(x)

Project a vector x onto the subspace spanned by the basis.

subset(condition)

Get a new ONBasis consisting of a subset of this one filtered according to the condition function defined on the basis labels.

Parameters:

condition (Callable) – A boolean-valued function on the labels of this instance of ONBasis.

Returns:

An ONBasis consisting of the (vector, label) pairs in this one for which

condition(label) == True.

Return type:

ONBasis

Attributes

basis_vectors

Basis vectors as the columns of an 2-d array.

basis_vectors_adj

Adjoint of the basis vectors matrix.

computational_states

Get subspace of all states with subsystem indices <=0.

evals

The eigenvalues.

ground_state

Return the first basis vector.

labels

Basis element labels.

projection

Matrix for the orthogonal projection onto the subspace spanned by the basis.

subsystems

Subsystems representing the tensor product space on which the basis is defined.