C++ functions which evaluate Legendre polynomials