C++ API ======= The library is header-only under ``include/pauliengine/`` and needs nothing but a C++20 compiler; OpenMP is optional (compile with ``-DPAULIENGINE_HAS_OPENMP`` and your compiler's OpenMP flag). ``PauliString``, ``QubitHamiltonian`` (in Python ``PauliStringSum``), the sparse classes, ``PauliCycle``, ``PauliCycleSum`` and ``PauliOrbitSum`` are templates over the coefficient type: ``std::complex`` or the polynomial ``pauliengine::symbolic::Expression`` from ``Polynomial.h``. Operations exposed in Python are available in C++ under the same name, with these exceptions: - ``PauliStringSum.from_matrix`` is the free function ``pauli_decomposition`` (``PauliDecomposition.h``). - ``to_pauli_string_sum`` (cycles, orbits, unweighted sets) is ``to_qubit_hamiltonian``. - ``inner_product`` and mixed-type ``commutator`` are free functions ``inner_product(a, b)`` and ``commutator(a, b)`` (``Arithmetic.h``). - ``subs`` is ``substitute`` and ``PauliString.get_pauli_at_index`` is ``get_pauli_from_index``. - The factories (``pe.PauliString``, ``pe.PauliStringSum``, ...) and ``set_sparse_threshold`` exist in Python only: in C++ you choose the class, for example ``SparsePauliStringSum`` for low-weight operators on many qubits, and convert with ``to_dense()`` or the constructor from a ``QubitHamiltonian``. Pauli strings ------------- .. doxygenclass:: PauliString :members: :undoc-members: .. doxygenclass:: unweighted_pauliString :members: :undoc-members: .. doxygenclass:: WordVec :members: :undoc-members: Qubit Hamiltonians ------------------ .. doxygenclass:: QubitHamiltonian :members: :undoc-members: .. doxygenclass:: unweighted_QubitHamiltonian :members: :undoc-members: Sparse Pauli strings and sums ----------------------------- For low-weight operators on many qubits: only the non-identity sites are stored, so products and commutators cost O(weight) per pair instead of O(n / 64). .. doxygenclass:: SparsePauliString :members: :undoc-members: .. doxygenclass:: SparsePauliStringSum :members: :undoc-members: Symbolic coefficients --------------------- .. doxygenclass:: pauliengine::symbolic::Expression :members: :undoc-members: Pauli cycles ------------ .. doxygenclass:: PauliCycle :members: :undoc-members: .. doxygenclass:: PauliCycleSum :members: :undoc-members: Pauli orbits ------------ .. doxygenclass:: PauliOrbit :members: :undoc-members: .. doxygenclass:: PauliOrbitSum :members: :undoc-members: Arithmetic between representations ---------------------------------- ``include/pauliengine/Arithmetic.h`` overloads ``+``, ``-``, ``*`` and provides the free functions ``commutator(a, b)`` and ``inner_product(a, b)`` for every pair of representations. .. doxygenfile:: Arithmetic.h Pauli decomposition ------------------- .. doxygenfile:: PauliDecomposition.h