QubitSpace¶
- class qugradlab.hilbert_spaces.QubitSpace(qubits: int)[source]¶
Bases:
QuditSpaceA computational Hilbert space.
Attributes
An array of positive integers labeling the Hilbert space basis
The Hilbert space dimension
An array satisfying the property
self.inverse[self.basis[i]]=iThe number of qubits
Methods
Initialises a
QubitSpaceReturns a column vector represnetation corresponding to the input basis state label.
Generates a boolean filter for the computation basis states in
basis.Initialises a
qugrad.HilbertSpacecorresponding the computation subspace.Dialates an operator \(\hat O\) that acts on the computational subspace to an operator \(\hat O\oplus 0\) that acts on the whole Hilbert space.
Generates a new subspace by filtering the basis state labels.
Generates a string (list of strings) that represent the state(s).
Projects an operator that acts on the Hilbert space to an operator that acts only on the computational subspace.
- __init__(qubits: int)[source]¶
Initialises a
QubitSpace- Parameters:
qubits (int) – The number of qubits
- basis_vector(basis_state_label: int) ndarray[complex128]¶
Returns a column vector represnetation corresponding to the input basis state label.
- computational_projector()[source]¶
Generates a boolean filter for the computation basis states in
basis.
- computational_subspace() HilbertSpace¶
Initialises a
qugrad.HilbertSpacecorresponding the computation subspace.- Returns:
The computational subspace
- Return type:
- dialate_operator(operator: ndarray) ndarray¶
Dialates an operator \(\hat O\) that acts on the computational subspace to an operator \(\hat O\oplus 0\) that acts on the whole Hilbert space.
- get_subspace(filter: ndarray[bool]) HilbertSpace¶
Generates a new subspace by filtering the basis state labels.
- Parameters:
filter (NDArray[Shape[
dim], bool]) –Trueentries are retained in the new subspace.- Returns:
The filtered subspace.
- Return type:
HilbertSpace
- labels(states: int | list[int] | None = None) str | list[str][source]¶
Generates a string (list of strings) that represent the state(s).
- project_operator(operator: ndarray) ndarray¶
Projects an operator that acts on the Hilbert space to an operator that acts only on the computational subspace.
- property dim¶
The Hilbert space dimension