Implementation

Protocols

HQS Quantum Solver makes extensive use of Protocols, which means that it is easy to write code interfacing with Quantum Solver. Whenever you encounter a protocol class in the type hints of a function or method, the protocol class defines which methods and properties the corresponding argument object is expected to have and the corresponding return type is going to provide, respectively.

For example, the evolve_using_krylov function expects a hamiltonian argument which adheres to the SimpleOperatorProtocol. To be allowed to pass an object as hamiltonian, the object just needs to implement all the methods and properties listed in SimpleOperatorProtocol, which is in contrast to abstract base classes, where the object would need to be explicitly derived from the abstract base class.

StateMaps

HQS Quantum Solver is able to exploit various conserved properties by implementing, so-called, StateMaps. A StateMap provides a list of the Fock states that are used to build an operator; it defines the basis set of our Hilbert space. By specifically generating Hamiltonians and generic operators, with custom StateMaps, you can efficiently exploit these properties. This is typically done automatically when specifying things like conserved particle number, by mod_N = 0, or conserved Sz quantum number, by mod_Sz = 0.

Dyadic representation

We also provide a special kind of operator that exploits the so-called dyadic representation. Specifically, this methodology can be used for systems where the state exists in a product of spaces, i.e., and the operators acting on it are either diagonal in the extended space or may be described by Kronecker sums/products of operators in the individual spaces, implemented by DyadicOperatorSum and DyadicOperatorProduct, respectively.

We demonstrate the usefulness of this concept by evaluating the Hubbard Model. Starting with a spinful fermion model, we assume that the wavefunction can be expressed as a Kronecker product in the spin-up and spin-down degrees of freedom .

To do this we use a well-known matrix vectorization trick in reverse, let denote the so-called row-major vectorization operator acting on the matrix , then the Kronecker product has the property that

Similarly, if the operator is a Kronecker sum, Using the first property, we get that and and therefore, combining with the second property, This expression is the representation that is preferable to directly representing the operator on the product space, because it requires less storage and fewer operations to execute when applying the operator.