~jtaylor/ubuntu/precise/python-numpy/multiarch-fix-818867

« back to all changes in this revision

Viewing changes to numpy/oldnumeric/functions.py

  • Committer: Bazaar Package Importer
  • Author(s): Ondrej Certik, Riku Voipio, Tiziano Zito, Carlos Galisteo, Ondrej Certik
  • Date: 2008-07-08 15:08:16 UTC
  • mfrom: (0.1.21 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080708150816-ekf992jcp2k1eua3
Tags: 1:1.1.0-3
[ Riku Voipio ]
* debian/control: atlas is not available on armel, and after a quick look
  neither on alpha. I'd also suggest dropping
  libatlas-sse-dev|libatlas-sse2-dev|libatlas-3dnow-dev alternative combo
  away, these are potentially dangerous on buildd's. Ondrej: dropped.
  (Closes: #489568)

[ Tiziano Zito ]
* patch: build _dotblas.c when ATLAS is not installed, build-conflict with
  atlas, build-depend on blas+lapack only, as it used to be (Closes: #489726)

[ Carlos Galisteo ]
* debian/control
  - Added Homepage field.

[ Ondrej Certik ]
* Checked the package on i386 and amd64, both with and without atlas, all
  tests run and the numpy package is faster if atlas is around. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Functions that should behave the same as Numeric and need changing
2
2
 
3
 
import numpy as N
 
3
import numpy as np
4
4
import numpy.core.multiarray as mu
5
5
import numpy.core.numeric as nn
6
6
from typeconv import convtypecode, convtypecode2
13
13
           'average']
14
14
 
15
15
def take(a, indicies, axis=0):
16
 
    return N.take(a, indicies, axis)
 
16
    return np.take(a, indicies, axis)
17
17
 
18
18
def repeat(a, repeats, axis=0):
19
 
    return N.repeat(a, repeats, axis)
 
19
    return np.repeat(a, repeats, axis)
20
20
 
21
21
def sum(x, axis=0):
22
 
    return N.sum(x, axis)
 
22
    return np.sum(x, axis)
23
23
 
24
24
def product(x, axis=0):
25
 
    return N.product(x, axis)
 
25
    return np.product(x, axis)
26
26
 
27
27
def sometrue(x, axis=0):
28
 
    return N.sometrue(x, axis)
 
28
    return np.sometrue(x, axis)
29
29
 
30
30
def alltrue(x, axis=0):
31
 
    return N.alltrue(x, axis)
 
31
    return np.alltrue(x, axis)
32
32
 
33
33
def cumsum(x, axis=0):
34
 
    return N.cumsum(x, axis)
 
34
    return np.cumsum(x, axis)
35
35
 
36
36
def cumproduct(x, axis=0):
37
 
    return N.cumproduct(x, axis)
 
37
    return np.cumproduct(x, axis)
38
38
 
39
39
def argmax(x, axis=-1):
40
 
    return N.argmax(x, axis)
 
40
    return np.argmax(x, axis)
41
41
 
42
42
def argmin(x, axis=-1):
43
 
    return N.argmin(x, axis)
 
43
    return np.argmin(x, axis)
44
44
 
45
45
def compress(condition, m, axis=-1):
46
 
    return N.compress(condition, m, axis)
47
 
   
 
46
    return np.compress(condition, m, axis)
 
47
 
48
48
def fromfunction(args, dimensions):
49
 
    return N.fromfunction(args, dimensions, dtype=int)
50
 
 
 
49
    return np.fromfunction(args, dimensions, dtype=int)
 
50
 
51
51
def ones(shape, typecode='l', savespace=0, dtype=None):
52
52
    """ones(shape, dtype=int) returns an array of the given
53
53
    dimensions which is initialized to all ones.
61
61
    """zeros(shape, dtype=int) returns an array of the given
62
62
    dimensions which is initialized to all zeros
63
63
    """
64
 
    dtype = convtypecode(typecode,dtype)            
 
64
    dtype = convtypecode(typecode,dtype)
65
65
    return mu.zeros(shape, dtype)
66
66
 
67
67
def identity(n,typecode='l', dtype=None):
71
71
    return nn.identity(n, dtype)
72
72
 
73
73
def empty(shape, typecode='l', dtype=None):
74
 
    dtype = convtypecode(typecode, dtype)    
 
74
    dtype = convtypecode(typecode, dtype)
75
75
    return mu.empty(shape, dtype)
76
76
 
77
77
def array(sequence, typecode=None, copy=1, savespace=0, dtype=None):
87
87
    return mu.array(a, dtype, copy=0)
88
88
 
89
89
def nonzero(a):
90
 
    res = N.nonzero(a)
 
90
    res = np.nonzero(a)
91
91
    if len(res) == 1:
92
92
        return res[0]
93
93
    else:
94
94
        raise ValueError, "Input argument must be 1d"
95
95
 
96
96
def reshape(a, shape):
97
 
    return N.reshape(a, shape)
 
97
    return np.reshape(a, shape)
98
98
 
99
99
def arange(start, stop=None, step=1, typecode=None, dtype=None):
100
100
    dtype = convtypecode2(typecode, dtype)
105
105
    return mu.fromstring(string, dtype, count=count)
106
106
 
107
107
def ravel(m):
108
 
    return N.ravel(m)
 
108
    return np.ravel(m)
109
109
 
110
110
def trace(a, offset=0, axis1=0, axis2=1):
111
 
    return N.trace(a, offset=0, axis1=0, axis2=1)
 
111
    return np.trace(a, offset=0, axis1=0, axis2=1)
112
112
 
113
113
def indices(dimensions, typecode=None, dtype=None):
114
114
    dtype = convtypecode(typecode, dtype)
115
 
    return N.indices(dimensions, dtype)
 
115
    return np.indices(dimensions, dtype)
116
116
 
117
117
def where(condition, x, y):
118
 
    return N.where(condition, x, y)
 
118
    return np.where(condition, x, y)
119
119
 
120
120
def cross_product(a, b, axis1=-1, axis2=-1):
121
 
    return N.cross(a, b, axis1, axis2)
 
121
    return np.cross(a, b, axis1, axis2)
122
122
 
123
123
def average(a, axis=0, weights=None, returned=False):
124
 
    return N.average(a, axis, weights, returned)
125
 
 
 
124
    return np.average(a, axis, weights, returned)