Thanks all for your help, I think I'm on my way again.
The catch in the first place was not being confident that a
PyArray_Scalar was the thing I needed. I grep'd the code for uint8,
int8 and so on and could not find their definitions.
On first reading I overlooked the PyArray_Scalar link in thi
Francesc Alted wrote:
> A Wednesday 03 March 2010 02:58:31 David Cournapeau escrigué:
>>> PyObject *ret;
>>> PyArray_Descr *typecode;
>>>
>>>
>>> typecode = PyArray_DescrFromType(PyArray_UINT8);
>>> ret = PyArray_Scalar(NULL, typecode, NULL);
>>> Py_DECREF(typecode);
>> Sorry, this is wrong, t
A Wednesday 03 March 2010 02:58:31 David Cournapeau escrigué:
> > PyObject *ret;
> > PyArray_Descr *typecode;
> >
> >
> > typecode = PyArray_DescrFromType(PyArray_UINT8);
> > ret = PyArray_Scalar(NULL, typecode, NULL);
> > Py_DECREF(typecode);
>
> Sorry, this is wrong, this does not work on m
David Cournapeau wrote:
> James Bergstra wrote:
>
>>
>> Maybe I'm missing something... but I don't think I want to create an
>> array.
>
> Ah, I misunderstood your question. There are at least two ways:
>
> PyObject *ret;
> ret = PyArrayScalar_New(UInt8);
>
> Or
>
> PyObject *ret;
> PyArray_D
PyArray_Scalar
Is the one you want.
Travis
--
(mobile phone of)
Travis Oliphant
Enthought, Inc.
1-512-536-1057
http://www.enthought.com
On Mar 2, 2010, at 6:46 PM, James Bergstra
wrote:
> On Tue, Mar 2, 2010 at 7:32 PM, David Warde-Farley
> wrote:
>>
>> On 2-Mar-10, at 7:23 PM, James Ber
James Bergstra wrote:
>
> Maybe I'm missing something... but I don't think I want to create an array.
Ah, I misunderstood your question. There are at least two ways:
PyObject *ret;
ret = PyArrayScalar_New(UInt8);
Or
PyObject *ret;
PyArray_Descr *typecode;
typecode = PyArray_DescrFromType
Warren Weckesser wrote:
I want to create one of those numpy.int8 guys.
>> np.int8 is a type, and so is numpy.ndarray. And they are different.
>> There's lots of docs about how to make arrays, but how do I make a
>> scalar?
ah - I see -- you want to make a numpy scalar, not the s
James Bergstra wrote:
> On Tue, Mar 2, 2010 at 7:18 PM, Warren Weckesser
> wrote:
>
>> James Bergstra wrote:
>>
>>> On Tue, Mar 2, 2010 at 3:09 PM, Christopher Barker
>>> wrote:
>>>
>>>
James Bergstra wrote:
> Maybe I'm missing something... but I don't t
On Tue, Mar 2, 2010 at 7:32 PM, David Warde-Farley wrote:
>
> On 2-Mar-10, at 7:23 PM, James Bergstra wrote:
>
>> Sorry... again... how do I make such a scalar... *in C* ? What would
>> be the recommended C equivalent of this python code? Are there C
>> type-checking functions for instances of t
On 2-Mar-10, at 7:23 PM, James Bergstra wrote:
> Sorry... again... how do I make such a scalar... *in C* ? What would
> be the recommended C equivalent of this python code? Are there C
> type-checking functions for instances of these objects? Are there C
> functions for converting to and from
On Tue, Mar 2, 2010 at 7:18 PM, Warren Weckesser
wrote:
> James Bergstra wrote:
>> On Tue, Mar 2, 2010 at 3:09 PM, Christopher Barker
>> wrote:
>>
>>> James Bergstra wrote:
>>>
Maybe I'm missing something... but I don't think I want to create an array.
In [3]: import numpy
>>>
James Bergstra wrote:
> On Tue, Mar 2, 2010 at 3:09 PM, Christopher Barker
> wrote:
>
>> James Bergstra wrote:
>>
>>> Maybe I'm missing something... but I don't think I want to create an array.
>>>
>>> In [3]: import numpy
>>>
>>> In [4]: type(numpy.int8())
>>> Out[4]:
>>>
>>> In [5]: isi
On Tue, Mar 2, 2010 at 3:09 PM, Christopher Barker
wrote:
> James Bergstra wrote:
>> Maybe I'm missing something... but I don't think I want to create an array.
>>
>> In [3]: import numpy
>>
>> In [4]: type(numpy.int8())
>> Out[4]:
>>
>> In [5]: isinstance(numpy.int8(), numpy.ndarray)
>> Out[5]:
James Bergstra wrote:
> Maybe I'm missing something... but I don't think I want to create an array.
>
> In [3]: import numpy
>
> In [4]: type(numpy.int8())
> Out[4]:
>
> In [5]: isinstance(numpy.int8(), numpy.ndarray)
> Out[5]: False
right, it's a type object:
In [13]: type(np.uint8)
Out[13]:
On Mon, Mar 1, 2010 at 1:44 AM, David Cournapeau wrote:
> On Mon, Mar 1, 2010 at 1:35 PM, James Bergstra
> wrote:
>> Could someone point me to documentation (or even numpy src) that shows
>> how to allocate a numpy.int8 in C, or check to see if a PyObject is a
>> numpy.int8?
>
> In numpy, the typ
On Mon, Mar 1, 2010 at 1:35 PM, James Bergstra
wrote:
> Could someone point me to documentation (or even numpy src) that shows
> how to allocate a numpy.int8 in C, or check to see if a PyObject is a
> numpy.int8?
In numpy, the type is described in the dtype type object, so you
should create the a
Could someone point me to documentation (or even numpy src) that shows
how to allocate a numpy.int8 in C, or check to see if a PyObject is a
numpy.int8?
Thanks,
James
--
http://www-etud.iro.umontreal.ca/~bergstrj
___
NumPy-Discussion mailing list
NumPy
17 matches
Mail list logo