Skip to content

Commit

Permalink
Fix numpy.float deprecation, close #75 close #76 (#77)
Browse files Browse the repository at this point in the history
* Fix the np.float depreciation issue

* bump package version -> 0.3.3

---------

Co-authored-by: Jiatao Li <[email protected]>
  • Loading branch information
guilgautier and leejamesss authored Aug 14, 2024
1 parent cb4577f commit 0d34dd6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dppy/exact_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ def k_dpp_eig_vecs_selector(eig_vals, eig_vecs, size,
N, k = eig_vecs.shape[0], size

# as in np.linalg.matrix_rank
tol = np.max(eig_vals) * N * np.finfo(np.float).eps
tol = np.max(eig_vals) * N * np.finfo(float).eps
rank = np.count_nonzero(eig_vals > tol)
if k > rank:
raise ValueError('size k={} > rank={}'.format(k, rank))
Expand Down
4 changes: 2 additions & 2 deletions dppy/intermediate_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def temp_func_with_root_in_desired_expected_size(x):

alpha_star, opt_result = brentq(
temp_func_with_root_in_desired_expected_size,
a=10.0 * np.finfo(np.float).eps,
a=10.0 * np.finfo(float).eps,
b=1.0,
full_output=True)

Expand Down Expand Up @@ -619,7 +619,7 @@ def temp_func_with_root_in_desired_expected_size(x):
return np.sum(1.0 - 1.0 / (x * eigvals_L_hat + 1.0)) - desired_expected_size

alpha_hat, opt_result = brentq(temp_func_with_root_in_desired_expected_size,
a=10.0 * np.finfo(np.float).eps,
a=10.0 * np.finfo(float).eps,
b=4.0,
full_output=True)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='0.3.2',
version='0.3.3',

description='DPPy is a Python library for exact and approximate sampling of Determinantal Point Processes.',
long_description=long_description,
Expand Down

0 comments on commit 0d34dd6

Please sign in to comment.