[Numpy-discussion] avoid a line...

2011-03-17 Thread dileep kunjaai
Dear sir,
 I am try to read a file of the following format, I want to avoid the first
line and read the remaining as 'float' .
Please help me...


RainWindTempPrSal
0.11.10.020.2   0.2
0.50.   0.  0.4   0.8
0.55.51.50.5   1.5
3.50.51.55.0   2.6
5.14.13.22.3   1.5
4.40.91.52.2.3

-- 
DILEEPKUMAR. R
J R F, IIT DELHI
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] avoid a line...

2011-03-17 Thread eat
Hi,

On Thu, Mar 17, 2011 at 9:36 AM, dileep kunjaai dileepkunj...@gmail.comwrote:

 Dear sir,
  I am try to read a file of the following format, I want to avoid the first
 line and read the remaining as 'float' .
 Please help me...


 RainWindTempPrSal
 0.11.10.020.2   0.2
 0.50.   0.  0.4   0.8
 0.55.51.50.5   1.5
 3.50.51.55.0   2.6
 5.14.13.22.3   1.5
 4.40.91.52.2.3

You may use loadtxt(), with skiprows argument. (See more on
http://docs.scipy.org/doc/numpy/reference/generated/numpy.loadtxt.html).

Regards,
eat


 --
 DILEEPKUMAR. R
 J R F, IIT DELHI


 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Norm of array of vectors

2011-03-17 Thread Andrey N. Sobolev
Dear all, 

Sorry if that's a noob question, but anyway. I have several thousands of
vectors stacked in 2d array. I'd like to get new array containing
Euclidean norms of these vectors and get the vector with minimal norm.

Is there more efficient way to do this than 
argmin(array([sqrt(dot(x,x)) for x in vec_array]))?

Thanks in advance.
Andrey.

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Norm of array of vectors

2011-03-17 Thread eat
Hi,

On Thu, Mar 17, 2011 at 10:44 AM, Andrey N. Sobolev inco...@list.ru wrote:

 Dear all,

 Sorry if that's a noob question, but anyway. I have several thousands of
 vectors stacked in 2d array. I'd like to get new array containing
 Euclidean norms of these vectors and get the vector with minimal norm.

 Is there more efficient way to do this than
 argmin(array([sqrt(dot(x,x)) for x in vec_array]))?

Try
argmin(sum(vec_array** 2, 0)** 0.5)

Regards,
eat


 Thanks in advance.
 Andrey.

 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Norm of array of vectors

2011-03-17 Thread gary ruben
How about

argmin(add.reduce((a*a),axis=1))


In [5]: a
Out[5]:
array([[ 0.24202827,  0.01269182,  0.95162307],
   [ 0.02979253,  0.454 ,  0.49650111],
   [ 0.52626565,  0.08363861,  0.56444878],
   [ 0.89639659,  0.54259354,  0.29245881],
   [ 0.75301013,  0.6248646 ,  0.24565827],
   [ 0.67501358,  0.58920861,  0.37420961],
   [ 0.8776001 ,  0.58055258,  0.16623637],
   [ 0.26271551,  0.24441225,  0.47543652],
   [ 0.12793549,  0.88453877,  0.8479841 ],
   [ 0.49148293,  0.45352964,  0.65575962]])

In [6]: argmin(add.reduce((a*a),axis=1))
Out[6]: 7

In [7]: timeit argmin(array([sqrt(dot(x,x)) for x in a]))
1 loops, best of 3: 67.2 us per loop

In [8]: timeit argmin(array([dot(x,x) for x in a]))
1 loops, best of 3: 36 us per loop

In [9]: timeit argmin(add.reduce((a*a),axis=1))
10 loops, best of 3: 13.6 us per loop

Gary R

On Thu, Mar 17, 2011 at 7:44 PM, Andrey N. Sobolev inco...@list.ru wrote:
 Dear all,

 Sorry if that's a noob question, but anyway. I have several thousands of
 vectors stacked in 2d array. I'd like to get new array containing
 Euclidean norms of these vectors and get the vector with minimal norm.

 Is there more efficient way to do this than
 argmin(array([sqrt(dot(x,x)) for x in vec_array]))?

 Thanks in advance.
 Andrey.
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] avoid a line...

2011-03-17 Thread dileep kunjaai
Thanks sir,, thanks a lot ..

On Thu, Mar 17, 2011 at 1:16 PM, eat e.antero.ta...@gmail.com wrote:

 Hi,

 On Thu, Mar 17, 2011 at 9:36 AM, dileep kunjaai 
 dileepkunj...@gmail.comwrote:

 Dear sir,
  I am try to read a file of the following format, I want to avoid the
 first line and read the remaining as 'float' .
 Please help me...


 RainWindTempPrSal
 0.11.10.020.2   0.2
 0.50.   0.  0.4   0.8
 0.55.51.50.5   1.5
 3.50.51.55.0   2.6
 5.14.13.22.3   1.5
 4.40.91.52.2.3

 You may use loadtxt(), with skiprows argument. (See more on
 http://docs.scipy.org/doc/numpy/reference/generated/numpy.loadtxt.html).

 Regards,
 eat


 --
 DILEEPKUMAR. R
 J R F, IIT DELHI


 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion



 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion




-- 
DILEEPKUMAR. R
J R F, IIT DELHI
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Build ERROR ConfigParser.MissingSectionHeaderError: File contains no section headers

2011-03-17 Thread Jose Borreguero
Thanks Josef, that worked!
I was confused because I was thinking of site.cfg as some sort of bash
script :)

Jose



