Skip to content

Commit

Permalink
Minor fixes to Tom's patch
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Mar 13, 2014
1 parent ccee7f4 commit c09a372
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions doc/array.rst
Expand Up @@ -32,13 +32,13 @@ Vector Types
If you want to construct a pre-initialized vector type you have three new
functions to choose from:
* `zeros_type()`
* `ones_type()`
* `filled_type(fill_value)`
* `zeros_type()`
* `ones_type()`
* `filled_type(fill_value)`
.. versionadded:: 2013.3
.. versionadded:: 2014.1
.. versionchanged:: 2013.3
.. versionchanged:: 2014.1
The `make_type` functions have a default value (0) for each component.
Relying on the default values has been deprecated. Either specify all
components or use one of th new flavors mentioned above for constructing
Expand Down
8 changes: 4 additions & 4 deletions pyopencl/array.py
Expand Up @@ -28,7 +28,6 @@
"""


import warnings
import numpy as np
import pyopencl.elementwise as elementwise
import pyopencl as cl
Expand Down Expand Up @@ -102,8 +101,9 @@ def _create_vector_types():

def create_array(dtype, count, padded_count, *args, **kwargs):
if len(args) < count:
warnings.warn("default values for make_xxx are deprecated;"+
" instead specify all parameters or use"+
from warnings import warn
warn("default values for make_xxx are deprecated;"
" instead specify all parameters or use"
" array.vec.zeros_xxx", DeprecationWarning)
padded_args = tuple(list(args)+[0]*(padded_count-len(args)))
array = eval("array(padded_args, dtype=dtype)",
Expand All @@ -114,7 +114,7 @@ def create_array(dtype, count, padded_count, *args, **kwargs):
return array

setattr(vec, "make_"+name, staticmethod(eval(
"lambda *args, **kwargs: create_array(dtype, %i, %i, "+
"lambda *args, **kwargs: create_array(dtype, %i, %i, "
"*args, **kwargs)" % (count, padded_count),
dict(create_array=create_array, dtype=dtype))))
setattr(vec, "filled_"+name, staticmethod(eval(
Expand Down

0 comments on commit c09a372

Please sign in to comment.