Closed amccaskey closed 1 month ago
For example, the
spin_op op = x(0) * y(1) - 2.0 * z(0) z(1)
would contain 2 pauli words, specificallyX0 Y1
andZ0 Z1
(I propose we ignore the coefficient as part of ourcudaq::pauli_word
type, coefficients can be extracted from aspin_op
and passed separately as astd::vector<double>
).
I think there is a lot of value in having additional pauli types. To properly model a single in a spin_op, would we support all of the math operations that can be done between two spin_op_terms?
As for naming, I think "pauli_word" is a good descriptor for the latter case where the lack of math/phase support is perhaps suggested in the name. If there is math support, then perhaps it could be called a "pauli_element" or something suggestive of the fact that these are elements of the n-qubit Pauli group with support for math/phases.
RFC needs updating to capture the complete API available from both C++ and Python.
Closing this as supported to the extend that it was defined here.
A powerful mechanism for circuit synthesis would be to accept
cudaq::spin_op
as input to a quantum kernel and use that with a synthesis operation likeexp_pauli
. Fully supportingspin_op
via the AST Bridge and MLIR is a large task. An easier stepping stone that would enable a wide range of use cases (ones we are already seeing) is to introduce acudaq::pauli_word
type. This type would model a single term in aspin_op
. For example, thespin_op op = x(0) * y(1) - 2.0 * z(0) z(1)
would contain 2 pauli words, specificallyX0 Y1
andZ0 Z1
(I propose we ignore the coefficient as part of ourcudaq::pauli_word
type, coefficients can be extracted from aspin_op
and passed separately as astd::vector<double>
). So the type would effectively provide an opaque type that map to aptr<i8>
in the AST Bridge and be compatible with our existingExpPauliOp
.Note this is related to PR #1062. It seems smarter to force this type of input to be a separate type in the language rather than a catch-all
const char *
.