On Thu, Mar 17, 2011 at 12:40 AM, josef.p...@gmail.com wrote:

 On Thu, Mar 17, 2011 at 12:23 AM, Jose Borreguero borregu...@gmail.com
 wrote:
  Dear Numpy/SciPy users,
 
  I have a build error with Numpy:
 
  $  /usr/local/bin/python2.7 setup.py build
  
File /usr/local/lib/python2.7/ConfigParser.py, line 504, in _read
  raise MissingSectionHeaderError(fpname, lineno, line)
  ConfigParser.MissingSectionHeaderError: File contains no section headers.
  file: /projects/tmp/numpy-1.5.1/site.cfg, line: 60
  'library_dirs = /usr/local/lib\n'
 
  The relevant lines in my site.cfg file:
 

 I think you just need to uncomment all the section headers that you
 use, that`s what the exception says


  library_dirs = /usr/local/lib
  include_dirs = /usr/local/include
 [blas_opt]
  libraries = f77blas, cblas, atlas
 [lapack_opt]
  libraries = lapack, f77blas, cblas, atlas

 Josef

 
 
  I have installed BLAS+LAPACK+ATLAS libraries under /usr/local/lib/atlas
 
  I also installed UMFPACK+AMD+UFConfig+CHOLMOD
 
  I would appreciate any comments. I'm stuck here :(
 
  Best regards,
  Jose M. Borreguero
 
 
 
  Below is the full error traceback:
 
  $  /usr/local/bin/python2.7 setup.py build
 
  Running from numpy source directory.F2PY Version 1
  Traceback (most recent call last):
File setup.py, line 211, in module
  setup_package()
File setup.py, line 204, in setup_package
  configuration=configuration )
File /projects/tmp/numpy-1.5.1/numpy/distutils/core.py, line 152, in
  setup
  config = configuration()
File setup.py, line 151, in configuration
  config.add_subpackage('numpy')
File /projects/tmp/numpy-1.5.1/numpy/distutils/misc_util.py, line
 972,
  in add_subpackage
  caller_level = 2)
File /projects/tmp/numpy-1.5.1/numpy/distutils/misc_util.py, line
 941,
  in get_subpackage
  caller_level = caller_level + 1)
File /projects/tmp/numpy-1.5.1/numpy/distutils/misc_util.py, line
 878,
  in _get_configuration_from_setup_py
  config = setup_module.configuration(*args)
File numpy/setup.py, line 9, in configuration
  config.add_subpackage('core')
File /projects/tmp/numpy-1.5.1/numpy/distutils/misc_util.py, line
 972,
  in add_subpackage
  caller_level = 2)
File /projects/tmp/numpy-1.5.1/numpy/distutils/misc_util.py, line
 941,
  in get_subpackage
  caller_level = caller_level + 1)
File /projects/tmp/numpy-1.5.1/numpy/distutils/misc_util.py, line
 878,
  in _get_configuration_from_setup_py
  config = setup_module.configuration(*args)
File numpy/core/setup.py, line 807, in configuration
  blas_info = get_info('blas_opt',0)
File /projects/tmp/numpy-1.5.1/numpy/distutils/system_info.py, line
 310,
  in get_info
  return cl().get_info(notfound_action)
File /projects/tmp/numpy-1.5.1/numpy/distutils/system_info.py, line
 409,
  in __init__
  self.parse_config_files()
File /projects/tmp/numpy-1.5.1/numpy/distutils/system_info.py, line
 416,
  in parse_config_files
  self.cp.read(self.files)
File /usr/local/lib/python2.7/ConfigParser.py, line 297, in read
  self._read(fp, filename)
File /usr/local/lib/python2.7/ConfigParser.py, line 504, in _read
  raise MissingSectionHeaderError(fpname, lineno, line)
  ConfigParser.MissingSectionHeaderError: File contains no section headers.
  file: /projects/tmp/numpy-1.5.1/site.cfg, line: 60
  'library_dirs = /usr/local/lib\n'
 
 
  ___
  NumPy-Discussion mailing list
  NumPy-Discussion@scipy.org
  http://mail.scipy.org/mailman/listinfo/numpy-discussion
 
 
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Fortran was dead ... [was Re:rewriting NumPy code in C or C++ or similar]

2011-03-17 Thread Yung-Yu Chen
On Wed, Mar 16, 2011 at 17:46, Dag Sverre Seljebotn 
d.s.seljeb...@astro.uio.no wrote:

 On 03/16/2011 10:14 PM, william ratcliff wrote:
  Related to this, what is the status of fwrap?  Can it be used with
  fortran 95/2003 language features?  There is a rather large code
  crystallographic codebase (fullprof) that is written in fortran 77
  that the author has been porting to fortran 95/2003 and actually using
  modules for.  I'd like to write python bindings for it to make it more
  scriptable...

 Fwrap 0.1.1 is out; it supports a subset of Fortran 95/2003, biggest
 limitation being modules not being present.

 Since then there's been quite a few unreleased improvements (like a much
 better and more flexible build based on waf instead of distutils).


Does Fwrap support SCons?  I use SCons everywhere :)

Building binaries with distutil is annoying to me, and that's one of the
reasons for me to stop using f2py.

I am very interested in interfacing binaries with Python.  I also started a
thread for this topic at Convore:
https://convore.com/python-scientific-computing/mixing-languages-with-python/ .
 For those who might not know, as a result of discussion at the recent PyCon
scientific computing BOF, some people started an initiative for an online
scientific community focusing on broader application of Python, not
specifically to any Python package such as NumPy or SciPy.  The Convore
group is an early attempt.  You can find some context in the following
threads:
https://convore.com/python-scientific-computing/my-domainspecialty-of-scientific-computing-doesnt-have-a-community/
 and
https://convore.com/python-scientific-computing/a-scientific-community-using-python/
 .

yyc


 I'm currently working on module support. Or, was ... I've put in a week
 this month, but then some simulation results grabbed my attention and I
 got derailed. Finishing up module support and making an Fwrap 0.2
 release is #2 on my stack of things to work on, and once I get around
 to it I expect it to take about a week. So I think it will happen :-)

 If you (or anyone else) want to get involved and put in a day or two to
 help with polishing (command line interface, writing tests,
 documentation...) just email me.

 Dag Sverre
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion




-- 
Yung-Yu Chen
PhD candidate of Mechanical Engineering
The Ohio State University, Columbus, Ohio
+1 (614) 859 2436
http://solvcon.net/yyc/
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Fortran was dead ... [was Re:rewriting NumPy code in C or C++ or similar]

2011-03-17 Thread Dag Sverre Seljebotn

On 03/17/2011 03:23 PM, Yung-Yu Chen wrote:
On Wed, Mar 16, 2011 at 17:46, Dag Sverre Seljebotn 
d.s.seljeb...@astro.uio.no mailto:d.s.seljeb...@astro.uio.no wrote:


On 03/16/2011 10:14 PM, william ratcliff wrote:
 Related to this, what is the status of fwrap?  Can it be used with
 fortran 95/2003 language features?  There is a rather large code
 crystallographic codebase (fullprof) that is written in fortran 77
 that the author has been porting to fortran 95/2003 and actually
using
 modules for.  I'd like to write python bindings for it to make
it more
 scriptable...

Fwrap 0.1.1 is out; it supports a subset of Fortran 95/2003, biggest
limitation being modules not being present.

Since then there's been quite a few unreleased improvements (like
a much
better and more flexible build based on waf instead of distutils).


Does Fwrap support SCons?  I use SCons everywhere :)


The current focus is on waf only. But support can mean a lot.

Fwrap really simply generate .h, .f90 and .pyx files (the latter being 
Cython sources, which Cython use to generate .c sources). Oh, and 
there's also a small probe script that tries to probe whether a Fortran 
real*8 really is a iso_c_binding c_double, and generates some headers.


So when I say we support waf, what is meant is we ship a default build 
system which makes it convenient to build the results of using Fwrap 
and/or invoke Fwrap on the fly.


So supporting scons is certainly a possibility. Last time I checked the 
Fortran tools in waf were significantly better though (as a result of 
Kurt's Fwrap work, I believe).


Myself I'll be migrating a project from scons to waf any day now. Since 
the numscons effort died/failed it just seems more promising for 
Python packaging (see Bento).


Dag Sverre
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] avoid a line...

2011-03-17 Thread Christopher Barker
On 3/17/11 12:46 AM, eat wrote:
   I am try to read a file of the following format, I want to avoid
 the first line and read the remaining as 'float' .
 Please help me...


 RainWindTempPrSal
 0.11.10.020.2   0.2
 0.50.   0.  0.4   0.8
 0.55.51.50.5   1.5

It's not as robust, but if performance matters, fromfile() should be faster:

f.readline() # to skip the first line

arr = np.fromfile(f, sep=' ', dtype=np.float64).reshape((-1, 5))

(untested)

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] ImportError: libatlas.so: cannot open shared object file: No such file or directory

2011-03-17 Thread Jose Borreguero
Dear Numpy/Scipy users,

I just installed numpy but I have an error when importing
 import numpy

from numpy.linalg import lapack_lite
ImportError: libatlas.so: cannot open shared object file: No such file or
directory

I have ATLAS libraries under /usr/local/atlas/lib
libatlas.a   libcblas.a   libf77blas.a   liblapack.a   libptcblas.a
libptf77blas.a
libatlas.so  libcblas.so  libf77blas.so  liblapack.so  libptcblas.so
libptf77blas.so
Aso the header files in  /usr/local/atlas/include

This was my site.cfg file:
[DEFAULT]
library_dirs = /usr/local/atlas/lib
include_dirs = /usr/local/atlas/include
[blas_opt]
libraries = ptf77blas, ptcblas, atlas
[lapack_opt]
libraries = lapack, ptf77blas, ptcblas, atlas

This is the full Traceback:
 import numpy
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/local/lib/python2.7/site-packages/numpy/__init__.py, line 136,
in module
import add_newdocs
  File /usr/local/lib/python2.7/site-packages/numpy/add_newdocs.py, line
9, in module
from numpy.lib import add_newdoc
  File /usr/local/lib/python2.7/site-packages/numpy/lib/__init__.py, line
13, in module
from polynomial import *
  File /usr/local/lib/python2.7/site-packages/numpy/lib/polynomial.py,
line 17, in module
from numpy.linalg import eigvals, lstsq
  File /usr/local/lib/python2.7/site-packages/numpy/linalg/__init__.py,
line 48, in module
from linalg import *
  File /usr/local/lib/python2.7/site-packages/numpy/linalg/linalg.py, line
23, in module
from numpy.linalg import lapack_lite
ImportError: libatlas.so: cannot open shared object file: No such file or
directory

I don't understand why libatlas.so cannot be found. Please, any comments are
welcomed!

Jose M. Borreguero
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] ImportError: libatlas.so: cannot open shared object file: No such file or directory

2011-03-17 Thread Ilan Schnell
It looks like atlas wasn't linked right.  If you /usr/local/atlas/lib
to your LIBRARY_PATH environment variable it should work.

- Ilan

On Thu, Mar 17, 2011 at 12:23 PM, Jose Borreguero borregu...@gmail.com wrote:
 Dear Numpy/Scipy users,

 I just installed numpy but I have an error when importing
 import numpy
 
     from numpy.linalg import lapack_lite
 ImportError: libatlas.so: cannot open shared object file: No such file or
 directory

 I have ATLAS libraries under /usr/local/atlas/lib
 libatlas.a   libcblas.a   libf77blas.a   liblapack.a   libptcblas.a
 libptf77blas.a
 libatlas.so  libcblas.so  libf77blas.so  liblapack.so  libptcblas.so
 libptf77blas.so
 Aso the header files in  /usr/local/atlas/include

 This was my site.cfg file:
 [DEFAULT]
 library_dirs = /usr/local/atlas/lib
 include_dirs = /usr/local/atlas/include
 [blas_opt]
 libraries = ptf77blas, ptcblas, atlas
 [lapack_opt]
 libraries = lapack, ptf77blas, ptcblas, atlas

 This is the full Traceback:
 import numpy
 Traceback (most recent call last):
   File stdin, line 1, in module
   File /usr/local/lib/python2.7/site-packages/numpy/__init__.py, line 136,
 in module
     import add_newdocs
   File /usr/local/lib/python2.7/site-packages/numpy/add_newdocs.py, line
 9, in module
     from numpy.lib import add_newdoc
   File /usr/local/lib/python2.7/site-packages/numpy/lib/__init__.py, line
 13, in module
     from polynomial import *
   File /usr/local/lib/python2.7/site-packages/numpy/lib/polynomial.py,
 line 17, in module
     from numpy.linalg import eigvals, lstsq
   File /usr/local/lib/python2.7/site-packages/numpy/linalg/__init__.py,
 line 48, in module
     from linalg import *
   File /usr/local/lib/python2.7/site-packages/numpy/linalg/linalg.py, line
 23, in module
     from numpy.linalg import lapack_lite
 ImportError: libatlas.so: cannot open shared object file: No such file or
 directory

 I don't understand why libatlas.so cannot be found. Please, any comments are
 welcomed!

 Jose M. Borreguero


 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] ImportError: libatlas.so: cannot open shared object file: No such file or directory

2011-03-17 Thread Jose Borreguero
Unfortunately it didn't work. I did:
 export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/atlas/lib
 python setup.py build
 python setup.py install

Then in another terminal
 export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/atlas/lib
 python
 import numpy
...
from numpy.linalg import lapack_lite
 ImportError: libatlas.so: cannot open shared object file: No such file
or directory

However, I used a different environment variable:
 export LD_LIBRARY_PATH=/usr/local/atlas/lib
 python
 import numpy
...
from numpy.linalg import lapack_lite
ImportError: libifport.so.5: cannot open shared object file: No such file
or directory

I located libifport.so.5 and added the directory to LD_LIBRARY_PATH:
export
LD_LIBRARY_PATH=/usr/local/atlas/lib:/opt/intel/Compiler/11.1/069/lib/ia32
 python
 import numpy
...
from numpy.linalg import lapack_lite
from numpy.linalg import lapack_lite
ImportError:
/usr/local/lib/python2.7/site-packages/numpy/linalg/lapack_lite.so:
undefined symbol: _gfortran_concat_string

I googled this error, I found some comments on mixing fortran compilers.

I haven't advance much because go from error to error. Maybe I'm mixing
things up by adding directories to LD_LIBRARY_PATH :(

Jose

On Thu, Mar 17, 2011 at 1:35 PM, Ilan Schnell ischn...@enthought.comwrote:

 It looks like atlas wasn't linked right.  If you /usr/local/atlas/lib
 to your LIBRARY_PATH environment variable it should work.

 - Ilan

 On Thu, Mar 17, 2011 at 12:23 PM, Jose Borreguero borregu...@gmail.com
 wrote:
  Dear Numpy/Scipy users,
 
  I just installed numpy but I have an error when importing
  import numpy
  
  from numpy.linalg import lapack_lite
  ImportError: libatlas.so: cannot open shared object file: No such file or
  directory
 
  I have ATLAS libraries under /usr/local/atlas/lib
  libatlas.a   libcblas.a   libf77blas.a   liblapack.a   libptcblas.a
  libptf77blas.a
  libatlas.so  libcblas.so  libf77blas.so  liblapack.so  libptcblas.so
  libptf77blas.so
  Aso the header files in  /usr/local/atlas/include
 
  This was my site.cfg file:
  [DEFAULT]
  library_dirs = /usr/local/atlas/lib
  include_dirs = /usr/local/atlas/include
  [blas_opt]
  libraries = ptf77blas, ptcblas, atlas
  [lapack_opt]
  libraries = lapack, ptf77blas, ptcblas, atlas
 
  This is the full Traceback:
  import numpy
  Traceback (most recent call last):
File stdin, line 1, in module
File /usr/local/lib/python2.7/site-packages/numpy/__init__.py, line
 136,
  in module
  import add_newdocs
File /usr/local/lib/python2.7/site-packages/numpy/add_newdocs.py,
 line
  9, in module
  from numpy.lib import add_newdoc
File /usr/local/lib/python2.7/site-packages/numpy/lib/__init__.py,
 line
  13, in module
  from polynomial import *
File /usr/local/lib/python2.7/site-packages/numpy/lib/polynomial.py,
  line 17, in module
  from numpy.linalg import eigvals, lstsq
File /usr/local/lib/python2.7/site-packages/numpy/linalg/__init__.py,
  line 48, in module
  from linalg import *
File /usr/local/lib/python2.7/site-packages/numpy/linalg/linalg.py,
 line
  23, in module
  from numpy.linalg import lapack_lite
  ImportError: libatlas.so: cannot open shared object file: No such file or
  directory
 
  I don't understand why libatlas.so cannot be found. Please, any comments
 are
  welcomed!
 
  Jose M. Borreguero
 
 
  ___
  NumPy-Discussion mailing list
  NumPy-Discussion@scipy.org
  http://mail.scipy.org/mailman/listinfo/numpy-discussion
 
 
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] hashing dtypes, new variation, old theme

2011-03-17 Thread Robert Kern
On Wed, Mar 16, 2011 at 15:21, Mark Wiebe mwwi...@gmail.com wrote:

 That sounds like a good fix to me. Whenever objects compare equal, they
 should hash to the same value.

There is a limit to how far we can actually satisfy this requirement.
For the implementation of np.dtype.__eq__(), we coerce the other
argument to a dtype object.

[~]
|1 np.dtype(int) == int
True

[~]
|2 np.dtype(int) == 'i4'
True

[~]
|3 hash(int) != hash('i4')
True


As long as we define np.dtype.__eq__() in that way, we cannot satisfy
the requirement. The best we can do is make sure that for all true
dtype objects, if they compare equal then they hash equal. So you
could make a well-behaved dict with true dtypes as keys, but not
dtypes and dtype-coercable objects.

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth.
  -- Umberto Eco
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] hashing dtypes, new variation, old theme

2011-03-17 Thread Mark Wiebe
On Thu, Mar 17, 2011 at 2:35 PM, Robert Kern robert.k...@gmail.com wrote:

 On Wed, Mar 16, 2011 at 15:21, Mark Wiebe mwwi...@gmail.com wrote:

  That sounds like a good fix to me. Whenever objects compare equal, they
  should hash to the same value.

 There is a limit to how far we can actually satisfy this requirement.
 For the implementation of np.dtype.__eq__(), we coerce the other
 argument to a dtype object.

 [~]
 |1 np.dtype(int) == int
 True

 [~]
 |2 np.dtype(int) == 'i4'
 True

 [~]
 |3 hash(int) != hash('i4')
 True


 As long as we define np.dtype.__eq__() in that way, we cannot satisfy
 the requirement. The best we can do is make sure that for all true
 dtype objects, if they compare equal then they hash equal. So you
 could make a well-behaved dict with true dtypes as keys, but not
 dtypes and dtype-coercable objects.


Dtypes being mutable looks like a serious bug to me, it's violating the
definition of 'hashable' given here:
http://docs.python.org/glossary.html#term-hashable. This can be used to make
an impossible situation:

 t = np.dtype('i4,i4')
 d = {t : 3}
 t.names = ('a','b')
 d[t] = 4
 d
{dtype([('a', 'i4'), ('b', 'i4')]): 3, dtype([('a', 'i4'), ('b',
'i4')]): 4}

-Mark
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Nonzero behaving strangely?

2011-03-17 Thread santhu kumar
Hello all,

I am new to Numpy. I used to program before in matlab and am getting used to
Numpy.

I have a array like:
res
array([[ 33.35053669,  49.4615004 ,  44.27631299,   1.,   2.
],
   [ 32.84263059,  50.24752036,  43.92291659,   1.,   0.
],
   [ 33.68999668,  48.90554673,  43.51746687,   1.,   0.
],
   [ 34.11564931,  49.77487763,  44.83843076,   1.,   0.
],
   [ 32.4641859 ,  48.65469145,  45.09300791,   1.,   3.
],
   [ 32.15428526,  49.26922262,  45.92959026,   1.,   0.
],
   [ 31.23860825,  48.21824628,  44.30816331,   1.,   0.
],
   [ 30.71171138,  47.45600573,  44.9282456 ,   1.,   0.
],
   [ 30.53843426,  49.07713258,  44.20899822,   1.,   0.
],
   [ 31.54722284,  47.61953925,  42.95235178,   1.,   0.
],
   [ 32.44334635,  48.10500653,  42.51103537,   1.,   0.
],
   [ 31.77269609,  46.53603145,  43.06468455,   1.,   0.
],
   [ 30.1820843 ,  47.80819604,  41.77667819,   1.,   0.
],
   [ 30.78652668,  46.82907769,  40.38586451,   1.,   0.
],
   [ 30.05963091,  46.84268609,  39.54583693,   1.,   0.
],
   [ 31.75239177,  47.22768463,  40.00717713,   1.,   0.
],
   [ 30.94617127,  45.76986265,  40.68226643,   1.,   0.
],
   [ 33.20069679,  47.42127403,  45.66738249,   1.,   0.
],
   [ 34.39608116,  47.25481126,  45.4438599 ,   1.,   0.
]])

The array is 19X5.
When I do:
nid = (res[:,4]==2).nonzero()
nid tuple turns out to be empty. But the very first row satisfies the
criteria.

nid = (res[:,4]==3).nonzero(), works out and finds the 5th row.

Am i doing something wrong?
I basically want to find the rows whose fifth coloumn(4th in numpy matrix
format) is 2.

Any suggestions?
Thanks
Santhosh
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Nonzero behaving strangely?

2011-03-17 Thread Matthieu Brucher
Hi,

Did you try np.where(res[:,4]==2) ?

Matthieu

2011/3/17 santhu kumar mesan...@gmail.com

 Hello all,

 I am new to Numpy. I used to program before in matlab and am getting used
 to Numpy.

 I have a array like:
 res
 array([[ 33.35053669,  49.4615004 ,  44.27631299,   1.,   2.
 ],
[ 32.84263059,  50.24752036,  43.92291659,   1.,   0.
 ],
[ 33.68999668,  48.90554673,  43.51746687,   1.,   0.
 ],
[ 34.11564931,  49.77487763,  44.83843076,   1.,   0.
 ],
[ 32.4641859 ,  48.65469145,  45.09300791,   1.,   3.
 ],
[ 32.15428526,  49.26922262,  45.92959026,   1.,   0.
 ],
[ 31.23860825,  48.21824628,  44.30816331,   1.,   0.
 ],
[ 30.71171138,  47.45600573,  44.9282456 ,   1.,   0.
 ],
[ 30.53843426,  49.07713258,  44.20899822,   1.,   0.
 ],
[ 31.54722284,  47.61953925,  42.95235178,   1.,   0.
 ],
[ 32.44334635,  48.10500653,  42.51103537,   1.,   0.
 ],
[ 31.77269609,  46.53603145,  43.06468455,   1.,   0.
 ],
[ 30.1820843 ,  47.80819604,  41.77667819,   1.,   0.
 ],
[ 30.78652668,  46.82907769,  40.38586451,   1.,   0.
 ],
[ 30.05963091,  46.84268609,  39.54583693,   1.,   0.
 ],
[ 31.75239177,  47.22768463,  40.00717713,   1.,   0.
 ],
[ 30.94617127,  45.76986265,  40.68226643,   1.,   0.
 ],
[ 33.20069679,  47.42127403,  45.66738249,   1.,   0.
 ],
[ 34.39608116,  47.25481126,  45.4438599 ,   1.,   0.
 ]])

 The array is 19X5.
 When I do:
 nid = (res[:,4]==2).nonzero()
 nid tuple turns out to be empty. But the very first row satisfies the
 criteria.

 nid = (res[:,4]==3).nonzero(), works out and finds the 5th row.

 Am i doing something wrong?
 I basically want to find the rows whose fifth coloumn(4th in numpy matrix
 format) is 2.

 Any suggestions?
 Thanks
 Santhosh

 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion




-- 
Information System Engineer, Ph.D.
Blog: http://matt.eifelle.com
LinkedIn: http://www.linkedin.com/in/matthieubrucher
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] hashing dtypes, new variation, old theme

2011-03-17 Thread Christopher Barker
On 3/17/11 2:57 PM, Mark Wiebe wrote:

 Dtypes being mutable looks like a serious bug to me, it's violating the
 definition of 'hashable' given here:

I can imagine other problems is would cause, as well -- is there any 
reason that dtypes should be mutable?

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Nonzero behaving strangely?

2011-03-17 Thread Warren Weckesser
On Thu, Mar 17, 2011 at 5:17 PM, santhu kumar mesan...@gmail.com wrote:

 Hello all,

 I am new to Numpy. I used to program before in matlab and am getting used
 to Numpy.

 I have a array like:
 res
 array([[ 33.35053669,  49.4615004 ,  44.27631299,   1.,   2.
 ],
[ 32.84263059,  50.24752036,  43.92291659,   1.,   0.
 ],
[ 33.68999668,  48.90554673,  43.51746687,   1.,   0.
 ],
[ 34.11564931,  49.77487763,  44.83843076,   1.,   0.
 ],
[ 32.4641859 ,  48.65469145,  45.09300791,   1.,   3.
 ],
[ 32.15428526,  49.26922262,  45.92959026,   1.,   0.
 ],
[ 31.23860825,  48.21824628,  44.30816331,   1.,   0.
 ],
[ 30.71171138,  47.45600573,  44.9282456 ,   1.,   0.
 ],
[ 30.53843426,  49.07713258,  44.20899822,   1.,   0.
 ],
[ 31.54722284,  47.61953925,  42.95235178,   1.,   0.
 ],
[ 32.44334635,  48.10500653,  42.51103537,   1.,   0.
 ],
[ 31.77269609,  46.53603145,  43.06468455,   1.,   0.
 ],
[ 30.1820843 ,  47.80819604,  41.77667819,   1.,   0.
 ],
[ 30.78652668,  46.82907769,  40.38586451,   1.,   0.
 ],
[ 30.05963091,  46.84268609,  39.54583693,   1.,   0.
 ],
[ 31.75239177,  47.22768463,  40.00717713,   1.,   0.
 ],
[ 30.94617127,  45.76986265,  40.68226643,   1.,   0.
 ],
[ 33.20069679,  47.42127403,  45.66738249,   1.,   0.
 ],
[ 34.39608116,  47.25481126,  45.4438599 ,   1.,   0.
 ]])

 The array is 19X5.
 When I do:
 nid = (res[:,4]==2).nonzero()
 nid tuple turns out to be empty. But the very first row satisfies the
 criteria.

 nid = (res[:,4]==3).nonzero(), works out and finds the 5th row.

 Am i doing something wrong?
 I basically want to find the rows whose fifth coloumn(4th in numpy matrix
 format) is 2.



Are you sure the value of res[0,4] is *exactly* 2.0, and not something like,
say, 2.0009?

Warren


 Any suggestions?
 Thanks
 Santhosh

 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] hashing dtypes, new variation, old theme

2011-03-17 Thread Pauli Virtanen
Thu, 17 Mar 2011 15:23:19 -0700, Christopher Barker wrote:
 On 3/17/11 2:57 PM, Mark Wiebe wrote:
 Dtypes being mutable looks like a serious bug to me, it's violating the
 definition of 'hashable' given here:
 
 I can imagine other problems is would cause, as well -- is there any
 reason that dtypes should be mutable?

Changing field names via the `names` attribute. AFAIK, the other 
attributes in dtypes are not mutable, and mutability was added long ago 
as a workaround for `.view()` not handling name changes properly.

There's possibly some code out there that touches the `names` attribute, 
so it's not clear if this can be fixed in the 1.x series.

-- 
Pauli Virtanen

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Nonzero behaving strangely?

2011-03-17 Thread Christopher Barker
On 3/17/11 3:17 PM, santhu kumar wrote:

 nid = (res[:,4]==2).nonzero()
 nid tuple turns out to be empty. But the very first row satisfies the
 criteria.

it works for me:

In [45]: arr
Out[45]:
array([[ 33.35053669,  49.4615004 ,  44.27631299,   1.,   2. 
 ],
[ 32.84263059,  50.24752036,  43.92291659,   1.,   0. 
  ],
[ 33.68999668,  48.90554673,  43.51746687,   1.,   0. 
  ],
[ 34.11564931,  49.77487763,  44.83843076,   1.,   0. 
  ],
[ 32.4641859 ,  48.65469145,  45.09300791,   1.,   3. 
  ],
[ 32.15428526,  49.26922262,  45.92959026,   1.,   0. 
  ],
[ 31.23860825,  48.21824628,  44.30816331,   1.,   0. 
  ],
[ 30.71171138,  47.45600573,  44.9282456 ,   1.,   0. 
  ],
[ 30.53843426,  49.07713258,  44.20899822,   1.,   0. 
  ],
[ 31.54722284,  47.61953925,  42.95235178,   1.,   0. 
  ],
[ 32.44334635,  48.10500653,  42.51103537,   1.,   0. 
  ],
[ 31.77269609,  46.53603145,  43.06468455,   1.,   0. 
  ],
[ 30.1820843 ,  47.80819604,  41.77667819,   1.,   0. 
  ],
[ 30.78652668,  46.82907769,  40.38586451,   1.,   0. 
  ],
[ 30.05963091,  46.84268609,  39.54583693,   1.,   0. 
  ],
[ 31.75239177,  47.22768463,  40.00717713,   1.,   0. 
  ],
[ 30.94617127,  45.76986265,  40.68226643,   1.,   0. 
  ],
[ 33.20069679,  47.42127403,  45.66738249,   1.,   0. 
  ],
[ 34.39608116,  47.25481126,  45.4438599 ,   1.,   0. 
  ]])

In [46]: arr.shape
Out[46]: (19, 5)

In [47]: nid = (arr[:,4]==2).nonzero()

In [48]: nid
Out[48]: (array([0]),)

Maybe you are having a floating point comparison problem -- i.e.e that 
2.0 is really 1.99 or something.

Checking equality with floating point numbers is fraught with problems.

Also, y9ou amy not need teh nonzero:

In [56]: arr[:,4]==2
Out[56]:
array([ True, False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False, False, 
False], dtype=bool)

that's a boolean array that can be used for indexing, operating with 
where, etc.

HTH,

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] hashing dtypes, new variation, old theme

2011-03-17 Thread Mark Wiebe
On Thu, Mar 17, 2011 at 3:30 PM, Pauli Virtanen p...@iki.fi wrote:

 Thu, 17 Mar 2011 15:23:19 -0700, Christopher Barker wrote:
  On 3/17/11 2:57 PM, Mark Wiebe wrote:
  Dtypes being mutable looks like a serious bug to me, it's violating the
  definition of 'hashable' given here:
 
  I can imagine other problems is would cause, as well -- is there any
  reason that dtypes should be mutable?

 Changing field names via the `names` attribute. AFAIK, the other
 attributes in dtypes are not mutable, and mutability was added long ago
 as a workaround for `.view()` not handling name changes properly.

 There's possibly some code out there that touches the `names` attribute,
 so it's not clear if this can be fixed in the 1.x series.


Fixing ticket #1619 looks like it needs changes to dtype construction and
__repr__, probably all these things should be fixed together at once. I
agree they likely have too many ripple effects to change for 1.6.

-Mark
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Nonzero behaving strangely?

2011-03-17 Thread santhu kumar
Thanks a lot for the replies.
I have misunderstood the output. When it says (array[0]), i thought it did
not find anything as opposed to the zeroth row. (Still getting used to
matlab indexing i guess !! ) .. Sorry !!

Thanks a lot for the sugestions though, Would keep it in mind ..

From: santhu kumar mesan...@gmail.com
 Subject: [Numpy-discussion] Nonzero behaving strangely?
 To: numpy-discussion@scipy.org
 Message-ID:
aanlktinnfb6cbrudb3guaqsmcoq0dkywqy77j9hmm...@mail.gmail.com
 Content-Type: text/plain; charset=iso-8859-1

 Hello all,

 I am new to Numpy. I used to program before in matlab and am getting used
 to
 Numpy.

 I have a array like:
 res
 array([[ 33.35053669,  49.4615004 ,  44.27631299,   1.,   2.
 ],
   [ 32.84263059,  50.24752036,  43.92291659,   1.,   0.
 ],
   [ 33.68999668,  48.90554673,  43.51746687,   1.,   0.
 ],
   [ 34.11564931,  49.77487763,  44.83843076,   1.,   0.
 ],
   [ 32.4641859 ,  48.65469145,  45.09300791,   1.,   3.
 ],
   [ 32.15428526,  49.26922262,  45.92959026,   1.,   0.
 ],
   [ 31.23860825,  48.21824628,  44.30816331,   1.,   0.
 ],
   [ 30.71171138,  47.45600573,  44.9282456 ,   1.,   0.
 ],
   [ 30.53843426,  49.07713258,  44.20899822,   1.,   0.
 ],
   [ 31.54722284,  47.61953925,  42.95235178,   1.,   0.
 ],
   [ 32.44334635,  48.10500653,  42.51103537,   1.,   0.
 ],
   [ 31.77269609,  46.53603145,  43.06468455,   1.,   0.
 ],
   [ 30.1820843 ,  47.80819604,  41.77667819,   1.,   0.
 ],
   [ 30.78652668,  46.82907769,  40.38586451,   1.,   0.
 ],
   [ 30.05963091,  46.84268609,  39.54583693,   1.,   0.
 ],
   [ 31.75239177,  47.22768463,  40.00717713,   1.,   0.
 ],
   [ 30.94617127,  45.76986265,  40.68226643,   1.,   0.
 ],
   [ 33.20069679,  47.42127403,  45.66738249,   1.,   0.
 ],
   [ 34.39608116,  47.25481126,  45.4438599 ,   1.,   0.
 ]])

 The array is 19X5.
 When I do:
 nid = (res[:,4]==2).nonzero()
 nid tuple turns out to be empty. But the very first row satisfies the
 criteria.

 nid = (res[:,4]==3).nonzero(), works out and finds the 5th row.

 Am i doing something wrong?
 I basically want to find the rows whose fifth coloumn(4th in numpy matrix
 format) is 2.

 Any suggestions?
 Thanks
 Santhosh
 -- next part --
 An HTML attachment was scrubbed...
 URL:
 http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110317/2f46f2c1/attachment-0001.html

 --

 Message: 2
 Date: Thu, 17 Mar 2011 23:19:42 +0100
 From: Matthieu Brucher matthieu.bruc...@gmail.com
 Subject: Re: [Numpy-discussion] Nonzero behaving strangely?
 To: Discussion of Numerical Python numpy-discussion@scipy.org
 Message-ID:
aanlktimeipz6cpamauy2f_0mpjwkwjdwe0oc4wm-l...@mail.gmail.com
 Content-Type: text/plain; charset=iso-8859-1

 Hi,

 Did you try np.where(res[:,4]==2) ?

 Matthieu

 2011/3/17 santhu kumar mesan...@gmail.com

  Hello all,
 
  I am new to Numpy. I used to program before in matlab and am getting used
  to Numpy.
 
  I have a array like:
  res
  array([[ 33.35053669,  49.4615004 ,  44.27631299,   1.,   2.
  ],
 [ 32.84263059,  50.24752036,  43.92291659,   1.,   0.
  ],
 [ 33.68999668,  48.90554673,  43.51746687,   1.,   0.
  ],
 [ 34.11564931,  49.77487763,  44.83843076,   1.,   0.
  ],
 [ 32.4641859 ,  48.65469145,  45.09300791,   1.,   3.
  ],
 [ 32.15428526,  49.26922262,  45.92959026,   1.,   0.
  ],
 [ 31.23860825,  48.21824628,  44.30816331,   1.,   0.
  ],
 [ 30.71171138,  47.45600573,  44.9282456 ,   1.,   0.
  ],
 [ 30.53843426,  49.07713258,  44.20899822,   1.,   0.
  ],
 [ 31.54722284,  47.61953925,  42.95235178,   1.,   0.
  ],
 [ 32.44334635,  48.10500653,  42.51103537,   1.,   0.
  ],
 [ 31.77269609,  46.53603145,  43.06468455,   1.,   0.
  ],
 [ 30.1820843 ,  47.80819604,  41.77667819,   1.,   0.
  ],
 [ 30.78652668,  46.82907769,  40.38586451,   1.,   0.
  ],
 [ 30.05963091,  46.84268609,  39.54583693,   1.,   0.
  ],
 [ 31.75239177,  47.22768463,  40.00717713,   1.,   0.
  ],
 [ 30.94617127,  45.76986265,  40.68226643,   1.,   0.
  ],
 [ 33.20069679,  47.42127403,  45.66738249,   1.,   0.
  ],
 [ 34.39608116,  47.25481126,  45.4438599 ,   1.,   0.
  ]])
 
  The array is 19X5.
  When I do:
  nid = (res[:,4]==2).nonzero()
  nid tuple turns out to be empty. But the very first row satisfies the
  criteria.
 
  nid = (res[:,4]==3).nonzero(), works out and finds the 5th row.
 
  Am i doing something wrong?
  I basically want to find the rows whose fifth coloumn(4th in numpy

Re: [Numpy-discussion] Norm of array of vectors

2011-03-17 Thread Andrey N. Sobolev
Hi eat and Gary,

Thanks a lot for your suggestions, I've tried them in my code and
achieved similar speedup of ~270% for both of them. So I guess I'll
stick to one of those. 

Regards,
Andrey. 


 Hi,
 
 On Thu, Mar 17, 2011 at 10:44 AM, Andrey N. Sobolev inco...@list.ru
 wrote:
 
  Dear all,
 
  Sorry if that's a noob question, but anyway. I have several
  thousands of vectors stacked in 2d array. I'd like to get new array
  containing Euclidean norms of these vectors and get the vector with
  minimal norm.
 
  Is there more efficient way to do this than
  argmin(array([sqrt(dot(x,x)) for x in vec_array]))?
 
 Try
 argmin(sum(vec_array** 2, 0)** 0.5)
 
 Regards,
 eat
 
 
  Thanks in advance.
  Andrey.
 
  ___
  NumPy-Discussion mailing list
  NumPy-Discussion@scipy.org
  http://mail.scipy.org/mailman/listinfo/numpy-discussion
 
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] split() for slices?

2011-03-17 Thread Benjamin Root
Hello,

I really like the split() family of functions, but I have the need to split
multiple arrays in a similar manner, and it would seem logical to me to have
a split() function that would return a list of slice tuples that I could use
on multiple arrays.  Is there such a function?

Thanks,
Ben Root
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion