Skip to content

Commit

Permalink
MAINT: Bug fixes for product space
Browse files Browse the repository at this point in the history
  • Loading branch information
adler-j committed Aug 1, 2017
1 parent f4028b8 commit b563410
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
20 changes: 8 additions & 12 deletions odl/test/operator/tensor_ops_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,11 @@ def test_pointwise_inner_adjoint():

testfunc = fspace.element(testarr)
testfunc_pwinner_adj = pwinner.adjoint(testfunc)
assert all_almost_equal(testfunc_pwinner_adj,
true_inner_adj.reshape([1, -1]))
assert all_almost_equal(testfunc_pwinner_adj, true_inner_adj)

out = vfspace.element()
pwinner.adjoint(testfunc, out=out)
assert all_almost_equal(out, true_inner_adj.reshape([1, -1]))
assert all_almost_equal(out, true_inner_adj)

# 3d
fspace = odl.uniform_discr([0, 0], [1, 1], (2, 2), dtype=complex)
Expand All @@ -380,12 +379,11 @@ def test_pointwise_inner_adjoint():

testfunc = fspace.element(testarr)
testfunc_pwinner_adj = pwinner.adjoint(testfunc)
assert all_almost_equal(testfunc_pwinner_adj,
true_inner_adj.reshape([3, -1]))
assert all_almost_equal(testfunc_pwinner_adj, true_inner_adj)

out = vfspace.element()
pwinner.adjoint(testfunc, out=out)
assert all_almost_equal(out, true_inner_adj.reshape([3, -1]))
assert all_almost_equal(out, true_inner_adj)


def test_pointwise_inner_adjoint_weighted():
Expand All @@ -407,12 +405,11 @@ def test_pointwise_inner_adjoint_weighted():

testfunc = fspace.element(testarr)
testfunc_pwinner_adj = pwinner.adjoint(testfunc)
assert all_almost_equal(testfunc_pwinner_adj,
true_inner_adj.reshape([3, -1]))
assert all_almost_equal(testfunc_pwinner_adj, true_inner_adj)

out = vfspace.element()
pwinner.adjoint(testfunc, out=out)
assert all_almost_equal(out, true_inner_adj.reshape([3, -1]))
assert all_almost_equal(out, true_inner_adj)

# Using different weighting in the inner product
pwinner = PointwiseInner(vfspace, vecfield=array, weighting=[4, 8, 12])
Expand All @@ -424,12 +421,11 @@ def test_pointwise_inner_adjoint_weighted():

testfunc = fspace.element(testarr)
testfunc_pwinner_adj = pwinner.adjoint(testfunc)
assert all_almost_equal(testfunc_pwinner_adj,
true_inner_adj.reshape([3, -1]))
assert all_almost_equal(testfunc_pwinner_adj, true_inner_adj)

out = vfspace.element()
pwinner.adjoint(testfunc, out=out)
assert all_almost_equal(out, true_inner_adj.reshape([3, -1]))
assert all_almost_equal(out, true_inner_adj)


# ---- PointwiseSum ----
Expand Down
2 changes: 1 addition & 1 deletion odl/test/space/pspace_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_RxR():

# Check the basic properties
assert len(HxH) == 2
assert HxH.shape == (2,)
assert HxH.shape == (2, 2)
assert HxH.size == 2
assert HxH.dtype == H.dtype
assert HxH.spaces[0] is H
Expand Down

0 comments on commit b563410

Please sign in to comment.