Hi,<br><br>
<div class="gmail_quote">On Wed, Jan 26, 2011 at 2:35 PM, <span dir="ltr"><<a href="mailto:josef.pktd@gmail.com">josef.pktd@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>
<div></div>
<div class="h5">On Wed, Jan 26, 2011 at 7:22 AM, eat <<a href="mailto:e.antero.tammi@gmail.com">e.antero.tammi@gmail.com</a>> wrote:<br>> Hi,<br>><br>> I just noticed a document/ implementation conflict with tril and triu.<br>
> According tril documentation it should return of same shape and data-type as<br>> called. But this is not the case at least with dtype bool.<br>><br>> The input shape is referred as (M, N) in tril and triu, but as (N, M) in<br>
> tri.<br>> Inconsistent?</div></div></blockquote>
<div>Any comments about the names for rows and cols. I prefer (M, N).</div>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>
<div class="h5">><br>> Also I'm not very happy with the performance, at least dtype bool can be<br>> accelerated as follows.<br>><br>> In []: M= ones((2000, 3000), dtype= bool)<br>> In []: timeit triu(M)<br>
> 10 loops, best of 3: 173 ms per loop<br>> In []: timeit triu_(M)<br>> 10 loops, best of 3: 107 ms per loop<br>><br>> In []: M= asarray(M, dtype= int)<br>> In []: timeit triu(M)<br>> 10 loops, best of 3: 160 ms per loop<br>
> In []: timeit triu_(M)<br>> 10 loops, best of 3: 163 ms per loop<br>><br>> In []: M= asarray(M, dtype= float)<br>> In []: timeit triu(M)<br>> 10 loops, best of 3: 195 ms per loop<br>> In []: timeit triu_(M)<br>
> 10 loops, best of 3: 157 ms per loop<br>><br>> I have attached a crude 'fix' incase someone is interested.<br><br></div></div>You could open a ticket for this.<br><br>just one comment:<br>I don't think this is readable, especially if we only look at the<br>
source of the function with np.source<br><br>out= mul(ge(so(ar(m.shape[0]), ar(m.shape[1])), -k), m)<br><br>from np.source(np.tri) with numpy 1.5.1<br>m = greater_equal(subtract.outer(arange(N), arange(M)),-k)</blockquote>

<div>I agree, thats why I called it crude. Before opening a ticket I'll try to figure out if there exists somewhere in numpy .astype functionality, but not copying if allready proper dtype.</div>
<div> </div>
<div>Also I'm afraid that I can't produce sufficient testing.</div>
<div><br>Regards, eat</div>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote"><br>Josef<br><br>><br>> Regards,<br>> eat<br>> _______________________________________________<br>
> NumPy-Discussion mailing list<br>> <a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>> <a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
><br>><br>_______________________________________________<br>NumPy-Discussion mailing list<br><a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br><a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div><br>