NumPy and vectorize

2010-04-28 Thread Carl Johan Rehn
I'm having problem with the return values of NumPy's vectorize function. When I pass an array of strings in the following simple example, vectorize truncates the strings in the returned list. Any clues of what to do? Yours, Carl import numpy as np def __f(x): return x f = vectorize(__f)

numpy performance and random numbers

2009-12-19 Thread Carl Johan Rehn
Dear friends, I plan to port a Monte Carlo engine from Matlab to Python. However, when I timed randn(N1, N2) in Python and compared it with Matlab's randn, Matlab came out as a clear winner with a speedup of 3-4 times. This was truly disappointing. I ran tthis test on a Win32 machine and without

Re: numpy performance and random numbers

2009-12-19 Thread Carl Johan Rehn
On Dec 19, 12:29 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Sat, 19 Dec 2009 02:05:17 -0800, Carl Johan Rehn wrote: Dear friends, I plan to port a Monte Carlo engine from Matlab to Python. However, when I timed randn(N1, N2) in Python and compared it with Matlab's

Re: numpy performance and random numbers

2009-12-19 Thread Carl Johan Rehn
On Dec 19, 2:49 pm, sturlamolden sturlamol...@yahoo.no wrote: On 19 Des, 11:05, Carl Johan Rehn car...@gmail.com wrote: I plan to port a Monte Carlo engine from Matlab to Python. However, when I timed randn(N1, N2) in Python and compared it with Matlab's randn, Matlab came out as a clear

Re: numpy performance and random numbers

2009-12-19 Thread Carl Johan Rehn
On Dec 19, 3:16 pm, sturlamolden sturlamol...@yahoo.no wrote: On 19 Des, 14:06, Carl Johan Rehn car...@gmail.com wrote: Matlab and numpy have (by chance?) the exact names for the same functionality, Common ancenstry, NumPy and Matlab borrowed the name from IDL. LabView, Octave and SciLab

Re: numpy performance and random numbers

2009-12-19 Thread Carl Johan Rehn
On Dec 19, 4:47 pm, sturlamolden sturlamol...@yahoo.no wrote: On 19 Des, 16:20, Carl Johan Rehn car...@gmail.com wrote: How about mulit-core or (perhaps more exciting) GPU and CUDA? I must admit that I am extremely interested in trying the CUDA-alternative. Obviously, cuBLAS

Re: numpy performance and random numbers

2009-12-19 Thread Carl Johan Rehn
On 19 Dec, 23:09, sturlamolden sturlamol...@yahoo.no wrote: On 19 Des, 22:58, sturlamolden sturlamol...@yahoo.no wrote: If you pick two random states (using any PRNG), you need error- checking that states are always unique, i.e. that each PRNG never reaches the starting state of the

ValueError in pickle module during unpickling a infinite float (python 2.5.2)

2008-03-12 Thread rehn
Unpickling an infinite float caused a ValueError in the pickle module. I need to pickle and load infinite floats in my project. Do you have any suggestions how to solve the issue? # code describing the issue: # define float constants with double-precision: # copied from fpconst module:

Difference between CPython, Python for .NET and IronPython?

2006-02-18 Thread Carl Johan Rehn
What is the difference between CPython, Python for .NET, and IronPython? For example, if I'm running IronPython, can I access modules such as Numeric and numarray? As I understand it, interoperability with C# and .NET works in both directions with IronPython, but CPython modules cannot be