~ubuntu-branches/ubuntu/oneiric/python-scipy/oneiric-proposed

« back to all changes in this revision

Viewing changes to Lib/sandbox/numexpr/info.py

  • Committer: Bazaar Package Importer
  • Author(s): Ondrej Certik
  • Date: 2008-06-16 22:58:01 UTC
  • mfrom: (2.1.24 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080616225801-irdhrpcwiocfbcmt
Tags: 0.6.0-12
* The description updated to match the current SciPy (Closes: #489149).
* Standards-Version bumped to 3.8.0 (no action needed)
* Build-Depends: netcdf-dev changed to libnetcdf-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
"""Fast numerical expression evaluator
2
 
 
3
 
Usage:
4
 
 
5
 
Build an expression up by using E.<variable> for the variables:
6
 
 
7
 
>>> ex = 2.0 * E.a + 3 * E.b * E.c
8
 
 
9
 
then compile it to a function:
10
 
 
11
 
>>> func = numexpr(ex, input_names=('a', 'b', 'c'))
12
 
 
13
 
(if input_names is not given to compile, the variables are sort lexically.)
14
 
 
15
 
Then, you can use that function for elementwise operations:
16
 
 
17
 
>>> func(array([1., 2, 3]), array([4., 5, 6]), array([7., 8, 9]))
18
 
array([  86.,  124.,  168.])
19
 
 
20
 
Currently, this is only implemented for arrays of float64, and only
21
 
for the simple operations +, -, *, and /.
22
 
 
23
 
Copyright 2006 David M. Cooke <cookedm@physics.mcmaster.ca>
24
 
Licenced under a BSD-style license. See LICENSE.txt in the scipy source
25
 
directory.
26
 
"""
27
 
 
28
 
depends = ['core', 'testing']