|
|
Subject: using numpy arrays and random number generators in Pyrex - msg#00052
List: python.pyrex
This is likely a naive question on my part, but how do I use numpy's and
python's random number generators within a pyrex module? Please note
that I have little experience with C, so any detailed descriptions would
be greatly appreciated.
Same thing goes for numpy arrays. Is there a correct way to pass a
numpy array to a pyrex function?
Thanks,
-Mark
Was this page helpful?
Thread at a glance:
Previous Message by Date:
click to view message preview
Pyrex 0.9.5.1 missing tests
Trying to build Pyrex bombs out with this message:
error: package directory 'Pyrex/Testing' does not exist
I had to grab that subpackage from Pyrex-Tests-0.9.5.1 . Either the test
framework should be part of the main distribution, or the setup.py should be
modified to not attempt to include it. I recommend the former.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
Next Message by Date:
click to view message preview
Re: using numpy arrays and random number generators in Pyrex
Mark P. Miller wrote:
> This is likely a naive question on my part, but how do I use numpy's and
> python's random number generators within a pyrex module? Please note
> that I have little experience with C, so any detailed descriptions would
> be greatly appreciated.
Unfortunately, the C API for the random number generators is not exposed to
other modules. We are happy to accept contributions for this, and can give hints
to those who want to work on it, but we have not had time to do this ourselves.
> Same thing goes for numpy arrays. Is there a correct way to pass a
> numpy array to a pyrex function?
Yes! You can look at the source of numpy/random/mtrand.pyx for examples. Get the
latest from SVN as I've recently committed fixes for Pyrex 0.9.5. There is also
an example in numpy/doc/pyrex/ that uses a slightly different approach (a .pxd
instead of a .pxi to expose the numpy API).
Come join us on numpy-discussion if you have more numpy-specific questions.
http://www.scipy.org/Mailing_Lists
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
Previous Message by Thread:
click to view message preview
Pyrex 0.9.5.1 missing tests
Trying to build Pyrex bombs out with this message:
error: package directory 'Pyrex/Testing' does not exist
I had to grab that subpackage from Pyrex-Tests-0.9.5.1 . Either the test
framework should be part of the main distribution, or the setup.py should be
modified to not attempt to include it. I recommend the former.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
Next Message by Thread:
click to view message preview
Re: using numpy arrays and random number generators in Pyrex
Mark P. Miller wrote:
> This is likely a naive question on my part, but how do I use numpy's and
> python's random number generators within a pyrex module? Please note
> that I have little experience with C, so any detailed descriptions would
> be greatly appreciated.
Unfortunately, the C API for the random number generators is not exposed to
other modules. We are happy to accept contributions for this, and can give hints
to those who want to work on it, but we have not had time to do this ourselves.
> Same thing goes for numpy arrays. Is there a correct way to pass a
> numpy array to a pyrex function?
Yes! You can look at the source of numpy/random/mtrand.pyx for examples. Get the
latest from SVN as I've recently committed fixes for Pyrex 0.9.5. There is also
an example in numpy/doc/pyrex/ that uses a slightly different approach (a .pxd
instead of a .pxi to expose the numpy API).
Come join us on numpy-discussion if you have more numpy-specific questions.
http://www.scipy.org/Mailing_Lists
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
|
|