Skip to content

Commit dc50b96

Browse files
committed
Fix doctests for Julia 1.6.
Fix the doctests to handle a change between Julia 1.5 and 1.6 where one-dimensional arrays like Array{1} and BitArray{1} are displayed in the REPL output as "Vector" and "BitVector".
1 parent 4383abd commit dc50b96

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

docs/src/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ julia> data[end,1:end] .= rand(100); # Randomize the last dimension of each poi
1717
julia> hashes = map(x -> hashfn(x), eachcol(data));
1818
1919
julia> unique(hashes)
20-
1-element Array{BitArray{1},1}:
20+
1-element Vector{BitVector}:
2121
[0]
2222
```
2323

docs/src/function_hashing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ julia> μ() = 2π*rand(); # μ samples a random point from [0,2π]
1313
julia> hashfn = MonteCarloHash(cossim, μ, 3);
1414
1515
julia> hashfn(x -> 5x^3 - 2x^2 - 9x + 1)
16-
3-element BitArray{1}:
16+
3-element BitVector:
1717
0
1818
1
1919
1
@@ -75,13 +75,13 @@ julia> μ() = 2π * rand(); # μ samples a random point from [0,2π]
7575
julia> hashfn = MonteCarloHash(L2, μ, 3; volume=2π);
7676
7777
julia> hashfn(cos)
78-
3-element Array{Int32,1}:
78+
3-element Vector{Int32}:
7979
-1
8080
3
8181
0
8282
8383
julia> hashfn(x -> x/(2π))
84-
3-element Array{Int32,1}:
84+
3-element Vector{Int32}:
8585
-1
8686
-2
8787
-1

docs/src/lshfunction_api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ LSHFunctions.jl provides a few common utility functions that you can use across
114114
julia> hashes = hashfn(rand(100));
115115
116116
julia> typeof(hashes)
117-
BitArray{1}
117+
BitVector (alias for BitArray{1})
118118
119119
julia> typeof(hashes[1]) == hashtype(hashfn)
120120
true

docs/src/similarities/cosine.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ julia> n_hashes(hashfn)
7676
julia> hashes = hashfn(randn(4));
7777
7878
julia> typeof(hashes)
79-
BitArray{1}
79+
BitVector (alias for BitArray{1})
8080
8181
julia> length(hashes)
8282
1

docs/src/similarities/jaccard.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ UInt64
4040
julia> A = Set([1, 2, 3]);
4141
4242
julia> hashfn(A)
43-
5-element Array{UInt64,1}:
44-
0x21be0e591a3b69ea
45-
0x19c5f638a776ab3c
46-
0x63c12fd5d2f073ab
47-
0x5c6b11e538a36352
48-
0x129ef927e80a1b39
43+
5-element Vector{UInt64}:
44+
0x68ab426365cf3fcf
45+
0x13095267e4625e58
46+
0x0c0f74c97d4d341e
47+
0x1b294d39ad1e06a7
48+
0x74a5bce47c6b635a
4949
```
5050

5151
The probability of a collision for an individual hash between sets ``A`` and ``B`` is just equal to their Jaccard similarity, i.e.

docs/src/similarities/lp_distance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ julia> x = rand(20);
7575
julia> hashes = hashfn(x);
7676
7777
julia> typeof(hashes)
78-
Array{Int32,1}
78+
Vector{Int32} (alias for Array{Int32, 1})
7979
```
8080

8181
`L1Hash` and `L2Hash` support a keyword parameter called `scale`. `scale` impacts the collision probability: if `scale` is large then hash collisions are more likely (even among distant points). If `scale` is small, then hash collisions are less likely (even among close points).

src/function_hashing/monte_carlo.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ julia> μ() = 2π * rand(); # μ samples a random point from [0,2π]
123123
julia> hashfn = MonteCarloHash(L2, μ, 3; volume=2π);
124124
125125
julia> hashfn(cos)
126-
3-element Array{Int32,1}:
126+
3-element Vector{Int32}:
127127
-1
128128
3
129129
0
130130
131131
julia> hashfn(x -> x/(2π))
132-
3-element Array{Int32,1}:
132+
3-element Vector{Int32}:
133133
-1
134134
-2
135135
-1

0 commit comments

Comments
 (0)