Commit 9d3849bb authored by René Fritze's avatar René Fritze Committed by René Fritze

[tests] some minor fixes to hypo test setup

- test_pairwise_dot_self was not setup for complex data
 - strategies invalid_ind_pairs had some leftover refactor artefacts
 - svd_va didn't use fixture input properly
parent 8e196bc9
......@@ -17,7 +17,7 @@ methods = [method_of_snapshots, qr_svd]
@given(vector_arrays(count=1), sampled_from(methods))
def test_method_of_snapshots(vector_array, method):
A = vector_array
A = vector_array[0]
print(type(A))
print(A.dim, len(A))
......
......@@ -328,11 +328,11 @@ def invalid_inds(v, length=None):
def invalid_ind_pairs(v1, v2):
for inds in pyst.valid_inds_of_different_length(v1, v2):
for inds in valid_inds_of_different_length(v1, v2):
yield inds
for ind1 in pyst.valid_inds(v1):
for ind1 in valid_inds(v1):
for ind2 in invalid_inds(v2, length=v1.len_ind(ind1)):
yield ind1, ind2
for ind2 in pyst.valid_inds(v2):
for ind2 in valid_inds(v2):
for ind1 in invalid_inds(v1, length=v2.len_ind(ind2)):
yield ind1, ind2
\ No newline at end of file
......@@ -195,6 +195,10 @@ def test_random_normal(vector_arrays, count, loc, scale):
except NotImplementedError:
pass
vv = vector_array.random(c, 'normal', loc=loc, scale=scale, seed=seed)
data = vv.to_numpy()
# due to scaling data might actually now include nan or inf
assume(not np.isnan(data).any())
assume(not np.isinf(data).any())
assert np.allclose((v - vv).sup_norm(), 0.)
......@@ -561,7 +565,7 @@ def test_pairwise_dot_self(vector_array_inds):
assert isinstance(r, np.ndarray)
assert r.shape == (v.len_ind(ind1),)
r2 = v[ind2].pairwise_dot(v[ind1])
assert np.allclose(r, r2)
assert np.allclose(r, r2.T.conj())
assert np.all(r <= v[ind1].l2_norm() * v[ind2].l2_norm() * (1. + 1e-10))
try:
assert np.allclose(r, np.sum(indexed(v.to_numpy(), ind1).conj() * indexed(v.to_numpy(), ind2), axis=1))
......@@ -1048,6 +1052,7 @@ def test_scal_wrong_coefficients(v_ind):
v[ind].scal(alpha)
@settings(deadline=None)
@given(pyst.vector_arrays(count=2))
def test_axpy_wrong_ind(compatible_vector_array_pair):
v1, v2 = compatible_vector_array_pair
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment