google / qhbm-library

Quantum Hamiltonian-Based Models built on TensorFlow Quantum
https://qhbm-library.readthedocs.io/en/latest/
Apache License 2.0
40 stars 15 forks source link

Utilities for modular Hamiltonian expectation #97

Closed zaqqwerty closed 2 years ago

zaqqwerty commented 2 years ago

Bitstring and QNN utilities needed for #95.

To take an expectation value of a general modular Hamiltonian, bitstrings get drawn from the model QHBM. Then, we need the ability to pick out just those bits on which the EBM of the modular Hamiltonian is supported in order to compute energies. For more details see the equation labeled "eq:ModularHamiltonianExpectation" in the QVR notes.

As well, in that equation we see that bitstrings are actually drawn from the concatenation of the model QNN and the inverse of the modular Hamiltonian QNN. The solution I want to use is to make QNNs support inverse and addition, to easily set up such a combination.