Two different implementations were made to solve this problem:
The first one, named 'abstract' deals with states as vectors, and the algorithm follows a straightforward linear algebra approach (and very little or no calculus). This approach was efficient, but somewhat limited as it depends on the simplicity with which we describe the hamiltonian in terms of how it acts on the QHO eigenstates.
The second approach, dealing in coordinate space, provides more flexibility with the hamiltonians it admits, although they can get increasingly difficult to express in code (especially for differential operators, for which symbolic differentiation might be needed). This method is less straightforward, as we actually require integration (which is performed through Hermit-Gaussian Quadrature), and expressing the eigenstates as actual polynomials and functions (rather than simply vectors).
Both methods provide similar results, but coordinate space is much less efficient. Pytorch was used for a standard optimization of the coefficients, but computing the loss was the biggest obstacle.