/********************************************************** This software is part of J.-S. Caux's ABACUS library. Copyright (c). ----------------------------------------------------------- File: LiebLin_Gaudin_lnnorm.cc Purpose: calculates the Gaudin norm of a vector of arbitrary complex rapidities ***********************************************************/ #include "JSC.h" using namespace std; using namespace JSC; namespace JSC { DP LiebLin_Twisted_lnnorm (Vect >& lambdaoc, double cxL) { // Calculates the lnnorm of an eigenstate of the twisted transfer matrix // so Gaudin can be used. int N = lambdaoc.size(); SQMat > Gaudin(N); complex sum_Kernel = 0.0; for (int j = 0; j < N; ++j) for (int k = 0; k < N; ++k) { if (j == k) { sum_Kernel = 0.0; for (int kp = 0; kp < N; ++kp) if (j != kp) sum_Kernel += 2.0/((lambdaoc[j] - lambdaoc[kp]) * (lambdaoc[j] - lambdaoc[kp]) + 1.0); Gaudin[j][k] = cxL + sum_Kernel; } else Gaudin[j][k] = - 2.0/((lambdaoc[j] - lambdaoc[k]) * (lambdaoc[j] - lambdaoc[k]) + 1.0); } DP lnnorm = real(lndet_LU_CX_dstry(Gaudin)); // Add the pieces outside of Gaudin determinant for (int j = 0; j < N - 1; ++j) for (int k = j+1; k < N; ++k) lnnorm += log(1.0 + 1.0/norm(lambdaoc[j] - lambdaoc[k])); return(lnnorm); } } // namespace JSC