Skip to content
Snippets Groups Projects
Commit a248e67a authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Add allocator kwarg to arange().

parent ff69a0be
No related branches found
No related tags found
No related merge requests found
......@@ -171,7 +171,7 @@ Constructing :class:`Array` Instances
Make a new, zero-initialized :class:`Array` having the same properties
as *other_ary*.
.. function:: arange(queue, start, stop, step, dtype=None)
.. function:: arange(queue, start, stop, step, dtype=None, allocator=None)
Create a :class:`Array` filled with numbers spaced `step` apart,
starting from `start` and ending at `stop`.
......@@ -186,6 +186,9 @@ Constructing :class:`Array` Instances
.. versionchanged:: 2011.1
*context* argument was deprecated.
.. versionchanged:: 2011.2
*allocator* keyword argument was added.
.. function:: take(a, indices, out=None, queue=None)
Return the :class:`Array` ``[a[indices[0]], ..., a[indices[n]]]``.
......
......@@ -733,6 +733,7 @@ def _arange(queue, *args, **kwargs):
inf.stop = None
inf.step = None
inf.dtype = None
inf.allocator = None
if isinstance(args[-1], np.dtype):
dtype = args[-1]
......@@ -754,7 +755,7 @@ def _arange(queue, *args, **kwargs):
else:
raise ValueError, "too many arguments"
admissible_names = ["start", "stop", "step", "dtype"]
admissible_names = ["start", "stop", "step", "dtype", "allocator"]
for k, v in kwargs.iteritems():
if k in admissible_names:
if getattr(inf, k) is None:
......@@ -785,7 +786,7 @@ def _arange(queue, *args, **kwargs):
from math import ceil
size = int(ceil((stop-start)/step))
result = Array(queue, (size,), dtype)
result = Array(queue, (size,), dtype, allocator=inf.allocator)
_arange_knl(result, start, step, queue=queue)
return result
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment