Page 1 of 1

calculate four-point correlation function

Posted: 26 Apr 2022, 12:25
by yuanjk
Hello.
Recently, I have calculated the four-point correlation function \(\braket{C^\dagger_{\downarrow,i} C^\dagger_{\uparrow,i+1} C_{\downarrow,j+1} C_{\uparrow,j}}\) by using the expectation_value_term().

Code: Select all

def correlation(psi,a,b,c,d):
        L = psi.L  
        f = np.zeros((L-1,L-1),dtype=complex)
        for i in range(L-1):
            for j in range(L-1):
                f[i,j] = psi.expectation_value_term([(a,i),(b,i+1),
                                                        (c,j+1),(d,j)])
        return f
But it cost lots of time to get the result, is there any better way to calculate the four-point correlation function?

Re: calculate four-point correlation function

Posted: 26 Apr 2022, 17:07
by Johannes
Yes, you can do better.
The explicit loops you have make this scale as \(O(L^3 \chi^3)\), since each call to psi.expectation_value_term is \(O(|j+1 - i| \chi^3)\).
You can get this down to \(O(L^2 \chi^3)\) by using the term_correlation_function_right or ..._left, with
term_L = [('Cd', 0), ('Cd', 1)], term_R=[('C', 1), ('C', 0)].
It contains the loop over j > (i+1) inside the method. If you need the overlapping terms as well, you have some special cases to handle, but presumably you're really interested in the decay at large \(j \gg i\).