scipy/scipy — pull request #482 by gertingold (2013-03-26 13:45:14+00:00)
Title: fixed bug in clpmn violating array bounds

Hi,

it seems that there is a bug in the Fortran code of CLPMN where data are written Into the array CPM beyond its bounds provided that M=N. A corresponding bug originally present in the real version LPMN was fixed in 3d5294d3 about eight years ago. This bug concerns not only the associated Legendre polynomials but also the spherical harmonics for complex angles. In Python, the bug becomes apparent in the following minimal code:

'''
from scipy.special.specfun import clpmn
clpmn(1, 1, 5, 3)
'''

The third and fourth argument should not be very important as long as they do not correspond to an argument 1 or -1.

This bug was found by Michael Hartmann and analyzed together with him.

The change in line 275 in b73f9f95 should fix the problem.

Best regards,
Gert