>> Or do you want to compute something like the thermal average of a local observable?
This is what I want to do (although for a global observable). I know there are other ways to do this (such as the ancilla method) but I want to calculate the density matrix for each state, as Matt wrote below. I'm sure there's a simple way to calculate the outer products in the c++ version, but I've seen this question come up a few times around here and the answer is not clear to me. Any help is appreciated.