Skip to content

Commit 69cd526

Browse files
committed
Allow the number of Chebyshev polynomial coefficients to be specified when performing hashing with ChebHash.
1 parent f099f61 commit 69cd526

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/function_hashing/chebhash.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ function cheb_coefficients(f, N)
5252
dct(fx) * (1/(2N))
5353
end
5454

55-
function get_cheb_coefficients(interval::RealInterval, f)
55+
function get_cheb_coefficients(interval::RealInterval, f; n_coeffs::Integer=1024)
5656
f_ = squash_function(interval, f)
57-
coeff = cheb_coefficients(f_, 1024)
57+
coeff = cheb_coefficients(f_, n_coeffs)
5858
coeff .* width(interval)
5959
end
6060

@@ -90,18 +90,18 @@ collision_probability(hashfn::ChebHash, args...; kws...) =
9090
Hash computation
9191
===============#
9292

93-
function (hashfn::ChebHash{:Chebyshev})(f)
94-
coeff = get_cheb_coefficients(hashfn.interval, f)
93+
function (hashfn::ChebHash{:Chebyshev})(f; kws...)
94+
coeff = get_cheb_coefficients(hashfn.interval, f, kws...)
9595
hashfn.discrete_hashfn(coeff)
9696
end
9797

98-
function index_hash(hashfn::ChebHash{:Chebyshev}, f)
99-
coeff = get_cheb_coefficients(hashfn.interval, f)
98+
function index_hash(hashfn::ChebHash{:Chebyshev}, f; kws...)
99+
coeff = get_cheb_coefficients(hashfn.interval, f; kws...)
100100
index_hash(hashfn.discrete_hashfn, coeff)
101101
end
102102

103103
function query_hash(hashfn::ChebHash{:Chebyshev}, f)
104-
coeff = get_cheb_coefficients(hashfn.interval, f)
104+
coeff = get_cheb_coefficients(hashfn.interval, f; kws...)
105105
query_hash(hashfn.discrete_hashfn, coeff)
106106
end
107107

0 commit comments

Comments
 (0)