Skip to content

WIP: simplify hilbert space code

Christoph Groth requested to merge simplify_hs into master

Rewrite hilbert_space.py, while keeping its basic structure unchanged:

  • Remove Site, only keep SiteArray

  • Reogranize Hilbert spaces into the ABC HilbertSpace, and the concrete classes Simple and Product.

  • Introduce a global (weakref) registry of names of simple Hilbert spaces. This way, the uniqueness of Hilbert spaces is enforced.


Some bits of "porcelain" that were removed (like infinite_part or __call__) can be added back easily in one form or other when needed.

Here are some idea that I haven't pursued so far:

  • Hilbert spaces could support numpy-like indexing to create site arrays. For example, when space is indexed by (x, y, spin) it would be natural to write space[2, 3] to designate the two DOFs (2, 3, 0) and (2, 3, 1). Other possibilities would be space[ [(1, 1), (1, 2), (2, 3)] ] or even space[0:10, 0:10, 0].

  • SiteArrays could be interpreted as Hilbert spaces and generalized to also contain infinite dimensions. This could be used as a way to describe translational symmetries, but I'm not sure whether it would be a good way.

Merge request reports