On Feb 4, 2008 9:05 PM, Christopher Barker <[EMAIL PROTECTED]> wrote:
> Lou Pecora wrote:
> > I
> > would recommend using the C API
>
> I would recommend against this -- there is a lot of code to write in
> extensions to make sure you do reference counting, etc, and it is hard
> to get right.
>
> M
On Tue, Feb 05, 2008 at 09:15:29AM +0100, Sebastian Haase wrote:
> Can ctypes do this ?
No. Ctypes is only a way of loading C (and not C++) libraries in Python.
That makes it very simple, but not very powerful.
Gaël
___
Numpy-discussion mailing list
Num
Alexander Michael wrote:
> On Feb 4, 2008 5:13 AM, David Cournapeau <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> While studying a bit nsis (an open source system to build windows
>> installers), I realized that it would be good if we could detect the
>> target CPU and install the right numpy according
On Feb 5, 2008 11:33 AM, Francesc Altet <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I need to generate a series of uint8 integers similar to:
>
> In [37]: numpy.linspace(10, 20, num=25).astype('uint8')
> Out[37]:
> array([10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 15, 15, 15, 16,
>16, 17, 17,
On Feb 5, 2008 9:21 AM, Gael Varoquaux <[EMAIL PROTECTED]> wrote:
> On Tue, Feb 05, 2008 at 09:15:29AM +0100, Sebastian Haase wrote:
> > Can ctypes do this ?
>
> No. Ctypes is only a way of loading C (and not C++) libraries in Python.
> That makes it very simple, but not very powerful.
>
> Gaël
(so
Gael Varoquaux wrote:
> On Tue, Feb 05, 2008 at 09:15:29AM +0100, Sebastian Haase wrote:
>
>> Can ctypes do this ?
>>
>
> No. Ctypes is only a way of loading C (and not C++) libraries in Python.
> That makes it very simple, but not very powerful.
>
I would not call ctypes not very powerf
Hi,
I need to generate a series of uint8 integers similar to:
In [37]: numpy.linspace(10, 20, num=25).astype('uint8')
Out[37]:
array([10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 15, 15, 15, 16,
16, 17, 17, 17, 18, 18, 19, 19, 20], dtype=uint8)
i.e. create evenly spaced samples in a ra
On Feb 5, 2008 11:23 AM, David Cournapeau <[EMAIL PROTECTED]> wrote:
> Gael Varoquaux wrote:
> > On Tue, Feb 05, 2008 at 09:15:29AM +0100, Sebastian Haase wrote:
> >
> >> Can ctypes do this ?
> >>
> >
> > No. Ctypes is only a way of loading C (and not C++) libraries in Python.
> > That makes it ver
On Tue, Feb 05, 2008 at 11:48:37AM +0100, Sebastian Haase wrote:
> Thanks fr the reply.
> How about "manual" overloading. I mean, if -- for example -- I have
> two functions mmms_b and mmms_i in C, I could still use ctypes; could
> I then "merge" them into one python function, which "re-routes"
> d
On Tue, Feb 05, 2008 at 11:48:38AM +0100, Ondrej Certik wrote:
> I use Cython, mostly for the same reasons Gael is using ctypes - it's trivial.
Actually, when I want to do something really trivial, I use
scipy.weave.inline ( see http://scipy.org/PerformancePython for an
example of scipy.weave.inli
>
> This is what SWIG must be doing internally -- right ?!
>
Yes, it is with an additional typemap that checks the type of the data.
I don't think that it is a good idea for numpy to add such
multi-dispatching, it is not its job. There are a lot of ways to do it, and
besides it would be very cumb
Gael Varoquaux wrote:
> On Tue, Feb 05, 2008 at 11:48:37AM +0100, Sebastian Haase wrote:
>> Thanks fr the reply.
>> How about "manual" overloading. I mean, if -- for example -- I have
>> two functions mmms_b and mmms_i in C, I could still use ctypes; could
>> I then "merge" them into one python fun
Is there a C-api to array slicing?
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion
On Feb 5, 2008 11:52 AM, Gael Varoquaux <[EMAIL PROTECTED]> wrote:
> On Tue, Feb 05, 2008 at 11:48:38AM +0100, Ondrej Certik wrote:
> > I use Cython, mostly for the same reasons Gael is using ctypes - it's
> > trivial.
>
> Actually, when I want to do something really trivial, I use
> scipy.weave.i
Hi,
I'm having some trouble accessing elements in an array of dtype="O"
from C code; I hope someone on the list could give me some advice
(because I might be doing something stupid).
I have an array of simple objects, created as follows:
class CF(object):
def __init__(self,num=0.0):
--- Gael Varoquaux <[EMAIL PROTECTED]>
wrote:
Re: ctypes
> I don't use windows much. One thing I liked about
> ctypes when I used it,
> was that what I found it pretty easy to get working
> on both Linux and
> Windows.
>
> Gaël
I got ctypes to install easily on Mac OS X 10.4.11 and
it passe
On Tue, Feb 05, 2008 at 06:45:25AM -0800, Lou Pecora wrote:
> Hmmm... last time I tried ctypes it seemed pretty
> Windows oriented and I got nowhere. But enough people
> have said how easy it is that I'll give it another
> try.
I don't use windows much. One thing I liked about ctypes when I used
Hmmm... last time I tried ctypes it seemed pretty
Windows oriented and I got nowhere. But enough people
have said how easy it is that I'll give it another
try.
Believe me, I'd be happy to be wrong and find a nice
easy way to pass NumPy arrays and such. Thanks.
-- Lou Pecora
--- Gael Varoquaux
I got ctypes installed and passing its own tests. But
I cannot get the shared library to load. I am using
Mac OS X 10.4.11, Python 2.4 running through the
Terminal.
I am using Albert Strasheim's example on
http://scipy.org/Cookbook/Ctypes2 except that I had to
remove the defined 'extern' for FOO
Lou Pecora wrote:
> I got ctypes installed and passing its own tests. But
> I cannot get the shared library to load. I am using
> Mac OS X 10.4.11, Python 2.4 running through the
> Terminal.
>
> I am using Albert Strasheim's example on
> http://scipy.org/Cookbook/Ctypes2 except that I had to
> r
> Well, it's looking for test1ctypes.dylib, which I
> guess is a MacOSX
> shared library? Meanwhile, you made a
> test1ctypes.so, which is why it
> can't find it. You could try using this instead:
>
> _test1 = N.ctypeslib.load_library('test1ctypes.so',
> '.')
>
> or try to get gcc to make a t
Vince Fulco gmail.com> writes:
>
> Dear Numpy Experts- I find myself working with Numpy arrays and
> wanting to access *simple* C++ functions for time series returning the
> results to Numpy. As I am a relatively new user of Python/Numpy, the
> number of paths to use in incorporating C++ code
Dear Vince,
You probably have heard better solutions but I think what I do works and
is simple to learn. When I need to call C++ code from Python, I write a
wrapper extern "C" function that calls the C++ function that returns the
result. Then I just use ctypes to call the extern "C" function fr
Hello -
Is there a function to compute the matrix rank of a numpy array or
matrix?
So I don't mean the current rank(), which gives the number of
dimensions.
I mean the number of independent equations of a matrix.
Thanks,
Mark
___
Numpy-discussion maili
Thanks.
I rewrote the line as:
from numpy.linalg import svd
from numpy import sum,where
def matrixrank(A,tol=1e-8):
s = svd(A,compute_uv=0)
return sum( where( s>tol, 1, 0 ) )
Would be nice to include matrixrank in numpy, as it is really useful,
Thanks again, Mark
On Feb 5, 7:59 pm, "Ni
On Tue, 5 Feb 2008 10:54:01 -0800 (PST)
mark <[EMAIL PROTECTED]> wrote:
> Hello -
>
> Is there a function to compute the matrix rank of a
>numpy array or
> matrix?
> So I don't mean the current rank(), which gives the
>number of
> dimensions.
> I mean the number of independent equations of a m
On Feb 5, 2008 10:54 AM, mark <[EMAIL PROTECTED]> wrote:
> Is there a function to compute the matrix rank of a numpy array or
> matrix?
I'm sure there's a more direct way, but numpy.linalg.lstsq returns the
rank of a matrix.
___
Numpy-discussion mailing
On Tue, 5 Feb 2008 11:37:12 -0800 (PST)
mark <[EMAIL PROTECTED]> wrote:
> Thanks.
> I rewrote the line as:
>
> from numpy.linalg import svd
> from numpy import sum,where
>
> def matrixrank(A,tol=1e-8):
>s = svd(A,compute_uv=0)
>return sum( where( s>tol, 1, 0 ) )
>
> Would be nice to in
Neal Becker wrote:
> Is there a C-api to array slicing?
PyObject_GetItem(), PySlice_New(), and friends, for the most part.
--
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
On Tue, Feb 05, 2008 at 12:16:02PM -0600, Kent-Andre Mardal wrote:
> We have created a small Python module Instant (www.fenics.org/instant) on top
> of SWIG, which makes integration of C/C++ and NumPy arrays easy in some cases.
Hello,
Thank you for posting about instant. I think it looks like a
Greetings,
After searching the archives, I was unable to find a good method for
changing the stride of the correlate or convolve routines. I am doing a
Daubechies analysis of some sample data, say data = arange(0:80). The
coefficient array or four floats (say daub_g2[0:4]) is correlated over
the d
On 05/02/2008, Chris Finley <[EMAIL PROTECTED]> wrote:
> After searching the archives, I was unable to find a good method for
> changing the stride of the correlate or convolve routines. I am doing a
> Daubechies analysis of some sample data, say data = arange(0:80). The
> coefficient array or fou
Chris Ball wrote:
> Hi,
>
> I'm having some trouble accessing elements in an array of dtype="O"
> from C code; I hope someone on the list could give me some advice
> (because I might be doing something stupid).
>
> I have an array of simple objects, created as follows:
>
> class CF(object):
> d
Hello,
when doing some test I saw a very important bug in numpy (at least on the svn
version and 1.0.3 (ubuntu package)).
I'm using a svn version of numpy:
In [31]: numpy.__version__
Out[31]: '1.0.5.dev4767'
The problem is for an array larger than 256*256 the su
Sorry its not really a bug. I understood why . It's an integer and I'm doing
an overflow. Perhaps an error message can be printed or an automatic change
(with a warning) can be done. I think that I prefer to loose the type but
keep the value correct.
N.
___
On Feb 5, 2008 11:58 AM, <[EMAIL PROTECTED]> wrote:
> The problem is for an array larger than 256*256 the sum is going crazy.
>
> In [45]: numpy.arange(256*256)
> Out[45]: array([0, 1, 2, ..., 65533, 65534, 65535])
>
> In [46]: numpy.arange(256*256).sum()
> Out[46]: 2147450880
>
> In [
On Feb 5, 2008 9:27 PM, Keith Goodman <[EMAIL PROTECTED]> wrote:
> On Feb 5, 2008 11:58 AM, <[EMAIL PROTECTED]> wrote:
> > The problem is for an array larger than 256*256 the sum is going crazy.
> >
> > In [45]: numpy.arange(256*256)
> > Out[45]: array([0, 1, 2, ..., 65533, 65534, 655
37 matches
Mail list logo