<p dir="auto">copied from a question on the scipy-dev mailing list</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Hello,
I've been using scipy for a while and found out the following, which seems to me like a true bug.
Converting coo_matrix to dok_matrix doesn't  take into account coinsiding i and j cases:

&gt;&gt;&gt; cols = (0, 1, 2, 1)
&gt;&gt;&gt; rows = (0, 1, 2, 1)
&gt;&gt;&gt; vals = (1, 1, 1, 1)
&gt;&gt;&gt; B = sparse.coo_matrix((vals, (rows, cols)))
&gt;&gt;&gt; print B.todense()
[[1 0 0]
 [0 2 0]
 [0 0 1]]
&gt;&gt;&gt; print B.todok().todense()
[[1 0 0]
 [0 1 0]
 [0 0 1]]

&gt;&gt;&gt; sp.__version__
Out[17]: '0.14.0'

I've spent a lot of time figuring this out, therefor I decided to report it."><pre class="notranslate"><code class="notranslate">Hello,
I've been using scipy for a while and found out the following, which seems to me like a true bug.
Converting coo_matrix to dok_matrix doesn't  take into account coinsiding i and j cases:

&gt;&gt;&gt; cols = (0, 1, 2, 1)
&gt;&gt;&gt; rows = (0, 1, 2, 1)
&gt;&gt;&gt; vals = (1, 1, 1, 1)
&gt;&gt;&gt; B = sparse.coo_matrix((vals, (rows, cols)))
&gt;&gt;&gt; print B.todense()
[[1 0 0]
 [0 2 0]
 [0 0 1]]
&gt;&gt;&gt; print B.todok().todense()
[[1 0 0]
 [0 1 0]
 [0 0 1]]

&gt;&gt;&gt; sp.__version__
Out[17]: '0.14.0'

I've spent a lot of time figuring this out, therefor I decided to report it.
</code></pre></div>
<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/scipy/ticket/655" rel="nofollow">http://projects.scipy.org/scipy/ticket/655</a> on 2008-04-25 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/cournape/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/cournape">@cournape</a>, assigned to <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/dmcooke/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/dmcooke">@dmcooke</a>.</em></p>
<p dir="auto">Executing tests for gammaincinv hangs the python interpreter with 100 % cpu.</p>