qcheff.operators.operators

Module Contents

Functions

eye

Identity operator in sparse/dense format

create

Creation operator in sparse/dense format.

destroy

Destruction operator in sparse/dense format.

number

Number operator in sparse/dense format

identity

Identity operator in sparse/dense format.

basis

Basis vector in sparse/dense format.

projector

Projector operator in sparse/dense format

charge

Charge operator in sparse/dense format

position

Position operator in sparse/dense format

momentum

Momentum operator in sparse/dense format

sigmax

Pauli-X operator in sparse/dense format

sigmay

Pauli-Y operator in sparse/dense format.

sigmaz

Pauli-Z operator in sparse/dense format

sigmap

Raising operator in sparse/dense format

sigmam

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.