<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/scipy/ticket/1564" rel="nofollow">http://projects.scipy.org/scipy/ticket/1564</a> on 2011-11-20 by trac user laserson, assigned to unknown.</em></p>
<p dir="auto">Hi all,</p>
<p dir="auto">I have been looking for the source of some segfaults I have been getting when trying to use the linkage function in scipy.cluster.hierarchy, and I finally found the reason (with the help of our cluster's IT person, Chris Walker).</p>
<p dir="auto">In the 'linkage' function in hierarchy.c, the three variables <code class="notranslate">n</code>, <code class="notranslate">np</code>, and <code class="notranslate">npc2</code>, are declared as int types.  However, if <code class="notranslate">n=50000</code>, which is the case with my input files, then the value of NCHOOSE2(n) overflows, leading <code class="notranslate">malloc</code> to return a null pointer because the requested number of bytes is negative.</p>
<p dir="auto">If you uncomment the debug message at l. 461, you will find this to be true.</p>
<p dir="auto">These three variables should be changed to be long ints, or something similar, to accomodate larger input matrices.</p>
<p dir="auto">Thanks!<br>
Uri</p>
<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/scipy/ticket/720" rel="nofollow">http://projects.scipy.org/scipy/ticket/720</a> on 2008-08-08 by trac user aisaac, assigned to unknown.</em></p>
<p dir="auto">NumPy has <code class="notranslate">trapz</code> in the <code class="notranslate">function_base</code> module.<br>
SciPy has <code class="notranslate">cumtrapz</code> in the <code class="notranslate">quadrature</code> module.<br>
The code is essentially identical.<br>
Presumably this duplication should be eliminated<br>
by having SciPy import the NumPy function?</p>