<br><br><div class="gmail_quote">On Thu, May 2, 2013 at 7:28 AM, Robert Kern <span dir="ltr"><<a href="mailto:robert.kern@gmail.com" target="_blank">robert.kern@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Thu, May 2, 2013 at 12:03 PM, Nathaniel Smith <<a href="mailto:njs@pobox.com">njs@pobox.com</a>> wrote:<br>
> On 1 May 2013 23:12, "Charles R Harris" <<a href="mailto:charlesr.harris@gmail.com">charlesr.harris@gmail.com</a>> wrote:<br>
>><br>
>> On Wed, May 1, 2013 at 7:10 PM, Benjamin Root <<a href="mailto:ben.root@ou.edu">ben.root@ou.edu</a>> wrote:<br>
>>><br>
>>> So, to summarize the thread so far:<br>
>>><br>
>>> Consensus:<br>
>>> np.nanmean()<br>
>>> np.nanstd()<br>
>>> np.minmax()<br>
>>> np.argminmax()<br>
>>><br>
>>> Vague Consensus:<br>
>>> np.sincos()<br>
>>><br>
>><br>
>> If the return of sincos (cossin?) is an array, then it could be reshaped<br>
>> to be exp(1j*x), which together with exp(2*pi*1j*x) would cover some pretty<br>
>> common cases.<br>
<br>
</div>It couldn't be a mere reshape, since the complex dtype requires the<br>
real and imag components to be adjacent to each other. They wouldn't<br>
be so if sincos's return type is an array (nor even the cossin<br>
alternative). It always requires a memory copy (except in the "who<br>
cares?" case of a scalar). Composition with an efficient<br>
np.tocomplex(real, imag) implementation would cover those use cases<br>
whether sincos returns tuples or arrays.<br></blockquote><div><br>I would assume the basic return type would be complex, i.e., the cos/sin adjacent. The cos/sin parts would then be real/imag views into the array.<br> <br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
> Ufuncs already have some convention for what to do with multiple output<br>
> arguments, right? Presumably whatever they do is what sincos should do. (And<br>
> minmax/argminmax likewise, for consistency, even if they aren't ufuncs.<br>
> Though they could be generalized ufuncs, or minmax could be<br>
> minimummaximum.reduce.)<br>
><br>
> I haven't checked, but I assume that what multiple output argument ufuncs do<br>
> is to return a tuple. You can't use a single array in the general case,<br>
> because the multiple output types might not be homogenous.<br>
<br>
</div>Correct.<br>
<br>
[~]<br>
|19> np.modf.nout<br>
2<br>
<br>
[~]<br>
|20> np.modf(np.linspace(0, 1, 5))<br>
(array([ 0.  ,  0.25,  0.5 ,  0.75,  0.  ]), array([ 0.,  0.,  0.,  0.,  1.]))<br>
<br>
--<br>
Robert Kern<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<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>
</div></div></blockquote></div><br>