Quantum
Quantum realizations shared by the physics packages: qubits and bosonic modes.
ModeElement(label, psi=0, *, hilbert=None, visual=VisualSpec('expectations'))
Bases: Element
Bosonic mode of the Hilbert space it takes, with annihilate, create, and number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the mode. |
required |
psi
|
Annotated[object, StateSpec(domain=CC)]
|
The state in the Hilbert space: the number of quanta, or a vector. |
0
|
hilbert
|
HilbertSpec | None
|
The Hilbert space, |
None
|
visual
|
VisualSpec | None
|
How the mode is drawn. |
VisualSpec('expectations')
|
Examples:
>>> from skcomplex.systems.physics.common.quantum import ModeElement, mode_space
>>> ModeElement('cavity', hilbert=mode_space(4)).hilbert.dimension
5
Source code in src/skcomplex/systems/physics/common/quantum/_mode.py
73 74 75 76 77 78 79 80 81 82 83 | |
QubitElement(label, psi='up', *, hilbert=QUBIT, visual=VisualSpec('expectations'))
Bases: Element
Two-level system with the Pauli matrices x, y, z and the ladder operators plus and minus.
The state 'up', also 'excited', is index 0 with z = 1, and 'down', also 'ground', is index 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the qubit. |
required |
psi
|
Annotated[object, StateSpec(domain=CC)]
|
The state in the Hilbert space: |
'up'
|
hilbert
|
HilbertSpec
|
The Hilbert space of the qubit. |
QUBIT
|
visual
|
VisualSpec | None
|
How the qubit is drawn. |
VisualSpec('expectations')
|
Examples:
>>> from skcomplex.systems.physics.common.quantum import QubitElement
>>> sorted(QubitElement('q').hilbert.operators)
['minus', 'plus', 'x', 'y', 'z']
Source code in src/skcomplex/systems/physics/common/quantum/_qubit.py
51 52 53 54 55 56 57 58 59 60 61 | |
mode_space(quanta=4)
Return the Hilbert space of a bosonic mode truncated at a number of quanta.
Its operators are annihilate, create, and number, and its basis state n holds n quanta.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quanta
|
int
|
The largest number of quanta, so the dimension is |
4
|
Returns:
| Name | Type | Description |
|---|---|---|
space |
HilbertSpec
|
The Hilbert space. |
Raises:
| Type | Description |
|---|---|
ValidationError
|
The number of quanta is not a positive integer. |
Examples:
>>> from skcomplex.systems.physics.common.quantum import mode_space
>>> mode_space(4).dimension
5
Source code in src/skcomplex/systems/physics/common/quantum/_mode.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |