Skip to content

dq.fcreate

fcreate(n: int, *, layout: Layout | None = None) -> QArray | tuple[QArray, ...]

Returns a fermionic creation operator, or a tuple of creation operators for a multi-mode system.

If n=1, it returns the single-mode creation operator \(a^\dag = \begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix}\). If n>1, it returns a tuple with n operators \((a_1^\dag,\dots,a_n^\dag)\) acting on the composite Hilbert space of dimension \(2^n\). To satisfy the anti-commutation relations \(\{a_j, a_k^\dag\} = \delta_{jk}\) and \(\{a_j^\dag, a_k^\dag\} = 0\), they are constructed with the Jordan-Wigner transformation: $$ a_k^\dag = \sigma_z^{\otimes (k-1)} \otimes a^\dag \otimes I_2^{\otimes (n-k)}. $$

Parameters:

  • n –

    Number of fermionic modes.

  • layout –

    Matrix layout (dq.dense, dq.dia or None).

Returns:

  • (qarray or tuple of qarrays, each of shape (2^n, 2^n)) –

    Creation operator(s).

Examples:

Single-mode \(a^\dag\):

>>> dq.fcreate(1)
QArray: shape=(2, 2), dims=(2,), dtype=complex64, layout=dia, ndiags=1
[[  â‹…      â‹…   ]
 [1.+0.j   â‹…   ]]

Multi-mode \(a_1^\dag = a^\dag \otimes I_2\) and \(a_2^\dag = \sigma_z \otimes a^\dag\):

>>> a1dag, a2dag = dq.fcreate(2)
>>> a1dag
QArray: shape=(4, 4), dims=(2, 2), dtype=complex64, layout=dia, ndiags=1
[[  â‹…      â‹…      â‹…      â‹…   ]
 [  â‹…      â‹…      â‹…      â‹…   ]
 [1.+0.j   â‹…      â‹…      â‹…   ]
 [  â‹…    1.+0.j   â‹…      â‹…   ]]
>>> a2dag
QArray: shape=(4, 4), dims=(2, 2), dtype=complex64, layout=dia, ndiags=1
[[   â‹…       â‹…       â‹…       â‹…   ]
 [ 1.+0.j    â‹…       â‹…       â‹…   ]
 [   â‹…       â‹…       â‹…       â‹…   ]
 [   â‹…       â‹…    -1.+0.j    â‹…   ]]