Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
PEP8 and docstring fixes for transpose etc
  • Loading branch information
inducer committed Jul 11, 2015
1 parent 0dfc4a7 commit 09e61e6
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions pycuda/gpuarray.py
Expand Up @@ -23,7 +23,7 @@ def _get_common_dtype(obj1, obj2):

# {{{ vector types

class vec:
class vec: # noqa
pass


Expand Down Expand Up @@ -770,16 +770,11 @@ def view(self, dtype=None):
def transpose(self, axes=None):
"""Permute the dimensions of an array.
Parameters
----------
axes : list of ints, optional
:arg axes: list of ints, optional.
By default, reverse the dimensions, otherwise permute the axes
according to the values given.
Returns
-------
p : GPUArray
A view of the array with its axes permuted.
:returns: :class:`GPUArray` A view of the array with its axes permuted.
"""

if axes is None:
Expand All @@ -794,8 +789,10 @@ def transpose(self, axes=None):
base=self.base or self,
gpudata=self.gpudata,
strides=tuple(new_strides))

@property
def T(self): return self.transpose()
def T(self): # noqa
return self.transpose()

# {{{ slicing

Expand Down Expand Up @@ -1277,32 +1274,30 @@ def make_func_for_chunk_size(chunk_size):

# }}}


# {{{ shape manipulation

def transpose(a, axes=None):
"""Permute the dimensions of an array.
Parameters
----------
a : GPUArray
axes : list of ints, optional
:arg a: :class:`GPUArray`
:arg axes: list of ints, optional.
By default, reverse the dimensions, otherwise permute the axes
according to the values given.
Returns
-------
p : GPUArray
A view of the array with its axes permuted.
:returns: :class:`GPUArray` A view of the array with its axes permuted.
"""
return a.transpose(axes)


def reshape(a, shape):
"""Gives a new shape to an array without changing its data."""

return a.reshape(shape)

# }}}


# {{{ conditionals

def if_positive(criterion, then_, else_, out=None, stream=None):
Expand Down

0 comments on commit 09e61e6

Please sign in to comment.