mindquantum.core.operators.sz_operator

View Source On Gitee
mindquantum.core.operators.sz_operator(n_spatial_orbitals)[source]

Return the sz operator.

Note

The default index order spin_up (alpha) corresponds to even index, while the spin_down (beta) corresponds to odd.

Parameters

n_spatial_orbitals (int) – number of spatial orbitals (n_qubits // 2).

Returns

FermionOperator, corresponding to the sz operator over n_spatial_orbitals.

Examples

>>> from mindquantum.core.operators import sz_operator
>>> sz_operator(3)
1/2 [0^ 0] +
-1/2 [1^ 1] +
1/2 [2^ 2] +
-1/2 [3^ 3] +
1/2 [4^ 4] +
-1/2 [5^ 5]