Re: [Numpy-discussion] numpy : your experiences?

2007-11-22 Thread [EMAIL PROTECTED]
> > In particular for the simulation yes, depending on the level of detail
> > of course. But only parts, eg. random number generation for certain
> > distributions had to be coded in C/C++.
>
> Are you saying you extended the scipy/numpy tools for this?
> Do you think it would make sense to put some of that stuff on the wiki?

No, this is very special to my application and not really numpy
specific. I had to write a Metropolis-Hastings sampler, which worked
in python but was too slow. I've coded this for a specific
distribution in C++ and pass numpy arrays and python lists from and to
C++ functions using boost::python.

Bernhard


___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Numpy matrix and Blitz Matrix

2007-11-22 Thread Paolo Tenconi
Hi Everyone,

*) numpy arrays are automatically converted to blitz arrays. That's fine.

*) I need to work with blitz Matrix objects, but I noticed that
numpy matrix objects are not converted to them and I get a
compilation error too

3) Does someone on the list succeeded doing that?
Or is there a workaround to create quickly a blitz matrix object
from a numpy 2D array or numpy-matrix without wasting time
in casting operations?

It would be nice having an automatic translation of numpy.matrix to
blitz Matrix as matrices are used frequently in scientific computing.

Any suggestion or help would be very glad.
Paolo


#--  EXAMPLE CODE ---

import numpy
import scipy

#Dot product with arrays (it works)
x=numpy.array([[1,2,],[3,4]])
y=numpy.zeros((2,2))
scipy.weave.inline("""y=x*x;""",['x','y'],type_converters=weave.converters.blitz,compiler='gcc',force=1)

#Matrix multiplication with matrix (gives compilation error)
X=numpy.matlib.mat('1 2; 3 4')
Y=numpy.matlib.zeros((2,2))
scipy.weave.inline("""Y=X*X;""",['X','Y'],type_converters=weave.converters.blitz,compiler='gcc')

#
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Adding ACML support

2007-11-22 Thread Matthieu Brucher
Hi,

I'm trying to get numpy work with AMD's MKL. The problem is that they not
give a CBLAS interface, only the BLAS one.
Can the numpy distutils check the existence of the cblas interface somewhere
? For the moment, it checks something with BLAS (but no actual testing takes
place), but not CBLAS.

Matthieu
-- 
French PhD student
Website : http://miles.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] loadtxt bug?

2007-11-22 Thread Alan G Isaac
In numpy.core.numeric.py you will find loadtxt, which uses
the following::

line = line[:line.find(comments)].strip()

I believe there is a bug here (when a line has no comment).
To illustrate::

>>> line = "12345"
>>> comments = "#"
>>> line[:line.find(comments)]
'1234'

So I propose this should be::

try:
line = line[:line.index(comments)].strip()
except ValueError:
line = line.strip()

Am I right?

Cheers,
Alan Isaac



___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy : your experiences?

2007-11-22 Thread Konrad Hinsen
On 17.11.2007, at 03:50, Rahul Garg wrote:

> It would be awesome if you guys could respond to some of the following
> questions :
> a) Can you guys tell me briefly about the kind of problems you are
> tackling with numpy and scipy?

For me, NumPy is an important building block in a set of  
computational Python libraries that form the basis of my daily work  
in molecular simulations. The main building block is my Molecular  
Modelling Toolkit (http://dirac.cnrs-orleans.fr/MMTK/), but NumPy  
provides the basic data structure (arrays) for much of what MMTK  
does, and even more so for interfacing with the rest of the world. I  
don't use SciPy at all.

> b) Have you ever felt that numpy/scipy was slow and had to switch to
> C/C++/Fortran?

There is some C code (and an increasing amount of Pyrex code) in my  
Python environment, and it is essential for good performance.  
However, in terms of code quantity, it is negligible.

> c) Do you use any form of parallel processing? Multicores? SMPs?
> Clusters? If yes how did u utilize them?

All of them. I use threading (multicores and SMPs) in MMTK, and  
coarse-grained parallelization as implemented in ScientificPython for  
analyzing large data sets.

ScientificPython has two parallel computing modules. The easiest to  
use implements a master-slave model in which a master process  
delegates computational tasks to an arbitrary (and possibly varying)  
number of slave processes:

http://dirac.cnrs-orleans.fr/hg/ScientificPython/main/file/ 
73cc270217fc/Examples/master_slave_demo.py

The other parallelization package is based on the BSP model of  
parallel computing:

http://dirac.cnrs-orleans.fr/hg/ScientificPython/main/file/ 
73cc270217fc/Examples/BSP/
http://dirac.cnrs-orleans.fr/ScientificPython/ScientificPythonManual/

It probably has a steeper learning curve, but it is suitable for more  
complex parallel programs because it permits the construction of  
parallel libraries.

Konrad.
--
-
Konrad Hinsen
Centre de Biophysique Moléculaire, CNRS Orléans
Synchrotron Soleil - Division Expériences
Saint Aubin - BP 48
91192 Gif sur Yvette Cedex, France
Tel. +33-1 69 35 97 15
E-Mail: [EMAIL PROTECTED]
-



___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] loadtxt bug?

2007-11-22 Thread Gael Varoquaux
On Thu, Nov 22, 2007 at 11:14:07PM -0500, Alan G Isaac wrote:
> In numpy.core.numeric.py you will find loadtxt, which uses
> the following::

> line = line[:line.find(comments)].strip()

> I believe there is a bug here (when a line has no comment).
> To illustrate::

> >>> line = "12345"
> >>> comments = "#"
> >>> line[:line.find(comments)]
> '1234'

Unless you are sure that line always ends with a "\n". This is the case
in the code you are refering too. Unless I am missing some thing.

Gaël
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion