Skip to content

Commit d430db2

Browse files
committed
Add deprecation warnings for ChebHash and MIPSHash. Fixes #29.
1 parent 8890db2 commit d430db2

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

Manifest.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
9999
version = "0.21.0"
100100

101101
[[LibGit2]]
102+
deps = ["Printf"]
102103
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
103104

104105
[[Libdl]]
@@ -160,7 +161,7 @@ uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
160161
version = "1.0.6"
161162

162163
[[Pkg]]
163-
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Test", "UUIDs"]
164+
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
164165
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
165166

166167
[[Printf]]

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
name = "LSHFunctions"
22
uuid = "5134c85a-a9db-11e9-340f-8514dff59a31"
33
authors = ["Will Shand <wish5031@colorado.edu>"]
4-
version = "0.1.1"
4+
version = "0.1.2"
55

66
[deps]
77
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
88
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
99
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
1010
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
11+
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
1112
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
1213
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
1314
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

docs/src/function_hashing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ When ``f`` and ``g`` are allowed to take on complex values, ``g(x)`` is replaced
5050

5151
Create a hash function for cosine similarity for functions in ``L^2([-1,1])``:
5252

53-
```jldoctest; setup = :(using LSHFunctions)
53+
```
5454
julia> hashfn = ChebHash(cossim, 50; interval=@interval(-1 ≤ x ≤ 1));
5555
5656
julia> n_hashes(hashfn)
@@ -65,7 +65,7 @@ Bool
6565

6666
Create a hash function for ``L^2`` distance defined over ``L^2([0,2\pi])``. Hash the functions `f(x) = cos(x)` and `f(x) = x/(2π)` using the returned [`ChebHash`](@ref):
6767

68-
```jldoctest; setup = :(using LSHFunctions, Random; Random.seed!(0))
68+
```
6969
julia> hashfn = ChebHash(L2, 3; interval=@interval(0 ≤ x ≤ 2π));
7070
7171
julia> hashfn(cos)

src/function_hashing/chebhash.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ ChebHash for hashing the L^2([-1,1]) function space.
55
================================================================#
66

77
using FFTW
8+
using Logging
89

910
#========================
1011
Global constants
@@ -31,6 +32,7 @@ struct ChebHash{B, F<:SimilarityFunction, H<:LSHFunction, I<:RealInterval}
3132
interval::I
3233
) where {B, F<:SimilarityFunction, H<:LSHFunction, I<:RealInterval}
3334

35+
@warn "ChebHash is deprecated. Starting in version 0.2.0 ChebHash will no longer be available."
3436
new{B,F,H,I}(hashfn, interval)
3537
end
3638
end
@@ -71,7 +73,7 @@ join(
7173
# Examples
7274
Create a hash function for cosine similarity for functions in ``L^2([-1,1])``:
7375
74-
```jldoctest; setup = :(using LSHFunctions)
76+
```
7577
julia> hashfn = ChebHash(cossim, 50; interval=@interval(-1 ≤ x ≤ 1));
7678
7779
julia> n_hashes(hashfn)
@@ -86,7 +88,7 @@ $(cossim |> LSHFunction |> hashtype)
8688
8789
Create a hash function for ``L^2`` distance defined over ``L^2([0,2\\pi])``. Hash the functions `f(x) = cos(x)` and `f(x) = x/(2π)` using the returned `ChebHash`:
8890
89-
```jldoctest; setup = :(using LSHFunctions, Random; Random.seed!(0))
91+
```
9092
julia> hashfn = ChebHash(L2, 3; interval=@interval(0 ≤ x ≤ 2π));
9193
9294
julia> hashfn(cos)

src/hashes/mips_hash.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Definition of MIPSHash for hashing on inner products.
44
55
================================================================#
66

7+
using Logging
8+
79
#========================
810
Typedefs
911
========================#
@@ -52,7 +54,7 @@ Create a `MIPSHash` hash function for hashing on inner product similarity.
5254
# Examples
5355
`MIPSHash` is an [`AsymmetricLSHFunction`](@ref), and hence hashes must be computed using `index_hash` and `query_hash`.
5456
55-
```jldoctest; setup = :(using LSHFunctions)
57+
```
5658
julia> hashfn = MIPSHash(5; maxnorm=10);
5759
5860
julia> x = rand(4);
@@ -68,14 +70,14 @@ true
6870
6971
You need to explicitly specify the `maxnorm` keyword parameter when constructing `MIPSHash`, otherwise you will get an error.
7072
71-
```jldoctest; setup = :(using LSHFunctions)
73+
```
7274
julia> hashfn = MIPSHash(5)
7375
ERROR: maxnorm must be specified for MIPSHash
7476
```
7577
7678
You'll also get an error if you try to hash a vector that has norm greater than the `maxnorm` that you specified.
7779
78-
```jldoctest; setup = :(using LSHFunctions)
80+
```
7981
julia> hashfn = MIPSHash(; maxnorm=1);
8082
8183
julia> index_hash(hashfn, ones(4))
@@ -98,6 +100,7 @@ See also: [`inner_prod`](@ref), [`ℓ2_norm`](@ref ℓp_norm)
98100
throw)
99101
else
100102
quote
103+
@warn "MIPSHash is deprecated. Starting in version 0.2.0 MIPSHash will no longer be available."
101104
if n_hashes < 1
102105
"n_hashes must be positive" |>
103106
ErrorException |>
@@ -125,8 +128,8 @@ See also: [`inner_prod`](@ref), [`ℓ2_norm`](@ref ℓp_norm)
125128

126129
MIPSHash{T}(coeff_A, coeff_B, scale, shift, Qshift, m,
127130
maxnorm, resize_pow2)
128-
end
129131
end
132+
end
130133
end
131134

132135
MIPSHash(args...; dtype=DEFAULT_DTYPE, kws...) =

0 commit comments

Comments
 (0)