qarp.operators.functions

openfermion-compatible free functions over the qarpx operator classes.

Import these directly from this module (from qarp.operators.functions import hermitian_conjugated) — under the curated-export convention (§15) these stay module-qualified: the raw C++ transform aliases would collide conceptually with the Mapping classes at package level.

Matrix realization is a method, not a function here: operator.sparse_matrix() (qarpx LSB, §1). openfermion’s MSB get_sparse_operator lives in qarp.operators.compat, the interop module.

qarp.operators.functions.antihermitize(operator: FermionOperator) FermionOperator[source]

Anti-hermitian part builder: A - A†.

Single-operator, like every other function here; map it over a list with a comprehension. hermitian_conjugated is the conjugate on its own.

qarp.operators.functions.eigenspectrum(operator, n_qubits=None)[source]

openfermion-compatible sorted eigenvalues of the dense matrix.

Basis-invariant, so realized via operator.sparse_matrix() (LSB, §1). Hermitian operators go through eigvalsh; non-hermitian fall back to eigvals sorted lexicographically, matching openfermion.

qarp.operators.functions.hermitian_conjugated(op: qarpx.QubitOperator) qarpx.QubitOperator
qarp.operators.functions.hermitian_conjugated(op: qarpx.FermionOperator) qarpx.FermionOperator
qarp.operators.functions.count_qubits(op: qarpx.QubitOperator) int
qarp.operators.functions.count_qubits(op: qarpx.FermionOperator) int
qarp.operators.functions.is_hermitian(op: qarpx.QubitOperator) bool
qarp.operators.functions.is_hermitian(op: qarpx.FermionOperator) bool
qarp.operators.functions.jordan_wigner(op: qarpx.FermionOperator) qarpx.QubitOperator
qarp.operators.functions.jordan_wigner(ops: collections.abc.Sequence[qarpx.FermionOperator]) list[qarpx.QubitOperator]
qarp.operators.functions.bravyi_kitaev(op: qarpx.FermionOperator, n_qubits: object | None = None) qarpx.QubitOperator
qarp.operators.functions.bravyi_kitaev(ops: collections.abc.Sequence[qarpx.FermionOperator], n_qubits: object | None = None) list[qarpx.QubitOperator]
qarp.operators.functions.parity_transform(op: qarpx.FermionOperator, n_qubits: int) qarpx.QubitOperator
qarp.operators.functions.parity_transform(ops: collections.abc.Sequence[qarpx.FermionOperator], n_qubits: int) list[qarpx.QubitOperator]