Errors when using 'exact' representation of density matrices
Created by: PhilipVinc
A worrisome email I received:
Since the 3.0 update some observables in my calculations switched signs (the MC estimates).
When calculating expectation values of an operator that is not symmetric in a steady state solution I get a different sign when calculating
rho = nk.exact.steady_state(lind) tr(rho@op.to_dense()) 0.15 ss.estimate(op) -0.15
When investigating this, I didn’t find any fault in the MC nk code, but one possible explanation could be that operator.to_dense() returns a transposed matrix or is this your convention that operators are applied to the left?
He also showed me a case that I further reduced a bit. here is my explanation:
In nette, for reasons unbeknown to me, we have the convention of labelling the Hilbert space from down to up, from low to high. So the local Hilbert space of Pauli matrices is [down, up], as testified by
>>> nk.hilbert.Spin(0.5).all_states()
array([[-1.],
[ 1.]])
However, if I now create the sigma plus operator I get:
>>> nk.operator.spin.sigmap(nk.hilbert.Spin(0.5), 0).operators
[array([[0., 1.],
[0., 0.]])]
And clearly in this conventiont this is the sigma_minus operator. The same issue happens with non symmetric matrices like sigma_y.
The error is on my part, as I had taken that code from some older code of mine which I guess assumed opposite ordering. Interestingly enough, boson operators are correct...
This is consistent with the fact that I long have seen that sigma_y had the opposite sign in some calculations compared to my old article, but after investigating I thought the error was on my old article...
Still, while the fix is clear, I have to double check the Impact on the ordering of the lindblad jump operators because I think I might have implemented a transposition there otherwise I don't understand how it can work...
Note: THIS WILL BREAK CODES