15
15
def take(a, indicies, axis=0):
16
return N.take(a, indicies, axis)
16
return np.take(a, indicies, axis)
18
18
def repeat(a, repeats, axis=0):
19
return N.repeat(a, repeats, axis)
19
return np.repeat(a, repeats, axis)
21
21
def sum(x, axis=0):
22
return np.sum(x, axis)
24
24
def product(x, axis=0):
25
return N.product(x, axis)
25
return np.product(x, axis)
27
27
def sometrue(x, axis=0):
28
return N.sometrue(x, axis)
28
return np.sometrue(x, axis)
30
30
def alltrue(x, axis=0):
31
return N.alltrue(x, axis)
31
return np.alltrue(x, axis)
33
33
def cumsum(x, axis=0):
34
return N.cumsum(x, axis)
34
return np.cumsum(x, axis)
36
36
def cumproduct(x, axis=0):
37
return N.cumproduct(x, axis)
37
return np.cumproduct(x, axis)
39
39
def argmax(x, axis=-1):
40
return N.argmax(x, axis)
40
return np.argmax(x, axis)
42
42
def argmin(x, axis=-1):
43
return N.argmin(x, axis)
43
return np.argmin(x, axis)
45
45
def compress(condition, m, axis=-1):
46
return N.compress(condition, m, axis)
46
return np.compress(condition, m, axis)
48
48
def fromfunction(args, dimensions):
49
return N.fromfunction(args, dimensions, dtype=int)
49
return np.fromfunction(args, dimensions, dtype=int)
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
64
dtype = convtypecode(typecode,dtype)
64
dtype = convtypecode(typecode,dtype)
65
65
return mu.zeros(shape, dtype)
67
67
def identity(n,typecode='l', dtype=None):
71
71
return nn.identity(n, dtype)
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)
77
77
def array(sequence, typecode=None, copy=1, savespace=0, dtype=None):
87
87
return mu.array(a, dtype, copy=0)
94
94
raise ValueError, "Input argument must be 1d"
96
96
def reshape(a, shape):
97
return N.reshape(a, shape)
97
return np.reshape(a, shape)
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)
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)
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)
117
117
def where(condition, x, y):
118
return N.where(condition, x, y)
118
return np.where(condition, x, y)
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)
123
123
def average(a, axis=0, weights=None, returned=False):
124
return N.average(a, axis, weights, returned)
124
return np.average(a, axis, weights, returned)