Function createPauliHamil

Source
pub unsafe extern "C" fn createPauliHamil(
    numQubits: c_int,
    numSumTerms: c_int,
) -> PauliHamil
Expand description

Dynamically allocates a Hamiltonian expressed as a real-weighted sum of products of Pauli operators.

A ::PauliHamil is merely an encapsulation of the multiple parameters of functions like applyPauliSum().

The Pauli operators (PauliHamil.pauliCodes) are all initialised to identity (::PAULI_I), but the coefficients (PauliHamil.termCoeffs) are not initialised.

The Hamiltonian can be used in functions like applyPauliHamil() and applyTrotterCircuit(), with \p Qureg instances of the same number of qubits.

A ::PauliHamil can be modified directly (see ::PauliHamil), or through initPauliHamil(). It can furthermore be created and initialised from a file description directly with createPauliHamilFromFile().

The returned dynamic \p PauliHamil instance must later be freed via destroyPauliHamil().

@see

  • createPauliHamilFromFile()
  • createDiagonalOpFromPauliHamilFile()
  • initPauliHamil()
  • destroyPauliHamil()
  • applyPauliSum()
  • applyTrotterCircuit()
  • calcExpecPauliHamil()

@ingroup type @param[in] numQubits the number of qubits on which this Hamiltonian acts @param[in] numSumTerms the number of weighted terms in the sum, or the number of Pauli products @returns a dynamic \p PauliHamil struct, with fields \p pauliCodes and \p termCoeffs stored in the heap @throws invalidQuESTInputError()

  • if \p numQubits <= 0
  • if \p numSumTerms <= 0 @author Tyson Jones