I follow the Matlab code once Emti asked for writing similar C++ code based on his Matlab code.
What is more, we need to multiply this matrix to a updated vector at each L-BFGS iteration.
Doing LU factorization (time complexity O(n^3)) for each iteration is not a good idea.