<br><br><div class="gmail_quote">On Sun, Aug 4, 2013 at 11:49 PM, Jaime Fernández del Río <span dir="ltr"><<a href="mailto:jaime.frio@gmail.com" target="_blank">jaime.frio@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 dir="ltr"><div>Hi!</div><div><br></div>I have spent the last couple of weeks playing around with GUFUNCS, and am literally blown away by the power that a C compiler and NumPy put at the tip of my fingers! I still have many questions, but the following ones are the most pressing in my current state of amazed ignorance:<div>
<br></div><div>1. **The data argument to the GUFUNC loop function** Where in the source code can I find example of it's use? I remember reading that many UFUNCS are just the same looping, with a pointer to a different function passed in this argument. I think I understand the idea, but would like to see it implemented.</div>
<div><br></div><div>2. **Is there a place for initializations?** I have a GUFNC in mind that will need, in each iteration, a small dynamically allocated array, which can be reused by other iterations. Rather than malloc-ing it for every loop, I am thinking of wrapping the GUFUNC in a Python interface that creates a numpy array for this, and passes it down as another parameter. Is there an easy way to keep this all bundled in the C code, e.g. by defining some initialization code to be run before doing any looping?</div>
<div><br></div><div>3. **What happens with missing types?** Say I only register a function that takes unsigned ints. What happens if I try to call it with ints? I figure it will complain, but not if it is the other way around and the type can be safely casted. Is that really so? Can this behavior be in any way configured? Is it documented anywhere?</div>
<div><br></div><div>4. **.src files** The prime example of GUFUNC implementation I have found is "umath_linalg.c.src" Correct me if I am wrong, but this is simply C code plus the special syntax to generate multiple versions of the same functions changing only a few types and names, using the @tag@ syntax. While the way it works seems clear, I had never seen this done like this before. Is this standard or just a numpy thing? How do you parse and expand this code to its full glory before compiling?</div>
</div></blockquote><div><br>It's a numpy thing. The code can be expanded like so if you are working in the repository:<br>``` <br>$ python numpy/distutils/conv_template.py <filename><br>```<br><br>Chuck<br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">
<div><br></div><div>Thanks!</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Jaime</div><div><div><br></div>-- <br>(\__/)<br>( O.o)<br>( > <) Este es Conejo. Copia a Conejo en tu firma y ayúdale en sus planes de dominación mundial.
</div></font></span></div>
<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></blockquote></div><br>