Re: Help with chaos math extensions.
Well, I didn't buy it JUST to compile python extensions, I'm looking to write C++ apps as well, I just use python for a lot of math and science simulations, and I got VS .NET at heavy discount since I'm a student. > Brandon K wrote: >> In case you missed it, I said I have windows XP. Windows XP >> pre-compiled python binaries are built on VS .NET 2003. In order to >> build extensions, you need the compiler the interpreter was built on, >> or at least that is what is reported to me by calling setup.py. If I >> was using linux, which I currently am not, it'd be a different story. >> Additionally, GCC isn't available for windows XP, only MinGW, the >> port, and I don't know that much about it to use it running on a >> Windows platform. Furthermore, I was asking for help on an extension, >> not an economical question about my programming environment. >> >> Thanks >> >>> >>> On Oct 4, 2005, at 10:25 PM, Brandon Keown wrote: >>> I have programmed a fractal generator (Julia Set/Mandelbrot Set) in python in the past, and have had good success, but it would run so slowly because of the overhead involved with the calculation. I recently purchased VS .NET 2003 (Win XP, precomp binary of python 2.4.2rc1) to make my own extensions. >>> >>> Why did you need to purchase anything when gcc is available for free? >>> > Since gcc isn't an option, the logical way to proceed would be to do > what others have done and install the Microsoft Toolkit compiler, > available from their web site for the outrageous price of nothing. I can > vouch that it really does compile extensions for Python 2.4 on Windows, > having done that myself. > > See > > http://www.vrplumber.com/programming/mstoolkit/ > > regards > Steve == Posted via Newsgroups.com - Usenet Access to over 100,000 Newsgroups == Get Anonymous, Uncensored, Access to West and East Coast Server Farms! == Highest Retention and Completion Rates! HTTP://WWW.NEWSGROUPS.COM == -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with chaos math extensions.
Brandon K wrote: > In case you missed it, I said I have windows XP. Windows XP > pre-compiled python binaries are built on VS .NET 2003. In order to > build extensions, you need the compiler the interpreter was built on, or > at least that is what is reported to me by calling setup.py. If I was > using linux, which I currently am not, it'd be a different story. > Additionally, GCC isn't available for windows XP, only MinGW, the port, > and I don't know that much about it to use it running on a Windows > platform. Furthermore, I was asking for help on an extension, not an > economical question about my programming environment. > > Thanks > >> >>On Oct 4, 2005, at 10:25 PM, Brandon Keown wrote: >> >>> I have programmed a fractal generator (Julia Set/Mandelbrot Set) >>>in python in the past, and have had good success, but it would run so >>>slowly because of the overhead involved with the calculation. I >>>recently purchased VS .NET 2003 (Win XP, precomp binary of python >>>2.4.2rc1) to make my own extensions. >> >>Why did you need to purchase anything when gcc is available for free? >> Since gcc isn't an option, the logical way to proceed would be to do what others have done and install the Microsoft Toolkit compiler, available from their web site for the outrageous price of nothing. I can vouch that it really does compile extensions for Python 2.4 on Windows, having done that myself. See http://www.vrplumber.com/programming/mstoolkit/ regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with chaos math extensions.
On Oct 5, 2005, at 7:44 AM, Brandon K wrote:In case you missed it, I said I have windows XP. Windows XP pre-compiled python binaries are built on VS .NET 2003. In order to build extensions, you need the compiler the interpreter was built on, or at least that is what is reported to me by calling setup.py. If I was using linux, which I currently am not, it'd be a different story. Additionally, GCC isn't available for windows XP, only MinGW, the port, and I don't know that much about it to use it running on a Windows platform. Furthermore, I was asking for help on an extension, not an economical question about my programming environment.Well, since I don't use Windows XP, I did not know this fact. I wasn't trying to offend you or argue with you, I was just flat out curious why you had to go out and buy Visual Studio.---Andrew Gwozdziewycz[EMAIL PROTECTED]http://ihadagreatview.orghttp://plasticandroid.org -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with chaos math extensions.
Brandon K" wrote: > Here's the Script it was being used in (forgive it if it seems a bit > messy, i have been tinkering with variables and such to try different > ideas and haven't really cleaned it up). the C compiler does in fact provide you with some clues: c:\test\c_lib.cpp(22) : warning C4700: local variable 'c' used without having been initialized here's the culprit: Py_complex *c; Complex* cplx; if(!PyArg_ParseTuple(args,"D",c)) return NULL; PyArg_ParseTuple expects a pointer to a Py_complex object, but you're passing in an initialized pointer. this works better: Py_complex c; Complex* cplx; if(!PyArg_ParseTuple(args,"D",&c)) return NULL; cplx = new Complex(&c); return Py_BuildValue("D",cplx->toOld()); here's the next warning: c:\test\complex.cpp(50) : warning C4700: local variable 'c' used without having been initialized this is your toOld function, which has a similar problem: Py_complex* Complex::toOld(void) { Py_complex* c; c->real = this->real; c->imag = this->imag; return c; } since c isn't initialized, you'll overwrite some random memory locations when you assign things to it. here's a brute-force hack: Py_complex* Complex::toOld(void) { static Py_complex c; c.real = this->real; c.imag = this->imag; return &c; } here's a better fix: Py_complex Complex::toOld(void) { Py_complex c; c.real = this->real; c.imag = this->imag; return c; } which requires you to change return Py_BuildValue("D",cplx->toOld()); to return Py_BuildValue("D",&cplx->toOld()); I only got this far before I ran out of time; there might be more bugs in there. -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with chaos math extensions.
Here's the Script it was being used in (forgive it if it seems a bit messy, i have been tinkering with variables and such to try different ideas and haven't really cleaned it up). import ctest import Tkinter import threading hue_map = ("#FF","#FEFEFF","#FDFDFF","#FCFCFF","#FBFBFF","#FAFAFF","#F9F9FF","#F8F8F8","#F7F7FF","#F6F6F6","#FF","#FF","#FF","#FF","#FF","#FF","#FF",\ "#FF","#FF","#FF","#FF","#FF","#FF","#FF","#FF") class Mandelbrot_Set(Tkinter.Canvas): def __init__(self,master,iters): Tkinter.Canvas.__init__(self,master) self.dims = {'x':500,'y':500} self.config(height=self.dims['y'],width=self.dims['x']) self.r_range = (-2.0,2.0) self.i_range = (-2.0,2.0) self.iters = iters self.prec = {'r':1.*(self.r_range[1]-self.r_range[0])/(self.dims['x']),'i':1.*(self.i_range[1]-self.i_range[0])/self.dims['y']} self.escapemap = ctest.escapeMap(-1j,self.iters,(self.dims['x'],self.dims['y']),(self.r_range[0],self.r_range[1]),(self.i_range[0],self.i_range[1])) self.select = False self.select_event = (0,0) self.sbox = None self.bind("",self.selection_box) self.bind("",self.select_update) self.t_draw = threading.Thread(target=self.draw) self.t_draw.start() def draw(self): for j in range(self.dims['y']): i = 0 while i < self.dims['x']: cur = 0; try: color = self.escapemap[j][i] while self.escapemap[j][i+cur] == color: cur+=1 except IndexError: break; hue_step = 1.*len(hue_map)/self.iters if color == -1: f = "#00" else: f = hue_map[int(hue_step*color)] self.create_line(i,j,i+cur,j,fill=f) i+=cur def selection_box(self,event): if not self.select: self.select_event = (event.x,event.y) self.select = True else: self.r_range = self.new_range(event.x,self.select_event[0]) self.i_range = self.new_range(event.y,self.select_event[1]) print self.r_range,self.i_range self.select = False self.delete(Tkinter.ALL) self.t_draw.run() self.select_update(event) def new_range(self,x,y): if x > y: return (y,x) else: return (x,y) def select_update(self,event): if not self.select: return else: if self.sbox != None: self.delete(self.sbox) self.sbox = self.create_rectangle(self.select_event[0],self.select_event[1],event.x,event.y,fill=None,outline="#00") else: self.sbox = self.create_rectangle(self.select_event[0],self.select_event[1],event.x,event.y,fill=None,outline="#00") if __name__ == "__main__": root = Tkinter.Tk() c = Mandelbrot_Set(root,50) c.pack() root.mainloop() The error occurs in the instantiation of the Mandelbrot_Set object. Additionally in little mini timing scripts such as import time import ctest t = time.time() c = ctest.escapeMap(-1j,100,(500,500)) print time.time()-t this will crash it too however I found that just opening up the interpreter and typing import ctest ctest.escapeMap(-1j,100,(50,50)) #50 yields much smaller output than 500x500 it generates a 2d tuple fine. So the error seems really obscure to me, and I don't understand it. Brandon Keown wrote: I have programmed a fractal generator (Julia Set/Mandelbrot Set) in python in the past, and have had good success, but it would run so slowly because of the overhead involved with the calculation. I recently purchased VS .NET 2003 (Win XP, precomp binary of python 2.4.2rc1) to make my own extensions. I was wondering if anyone could help me figure out why I'm getting obscure memory exceptions (runtime errors resulting in automatic closing of Python) with my extension. It seems to run okay if imported alone, but when accompanied in a list of instructions such as a function it crashes. a short script or interpreter session that illustrates how to get the errors would help. -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with chaos math extensions.
Brandon Keown wrote: >I have programmed a fractal generator (Julia Set/Mandelbrot Set) in > python in the past, and have had good success, but it would run so > slowly because of the overhead involved with the calculation. I > recently purchased VS .NET 2003 (Win XP, precomp binary of python > 2.4.2rc1) to make my own extensions. I was wondering if anyone could > help me figure out why I'm getting obscure memory exceptions (runtime > errors resulting in automatic closing of Python) with my extension. It > seems to run okay if imported alone, but when accompanied in a list of > instructions such as a function it crashes. a short script or interpreter session that illustrates how to get the errors would help. -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with chaos math extensions.
In case you missed it, I said I have windows XP. Windows XP pre-compiled python binaries are built on VS .NET 2003. In order to build extensions, you need the compiler the interpreter was built on, or at least that is what is reported to me by calling setup.py. If I was using linux, which I currently am not, it'd be a different story. Additionally, GCC isn't available for windows XP, only MinGW, the port, and I don't know that much about it to use it running on a Windows platform. Furthermore, I was asking for help on an extension, not an economical question about my programming environment. Thanks > > > On Oct 4, 2005, at 10:25 PM, Brandon Keown wrote: >> >>I have programmed a fractal generator (Julia Set/Mandelbrot Set) >> in python in the past, and have had good success, but it would run so >> slowly because of the overhead involved with the calculation. I >> recently purchased VS .NET 2003 (Win XP, precomp binary of python >> 2.4.2rc1) to make my own extensions. > > Why did you need to purchase anything when gcc is available for free? > > > --- > Andrew Gwozdziewycz > [EMAIL PROTECTED] > http://ihadagreatview.org > http://plasticandroid.org > > > > -- http://mail.python.org/mailman/listinfo/python-list
Help with chaos math extensions.
Hi, I have programmed a fractal generator (Julia Set/Mandelbrot Set) in python in the past, and have had good success, but it would run so slowly because of the overhead involved with the calculation. I recently purchased VS .NET 2003 (Win XP, precomp binary of python 2.4.2rc1) to make my own extensions. I was wondering if anyone could help me figure out why I'm getting obscure memory exceptions (runtime errors resulting in automatic closing of Python) with my extension. It seems to run okay if imported alone, but when accompanied in a list of instructions such as a function it crashes. I have implemented it in C and C++, although I prefer the latter. In C I got errors only with certain ranges in my function. I have attached my source to this email and hope someone can help me. Thanks, Brandon c_lib(cpp).tar.gz Description: application/gzip -- http://mail.python.org/mailman/listinfo/python-list