ALF is an extension library for GSL to compute associated Legendre polynomialsdeveloped by Patrick Alken. Ruby/GSL includes interfaces to it if ALF is installed found by extconf.
The class and method descriptions below are based on references from the document of ALF (alf-1.0/doc/alf.texi) by P.Alken.
GSL::ALF (module)
GSL::ALF::Workspace (Class)
GSL::ALF::Workspace.alloc(lmax)GSL::ALF.alloc(lmax)Creates a workspace for computing associated Legendre polynomials (ALFs). The maximum ALF degree is specified by lmax. The size of this workspace is O(lmax).
GSL::ALF::Workspace#params(csphase, cnorm, norm)GSL::ALF::Workspace#Plm_array(x)GSL::ALF::Workspace#Plm_array(lmax, x)GSL::ALF::Workspace#Plm_array(x, result)GSL::ALF::Workspace#Plm_array(lmax, x, result)GSL::ALF::Workspace#Plm_array(x, result, deriv)GSL::ALF::Workspace#Plm_array(lmax, x, result, deriv)Compute all associated Legendre polynomials P_l^m(x) and optionally their first derivatives dP_l^m(x)/dx for 0 <= l <= lmax, 0 <= m <= l. The value of lmax cannot exceed the previously specified lmax parameter to ALF.alloc, but may be less. If lmax is not given, the parameter to ALF.alloc() is used. The results are stored in result, an instance of GSL::Vector. Note that this vector must have enough length to store all the values for the polynomial P_l^m(x), and the length required can be known using ALF::array_size(lmax). If a vector is not given, a new vector is created and returned.
The indices of ((|result|)) (and ((|deriv|)) corresponding to the associated Legendre function of degree ((|l|)) and order ((|m|)) can be obtained by calling (({ALF::array_index(l, m)})).GSL::ALF::Workspace#Plm_deriv_array(x)GSL::ALF::Workspace#Plm_deriv_array(lmax, x)GSL::ALF::Workspace#Plm_deriv_array(x, result, deriv)GSL::ALF::Workspace#Plm_deriv_array(lmax, x, result, deriv)GSL::ALF::array_size(lmax)GSL::ALF::array_index(l, m)Plm_array() and Plm_deriv_array() corresponding to P_l^m(x) and dP_l^m(x)/dx respectively. The index is given by l(l + 1)/2 + m.