OK. Anyway try and ask. The code above produces a label for a configuration of spin-1/2 systems (or hard core bosons or whatever) from a list of S_z, occupation numbers or whatver, for the case where only S_z or N is conserved
@hwlau but then you need to visit 30000^2 elements. can't you iterate through all states and for each produce all states with which there are matrix elements, then fill those in?
It is a density matrix, the element are all non zero because it is somehow related to coherent state |alpha>. So all entries density matrix rho = |alpha><alpha| is not zero as expected.
@hwlau OK so you are also calculating rho from scratch
I don't remember what the fastest way to construct such a matrix is. Maybe SparseMatrix[{{i_,j_}:>f[i,j]},{dim,dim}] or maybe what you say. I don't remember
@hwlau but it doesn't compile (although it's fast anyway)
you can use that or Table, it should not really matter speed-wise
as an aside, I now see that you asked the question on physics se about universality classes. I don't post there but there are models for which RG predicts (correctly) critical exponents that depend on the parameters of the Hamiltonian.
@hwlau I mean that there exist models for which both numerical simulations and the RG give an exponent which itself depends on $K$, a parameter of the model
the point is, the story most people have in mind (phase transitions can be classified in a small set of universality classes, and those correspond to RG fixed points) is true for simple Hamiltonians, basically.
yes also there I think. anyway, this isn't the place for this discussion :)
@acl Now, I have another problem for the compile function. How can I create a list dynamically with unknown size starting from zero element?
B = {}; AppendTo[B, {1, 2}];
with error message
Compile::cpts: "The result after evaluating Insert[B,{1,2},-1] should be a tensor. Nontensor lists are not supported at present; evaluation will proceed with the uncompiled function."
@hwlau I think in this case the point is that if it can't decide, it simply sends the whole thing back to the main kernel and you lose the speed benefit.
if it can, it produces C code which it compiles (if you use CompilationTarget->"C")