HilbertSpace Class

HilbertSpace

class scqubits.HilbertSpace(subsystem_list, interaction_list=None)[source]

Class holding information about the full Hilbert space, usually composed of multiple subsys_list. The class provides methods to turn subsystem operators into operators acting on the full Hilbert space, and establishes the interface to qutip. Returned operators are of the qutip.Qobj type. The class also provides methods for obtaining eigenvalues, absorption and emission spectra as a function of an external parameter.

annihilate(subsystem)[source]

Annihilation operator a for subsystem

Parameters

subsystem (object derived from QuantumSystem) – specifies subsystem in which annihilation operator acts

Returns

Return type

qutip.Qobj operator

bare_hamiltonian()[source]
Returns

composite Hamiltonian composed of bare Hamiltonians of subsys_list independent of the external parameter

Return type

qutip.Qobj operator

broadcast(event, **kwargs)

Request a broadcast from CENTRAL_DISPATCH reporting event.

Parameters
  • event (str) – event name from EVENTS

  • **kwargs

classmethod create_from_file(filename)

Read initdata and spectral data from file, and use those to create a new SpectrumData object.

Parameters

filename (str) –

Returns

new SpectrumData object, initialized with data read from file

Return type

SpectrumData

classmethod deserialize(io_data)

Take the given IOData and return an instance of the described class, initialized with the data stored in io_data.

Parameters

io_data (scqubits.io_utils.file_io_base.IOData) –

Returns

Return type

Serializable

diag_hamiltonian(subsystem, evals=None)[source]

Returns a qutip.Qobj which has the eigenenergies of the object subsystem on the diagonal.

Parameters
  • subsystem (object derived from QuantumSystem) – Subsystem for which the Hamiltonian is to be provided.

  • evals (ndarray, optional) – Eigenenergies can be provided as evals; otherwise, they are calculated.

Returns

Return type

qutip.Qobj operator

diag_operator(diag_elements, subsystem)[source]

For given diagonal elements of a diagonal operator in subsystem, return the Qobj operator for the full Hilbert space (perform wrapping in identities for other subsys_list).

Parameters
  • diag_elements (ndarray of floats) – diagonal elements of subsystem diagonal operator

  • subsystem (object derived from QuantumSystem) – subsystem where diagonal operator is defined

Returns

Return type

qutip.Qobj operator

property dimension

Returns total dimension of joint Hilbert space

Returns

Return type

int

eigensys(evals_count)[source]

Calculates eigenvalues and eigenvectore of the full Hamiltonian using qutip.Qob.eigenstates().

Parameters

evals_count (int, optional) – number of desired eigenvalues/eigenstates

Returns

  • evals (ndarray of float)

  • evecs (ndarray of Qobj kets)

eigenvals(evals_count=6)[source]

Calculates eigenvalues of the full Hamiltonian using qutip.Qob.eigenenergies().

Parameters

evals_count (int, optional) – number of desired eigenvalues/eigenstates

Returns

eigenvalues

Return type

ndarray of float

filewrite(filename)

Convenience method bound to the class. Simply accesses the write function.

Parameters

filename (str) –

get_bare_hamiltonian()[source]

Deprecated, use bare_hamiltonian() instead.

get_hamiltonian()[source]

Deprecated, use hamiltonian() instead.

get_initdata()[source]

Returns dict appropriate for creating/initializing a new HilbertSpace object.

Returns

Return type

dict

get_spectrum_vs_paramvals(param_vals, update_hilbertspace, evals_count=10, get_eigenstates=False, param_name='external_parameter', num_cpus=1)[source]

Return eigenvalues (and optionally eigenstates) of the full Hamiltonian as a function of a parameter. Parameter values are specified as a list or array in param_vals. The Hamiltonian hamiltonian_func must be a function of that particular parameter, and is expected to internally set subsystem parameters. If a filename string is provided, then eigenvalue data is written to that file.

Parameters
  • param_vals (ndarray of floats) – array of parameter values

  • update_hilbertspace (function) – update_hilbertspace(param_val) specifies how a change in the external parameter affects the Hilbert space components

  • evals_count (int, optional) – number of desired energy levels (default value = 10)

  • get_eigenstates (bool, optional) – set to true if eigenstates should be returned as well (default value = False)

  • param_name (str, optional) – name for the parameter that is varied in param_vals (default value = “external_parameter”)

  • num_cpus (int, optional) – number of cores to be used for computation (default value: settings.NUM_CPUS)

Returns

Return type

SpectrumData object

get_subsys_index(subsys)[source]

Return the index of the given subsystem in the HilbertSpace.

Parameters

subsys (QuantumSystem) –

Returns

Return type

int

hamiltonian()[source]
Returns

Hamiltonian of the composite system, including the interaction between components

Return type

qutip.qobj

hubbard_operator(j, k, subsystem)[source]

Hubbard operator \(|j\rangle\langle k|\) for system subsystem

Parameters
  • j,k (int) – eigenstate indices for Hubbard operator

  • subsystem (instance derived from QuantumSystem class) – subsystem in which Hubbard operator acts

Returns

Return type

qutip.Qobj operator

identity_wrap(operator, subsystem, op_in_eigenbasis=False, evecs=None)[source]

Wrap given operator in subspace subsystem in identity operators to form full Hilbert-space operator.

Parameters
  • operator (ndarray or qutip.Qobj or str) – operator acting in Hilbert space of subsystem; if str, then this should be an operator name in the subsystem, typically not in eigenbasis

  • subsystem (object derived from QuantumSystem) – subsystem where diagonal operator is defined

  • op_in_eigenbasis (bool) – whether operator is given in the subsystem eigenbasis; otherwise, the internal QuantumSystem basis is assumed

  • evecs (ndarray, optional) – internal QuantumSystem eigenstates, used to convert operator into eigenbasis

Returns

Return type

qutip.Qobj operator

interaction_hamiltonian()[source]
Returns

interaction Hamiltonian

Return type

qutip.Qobj operator

receive(event, sender, **kwargs)[source]

Receive a message from CENTRAL_DISPATCH and initiate action on it.

Parameters
  • event (str) – event name from EVENTS

  • sender (DispatchClient) – original sender reporting the event

  • **kwargs

serialize()

Convert the content of the current class instance into IOData format.

Returns

Return type

scqubits.io_utils.file_io_base.IOData

property subsystem_count

Returns number of subsys_list composing the joint Hilbert space

Returns

Return type

int

property subsystem_dims

Returns list of the Hilbert space dimensions of each subsystem

Returns

Return type

list of int