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 = NA_InputArray(N A_updateDataPtr (array), tFloat64,
NUM_C_ARRAY)
return flat_array_obj
cdef NumArray array_to_int(Nu mArray array):
# maybe here is memoty leak!
cdef NumArray flat_array_obj
flat_array_obj = NA_InputArray(N A_updateDataPtr (array), tInt32,
NUM_C_ARRAY)
return flat_array_obj
def un_project(GLdo uble winx, GLdouble winy, GLdouble winz, NumArray model
not None, NumArray proj not None, NumArray viewport not None):
assert NA_elements(mod el) == 16 and NA_elements(pro j) == 16 and
NA_elements(vie wport) == 4,\
"modelview matrix, projection matrix or viewport ar of the wrong size"
# cdef GLdouble objx
# cdef GLdouble objy
# cdef GLdouble objz
# cdef NumArray flat_model
# cdef NumArray flat_proj
cdef NumArray flat_view
# flat_model = array_to_double (model)
# flat_proj = array_to_double (proj)
flat_view = array_to_int(vi ewport) <<<<<<<<<<<<<<< <<<<<<<<
# success = gluUnProject(wi nx, winy, winz,
<double*>NA_OFF SETDATA(flat_mo del), <double*>NA_OFF SETDATA(flat_pr oj),
<int*>NA_OFFSET DATA(flat_view) , &objx, &objy, &objz)
# assert success, 'failure in the unprojection'
cdef NumArray new_array
new_array = NA_NewArray(NUL L, tFloat32, 1, 3)
# new_array.froml ist([objx, objy, objz])
return new_array
Ok, its in Pyrex and has a bug in
flat_view = array_to_int(vi ewport),
but I don't know why. If I change the code to
flat_view = array_to_double (viewport)
its runnig without glitches. I really dont understand it.
Thx
Marco 4 1990
On Mon, 23 Feb 2004 23:14:03 +0100, Marco Bubke wrote:
.... Ok, its in Pyrex and has a bug in flat_view = array_to_int(vi ewport), but I don't know why. If I change the code to flat_view = array_to_double (viewport) its runnig without glitches. I really dont understand it.
Thx
Marco
Yes, me too. I wasn't sure if NA_InputArray was supposed
to be able to handle type conversions, so I used the python
method:
array = array.astype(nu marray.Int32)
and then used NA_InputArray on that.
Simon.
Simon Burton wrote: On Mon, 23 Feb 2004 23:14:03 +0100, Marco Bubke wrote:
... Ok, its in Pyrex and has a bug in flat_view = array_to_int(vi ewport), but I don't know why. If I change the code to flat_view = array_to_double (viewport) its runnig without glitches. I really dont understand it.
Thx
Marco
Yes, me too. I wasn't sure if NA_InputArray was supposed to be able to handle type conversions, so I used the python method:
array = array.astype(nu marray.Int32)
and then used NA_InputArray on that.
Simon.
Ok, Than I do that, I get everytime a Segmentation fault. Before it was only
from time to time. An its 100% NA_InputArray. If I erease NA_updateDataPt r
before NA_InputArray I get a amok process.
cdef NumArray array_to_float( NumArray array):
# maybe here is memoty leak!
cdef NumArray flat_array
cdef NumArray new_array
print 'mark 1'
new_array = array.astype('F loat32')
print new_array
print 'mark 2'
new_array = NA_updateDataPt r(new_array)
print 'mark 3'
NA_IoArray(new_ array, tFloat32, NUM_C_ARRAY)
print 'mark 4'
flat_array = NA_updateDataPt r(flat_array)
print 'mark 5'
return flat_array
Simon Burton wrote: On Mon, 23 Feb 2004 23:14:03 +0100, Marco Bubke wrote:
... Ok, its in Pyrex and has a bug in flat_view = array_to_int(vi ewport), but I don't know why. If I change the code to flat_view = array_to_double (viewport) its runnig without glitches. I really dont understand it.
Thx
Marco
Yes, me too. I wasn't sure if NA_InputArray was supposed to be able to handle type conversions, so I used the python method:
array = array.astype(nu marray.Int32)
and then used NA_InputArray on that.
Simon.
Ok, Than I do that, I get everytime a Segmentation fault. Before it was only
from time to time. An its 100% NA_InputArray. If I erease NA_updateDataPt r
before NA_InputArray I get a amok process.
cdef NumArray array_to_float( NumArray array):
# maybe here is memoty leak!
cdef NumArray flat_array
cdef NumArray new_array
print 'mark 1'
new_array = array.astype('F loat32')
print new_array
print 'mark 2'
NA_updateDataPt r(new_array)
print 'mark 3'
NA_IoArray(new_ array, tFloat32, NUM_C_ARRAY)
print 'mark 4'
flat_array = NA_updateDataPt r(flat_array)
print 'mark 5'
return flat_array
Marco Bubke wrote: Simon Burton wrote:
On Mon, 23 Feb 2004 23:14:03 +0100, Marco Bubke wrote:
... Ok, its in Pyrex and has a bug in flat_view = array_to_int(vi ewport), but I don't know why. If I change the code to flat_view = array_to_double (viewport) its runnig without glitches. I really dont understand it.
Thx
Marco
Yes, me too. I wasn't sure if NA_InputArray was supposed to be able to handle type conversions, so I used the python method:
array = array.astype(nu marray.Int32)
and then used NA_InputArray on that.
Simon.
Ok, Than I do that, I get everytime a Segmentation fault. Before it was only from time to time. An its 100% NA_InputArray. If I erease NA_updateDataPt r before NA_InputArray I get a amok process.
cdef NumArray array_to_float( NumArray array): # maybe here is memoty leak! cdef NumArray flat_array cdef NumArray new_array print 'mark 1' new_array = array.astype('F loat32') print new_array print 'mark 2' new_array = NA_updateDataPt r(new_array) print 'mark 3' NA_IoArray(new_ array, tFloat32, NUM_C_ARRAY) print 'mark 4' flat_array = NA_updateDataPt r(flat_array) print 'mark 5' return flat_array
Ok, I have it tracked down to
static PyArrayObject*
NA_InputArray(P yObject *a, NumarrayType t, int requires)
{
printf("enter input\n");
PyArrayObject *wa = NULL;
if (NA_isPythonSca lar(a)) {
if (t == tAny)
t = NA_NumarrayType (a);
if (t < 0) goto _exit;
wa = NA_vNewArray( NULL, t, 0, NULL);
if (!wa) goto _exit;
if (NA_setFromPyth onScalar(wa, 0, a) < 0) {
Py_DECREF(wa);
wa = NULL;
}
goto _exit;
} else if ((wa = sequenceAsArray (a, &t))) {
printf("input 1\n");
if (!satisfies(wa, requires, t)) {
printf("input 2\n");
PyArrayObject *wa2 = getArray(wa, t, "astype");
printf("input 3\n");
Py_DECREF(wa);
printf("input 4\n");
wa = wa2;
}
printf("input 5\n");
NA_updateDataPt r(wa);
}
_exit:
printf("leave input\n");
return wa;
}
static PyArrayObject *
NA_updateDataPt r(PyArrayObject *me)
{
printf("enter update\n");
if (!me) return me;
printf("update 1\n");
if (getReadBufferD ataPtr (me->_data, (void **) &me->data) < 0) {
printf("update 2\n");
return (PyArrayObject *) PyErr_Format(_E rror,
"NA_updateDataP tr: error getting read buffer data ptr");
}
printf("update 3\n");
if (isBufferWritea ble( me->_data ))
me->flags |= WRITABLE;
else
me->flags &= ~WRITABLE;
printf("leave update\n");
return me;
}
static int
getReadBufferDa taPtr(PyObject *buffobj, void **buff)
{
printf("enter read buffer");
int rval = -1;
PyObject *buff2;
printf("read buffer 1");
if ((buff2 = getBuffer(buffo bj))) {
printf("read buffer 2");
if (buff2->ob_type->tp_as_buffer->bf_getreadbuff er)
printf("read buffer 3");
rval = buff2->ob_type->tp_as_buffer->bf_getreadbuff er(buff2,
0, buff); <<<<<<<<<<<<<<< <<<<<<<<<<<<<<< <<<<<<<<<<
printf("read buffer 4");
Py_DECREF(buff2 );
}
printf("leave read buffer");
return rval;
}
The Segmentation fault is happen between "read buffer 3" and "read buffer
4". But this a little bit to much Python inside for me. Maybe the .data
isn't right?
regards
Marco This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 "import numarray" allows the exe to
run. Left in, I get "4.exe has generated errors" etc.
I'm going around and around and there isn't much on Google.
py2exe output is last.
|
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
win32
numarray: Version 0.7
the output from the installation (by hand) you can see below:
|
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 "/home/marco/projects/test_pyrex/gl.pyx", line 40, in gl
ctypedef class numarray.NumArray :
|
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 function)
#include <python2.3/Python.h>
|
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 floats.
BTW, how do you unzip NumTut in windows? And is there a newer version?
Thank you
| |
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 someone help?
For example imagine I just want to do something as simple as making a
subclass "NewClass" with the __init__ method overridden so that the
behaviour would be:
>>> a = NewClass(2)
>>> print a
|
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 entire-byte-consuming-Boolean.
Good luck all:-)
uint32Mask =
numarray.array(, numarray.UInt32)
uint32MaskInner = numarray.copy.deepcopy(uint32Mask)
uint32MaskInner.shape =
|
by: Bryan |
last post by:
hi,
what is the difference among numeric, numpy and numarray? i'm going to start
using matplotlib soon and i'm not sure which one i should use.
this page says, "Numarray is a re-implementation of an older Python array module
called Numeric"
http://www.stsci.edu/resources/software_hardware/numarray
|
by: robert |
last post by:
just a note - some speed comparisons :
0.60627370238398726
0.42836673376223189
0.36965815487747022
0.016557970357098384
0.15692469294117473
0.01951756438393204
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |