Skip to content

Commit

Permalink
MAINT: pep8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
adler-j committed Dec 14, 2015
1 parent 9d1c236 commit b735cd5
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 19 deletions.
4 changes: 2 additions & 2 deletions odl/discr/lp_discr.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,12 @@ def ufunc(self):
uniform_discr(0.0, 1.0, 2).element([4.0, 1.0])
and non-space elements
>>> x.ufunc.subtract([3, 3])
uniform_discr(0.0, 1.0, 2).element([-2.0, -5.0])
There is also support for various reductions (sum, prod, min, max)
>>> x.ufunc.sum()
-1.0
Expand Down
20 changes: 8 additions & 12 deletions odl/set/pspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,31 +510,27 @@ def ufunc(self):
These functions can also be used with non-vector arguments and support
broadcasting, both by element
>>> x = r22.element([[1, 2], [3, 4]])
>>> x.ufunc.add([1, 1])
ProductSpace(Rn(2), 2).element([
[2.0, 3.0],
[4.0, 5.0]
[2.0, -1.0],
[-2.0, 5.0]
])
and also recursively
>>> x = r22.element([[1, 2], [3, 4]])
>>> x.ufunc.add(1)
>>> x.ufunc.subtract(1)
ProductSpace(Rn(2), 2).element([
[2.0, 3.0],
[4.0, 5.0]
[0.0, -3.0],
[-4.0, 3.0]
])
There is also support for various reductions (sum, prod, min, max)
>>> x = r22.element([[1, 2], [3, 4]])
>>> x.ufunc.sum()
10.0
0.0
Also supports out parameter
>>> x = r22.element([[1, -2], [-3, 4]])
>>> y = r22.element()
>>> result = x.ufunc.absolute(out=y)
>>> result
Expand Down
2 changes: 1 addition & 1 deletion odl/space/cu_ntuples.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def ufunc(self):
CudaRn(2).element([-2.0, -5.0])
There is also support for various reductions (sum, prod, min, max)
>>> x.ufunc.sum()
-1.0
Expand Down
4 changes: 2 additions & 2 deletions odl/space/ntuples.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,12 @@ def ufunc(self):
Rn(2).element([4.0, 1.0])
and non-space elements
>>> x.ufunc.subtract([3, 3])
Rn(2).element([-2.0, -5.0])
There is also support for various reductions (sum, prod, min, max)
>>> x.ufunc.sum()
-1.0
Expand Down
2 changes: 1 addition & 1 deletion odl/util/ufuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,4 +524,4 @@ def __init__(self, vector):
# Add reduction methods to UFunc class
for name, descr in REDUCTIONS:
method = wrap_reduction_productspace(name, descr)
setattr(ProductSpaceUFuncs, name, method)
setattr(ProductSpaceUFuncs, name, method)
2 changes: 1 addition & 1 deletion test/set/pspace_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ def test_ufuncs():
assert w is z
assert all_almost_equal(z, [[5], [7, 9]])


def test_reductions():
H = odl.ProductSpace(odl.Rn(1), odl.Rn(2))
x = H.element([[1], [2, 3]])
Expand Down

0 comments on commit b735cd5

Please sign in to comment.