473,327 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Numarray und NA_NewAll

Hi

If I understand the code right then there will be mset called if buffer is
NULL. Why?

I want only a empty array, why not a malloc? The data section after that
will be overwritten by me. Maybe I'm wrong.

static PyArrayObject *
NA_NewAll(int ndim, maybelong *shape, NumarrayType type,
void *buffer, maybelong byteoffset, maybelong bytestride,
int byteorder, int aligned, int writeable)
{
PyArrayObject *result = NA_NewAllFromBuffer(
ndim, shape, type, Py_None, byteoffset, bytestride,
byteorder, aligned, writeable);

if (result) {
if (!NA_NumArrayCheck((PyObject *) result)) {
PyErr_Format( PyExc_TypeError,
"NA_NewAll: non-NumArray result");
result = NULL;
} else {
if (buffer) {
memcpy(result->data, buffer,
PyArray_NBYTES(result));
} else {
memset(result->data, 0,
PyArray_NBYTES(result)); <-- ??????????????????
}
}
}
return result;
}

def get_polygon_stipple():
"""Return the polygon stipple pattern"""
cdef maybelong lenght
cdef void** data
lenght = 128
new_array = NA_NewArray(NULL, tUInt32, 1, lenght)
glGetPolygonStipple(<GLubyte*>NA_OFFSETDATA(new_ar ray))
assert glGetError() != INVALID_OPERATION,\
"can't be called between gl.begin() and gl.end()"
return new_array

Here my code. I'm not sure if this is possible? I have also found
NA_getBufferPtrAndSize? Should I use this?

regards

Marco
Jul 18 '05 #1
1 1100
Sorry, little stupid bug is in the it. It must be tUInt8.

Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: RJS | last post by:
Hi all, I can't get a py2exe compiled app to run with numarray (numarray-0.5.win32- py2.2). Also wxPythonWIN32-2.3.3.1-Py22 and ActivePython-2.2.1-222. In the sample below, commenting out...
3
by: Alexander Schwaigkofler | last post by:
Hi! I have the following problem with numarray. I read the install.txt manual, but it doesn't already work. OS: Microsoft Windows 2000 python: Python 2.2.3 (#42, May 30 2003, 18:12:08) on...
4
by: Marco Bubke | last post by:
Hi I have tried to include numarray in Pyrex but I get allways this error: Traceback (most recent call last): File "gears.py", line 9, in ? import gl File...
4
by: Marco Bubke | last post by:
Hi Ok, I get a reproduceable seqmentation fault. Ok, fist the code: cdef NumArray array_to_double(NumArray array): # maybe here is memoty leak! cdef NumArray flat_array_obj flat_array_obj...
2
by: Marc Schellens | last post by:
Following the NumPy documentation, I took over some C code, but run into an error. Does anybody have a suggestion? Thanks, marc gdlpython.cpp:225: `PyArray_Type' undeclared (first use this...
3
by: SunX | last post by:
I tried to initialize a float point array by: import numarray xur = numarray.fromfunction(lambda x,y,z:x*y*z, (2, 2, 2)) but I ended up with an integer array even though x, y, and z are all...
3
by: Mizrandir | last post by:
I'd like to subclass numarray's array. I'd like to add some methods and override others like __init__. I don't know how to do this and haven't found help searching the manual or the web, can...
0
by: andrewfelch | last post by:
Below is the code to/from Boolean arrays and Unsigned integers. On my Pentium 4, functions such as "bitwise_and" are 32 times faster when run on 32-bit integers instead of the...
0
by: robert | last post by:
just a note - some speed comparisons : 0.60627370238398726 0.42836673376223189 0.36965815487747022 0.016557970357098384 0.15692469294117473 0.01951756438393204
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.