Skip to content

Density Matrix in Python

Vicentini Filippo requested to merge py_rho into v3.0

Created by: gcarleo

I am porting also density matrices to python (basically, the last big thing to be ported from c++....).

It turns out that the (super ugly) doubling of the hilbert space needed in c++ was stemming mostly from the limitations of the sampler interface, that were depending on hilbert to produce initial random states and to deduce the size of the input. Since these are distinct concepts, I implemented things in a way that general samplers never see or know anything about hilbert. The just know about the input_size of the machines they are dealing with, and they have a kernel that does two things: initialize a random state, and propose a transition.

This basically allows to define specific (small) kernels that are specifically suited for density matrices, or just use generic kernels (like MetropolisLocal that work in both cases).

For the moment I also drafted a version of AbstractDensityMatrix, @PhilipVinc please let me know if it makes sense. The only potential issue is how to get a view (not a copy) when calling .diagonal() ...

Merge request reports