qcheff.operators.operators¶
Module Contents¶
Functions¶
Identity operator in sparse/dense format |
|
Creation operator in sparse/dense format. |
|
Destruction operator in sparse/dense format. |
|
Number operator in sparse/dense format |
|
Identity operator in sparse/dense format. |
|
Basis vector in sparse/dense format. |
|
Projector operator in sparse/dense format |
|
Charge operator in sparse/dense format |
|
Position operator in sparse/dense format |
|
Momentum operator in sparse/dense format |
|
Pauli-X operator in sparse/dense format |
|
Pauli-Y operator in sparse/dense format. |
|
Pauli-Z operator in sparse/dense format |
|
Raising operator in sparse/dense format |
|
Lowering operator in sparse/dense format. |
API¶
- eye(n: int, dtype: type | None = None, sparse: bool | None = None)¶
Identity operator in sparse/dense format
Parameters
n: int dimension of the Hilbert space
dtype: Type | None Data type of the operator. If None, use the default data type.
sparse: bool | None If True, return a sparse operator. If False, return a dense operator. If None, return the default format.
- create(n: int, dtype: type | None = None, sparse: bool | None = None)¶
Creation operator in sparse/dense format.
Parameters
n : int Dimension of the Hilbert space. dtype : Type | None Data type of the operator. If None, use the default data type. sparse : bool | None If True, return a sparse operator. If False, return a dense operator. If None, return the default format.
Returns
OperatorMatrix The creation operator.
- destroy(n: int, dtype: type | None = None, sparse: bool | None = None)¶
Destruction operator in sparse/dense format.
Parameters
n : int Dimension of the Hilbert space. dtype : Type | None Data type of the operator. If None, use the default data type. sparse : bool | None If True, return a sparse operator. If False, return a dense operator. If None, return the default format.
Returns
OperatorMatrix The destruction operator.
- number(n: int, dtype: type | None = None, sparse: bool | None = None)¶
Number operator in sparse/dense format
Parameters
n : int Dimension of the Hilbert space. dtype : Type | None Data type of the operator. If None, use the default data type. sparse : bool | None If True, return a sparse operator. If False, return a dense operator. If None, return the default format.
Returns
OperatorMatrix The number operator.
- identity(n: int, dtype: type | None = None, sparse: bool | None = None)¶
Identity operator in sparse/dense format.
Parameters
n : int Dimension of the Hilbert space. dtype : Type | None Data type of the operator. If None, use the default data type. sparse : bool | None If True, return a sparse operator. If False, return a dense operator. If None, return the default format.
Returns
OperatorMatrix The identity operator.
- basis(n: int, i: int, dtype: type | None = None, sparse: bool | None = None)¶
Basis vector in sparse/dense format.
Parameters
n : int Dimension of the Hilbert space. i : int Index of the basis. dtype : Type | None Data type of the operator. If None, use the default data type. sparse : bool | None If True, return a sparse operator. If False, return a dense operator. If None, return the default format.
Returns
OperatorMatrix The basis vector.
- projector(n: int, i: int, j: int, dtype: type | None = None, sparse: bool | None = None)¶
Projector operator in sparse/dense format
Parameters
n : int dimension of the Hilbert space i : int Index of the basis j : int Index of the basis dtype : Type | None, optional Data type of the operator. If None, use the default data type. By default None sparse : bool | None, optional If True, return a sparse operator. If False, return a dense operator. If None, return the default format. By default None
- charge(n: int, dtype: type | None = None, sparse: bool | None = None)¶
Charge operator in sparse/dense format
Parameters
n : int Dimension of the Hilbert space dtype : Type | None, optional Data type of the operator. If None, use the default data type. sparse : bool | None, optional If True, return a sparse operator. If False, return a dense operator. If None, return the default format.
Returns
OperatorMatrix The charge operator.
- position(n: int, dtype: type | None = None, sparse: bool | None = None)¶
Position operator in sparse/dense format
Parameters
n : int Dimension of the Hilbert space dtype : Type | None, optional Data type of the operator. If None, use the default data type. sparse : bool | None, optional If True, return a sparse operator. If False, return a dense operator. If None, return the default format.
Returns
OperatorMatrix The position operator
- momentum(n: int, dtype: type | None = None, sparse: bool | None = None)¶
Momentum operator in sparse/dense format
Parameters
n : int Dimension of the Hilbert space dtype : Type | None, optional Data type of the operator. If None, use the default data type. sparse : bool | None, optional If True, return a sparse operator. If False, return a dense operator. If None, return the default format.
Returns
OperatorMatrix The momentum operator
- sigmax(dtype: type | None = None, sparse: bool | None = None)¶
Pauli-X operator in sparse/dense format
Parameters
dtype : Type | None Data type of the operator. If None, use the default data type. sparse : bool | None If True, return a sparse operator. If False, return a dense operator. If None, return the default format.
Returns
OperatorMatrix The Pauli-X operator
- sigmay(dtype: type | None = None, sparse: bool | None = None)¶
Pauli-Y operator in sparse/dense format.
Parameters
dtype : Type | None Data type of the operator. If None, use the default data type. sparse : bool | None If True, return a sparse operator. If False, return a dense operator. If None, return the default format.
Returns
OperatorMatrix The Pauli-Y operator
- sigmaz(dtype: type | None = None, sparse: bool | None = None)¶
Pauli-Z operator in sparse/dense format
Parameters
dtype: Type | None Data type of the operator. If None, use the default data type.
sparse: bool | None If True, return a sparse operator. If False, return a dense operator. If None, return the default format.
- sigmap(dtype: type | None = None, sparse: bool | None = None)¶
Raising operator in sparse/dense format
Parameters
dtype : Type | None Data type of the operator. If None, use the default data type. sparse : bool | None If True, return a sparse operator. If False, return a dense operator. If None, return the default format.
Returns
OperatorMatrix The raising operator.
- sigmam(dtype: type | None = None, sparse: bool | None = None)¶
Lowering operator in sparse/dense format.
Parameters
dtype : Type | None Data type of the operator. If None, use the default data type. sparse : bool | None If True, return a sparse operator. If False, return a dense operator. If None, return the default format.
Returns
OperatorMatrix The lowering operator.