Skip to content

Fix tests #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dppy/exotic_dpps_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def ust_sampler_aldous_broder(list_of_neighbors, root=None,
visited[n0] = True
nb_nodes_in_tree = 1

tree_edges = np.zeros((nb_nodes - 1, 2), dtype=np.int)
tree_edges = np.zeros((nb_nodes - 1, 2), dtype=int)

while nb_nodes_in_tree < nb_nodes:

Expand Down
12 changes: 6 additions & 6 deletions dppy/random_matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def mu_ref_unif_unit_circle_sampler_quindiag(beta=2, size=10,
raise ValueError('`beta` must be positive integer.\
Given: {}'.format(beta))

alpha = np.zeros(size, dtype=np.complex_)
alpha = np.zeros(size, dtype=np.complex128)

# nu = 1 + beta*(N-1, N-2, ..., 0)
for i, nu in enumerate(1 + beta * np.arange(size - 1, -1, step=-1)):
Expand All @@ -343,7 +343,7 @@ def mu_ref_unif_unit_circle_sampler_quindiag(beta=2, size=10,

rho = np.sqrt(1 - np.abs(alpha[:-1])**2)

xi = np.zeros((size - 1, 2, 2), dtype=np.complex_) # xi[0,..,N-1]
xi = np.zeros((size - 1, 2, 2), dtype=np.complex128) # xi[0,..,N-1]
xi[:, 0, 0], xi[:, 0, 1] = alpha[:-1].conj(), rho
xi[:, 1, 0], xi[:, 1, 1] = rho, -alpha[:-1]

Expand All @@ -352,14 +352,14 @@ def mu_ref_unif_unit_circle_sampler_quindiag(beta=2, size=10,
# xi[N-1] = alpha[N-1].conj()
if size % 2 == 0: # even
L = sp.block_diag(xi[::2, :, :],
dtype=np.complex_)
dtype=np.complex128)
M = sp.block_diag([1.0, *xi[1::2, :, :], alpha[-1].conj()],
dtype=np.complex_)
dtype=np.complex128)
else: # odd
L = sp.block_diag([*xi[::2, :, :], alpha[-1].conj()],
dtype=np.complex_)
dtype=np.complex128)
M = sp.block_diag([1.0, *xi[1::2, :, :]],
dtype=np.complex_)
dtype=np.complex128)

return la.eigvals(L.dot(M).toarray())

Expand Down
2 changes: 1 addition & 1 deletion tests/test_beta_ensembles_samplers.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def limiting_distribution_adequation(samples,
f_th = [quad(limiting_distribution, a, b)[0]
for a, b in zip(bins[:-1], bins[1:])]

_, pval = chisquare(f_obs=f_emp, f_exp=f_th)
_, pval = chisquare(f_obs=f_emp, f_exp=f_th, sum_check=False)

msg = 'pval = {}'.format(pval)

Expand Down
4 changes: 3 additions & 1 deletion tests/test_finite_dpps_samplers.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ def doubleton_adequation(dpp, samples, tol=0.05):
for doubl in doubletons]
marginal_emp = np.array(counts) / len(samples)

_, pval = chisquare(f_obs=marginal_emp, f_exp=marginal_th)
_, pval = chisquare(f_obs=marginal_emp,
f_exp=marginal_th,
sum_check=False)

msg = 'pval = {}, emp = {}, th = {}'.format(pval,
marginal_emp,
Expand Down