IntersectCompressedWithLinJump performs the intersection linearly.
(dec *codec.Decoder, v []uint64, o *[]uint64)
| 61 | |
| 62 | // IntersectCompressedWithLinJump performs the intersection linearly. |
| 63 | func IntersectCompressedWithLinJump(dec *codec.Decoder, v []uint64, o *[]uint64) { |
| 64 | m := len(v) |
| 65 | k := 0 |
| 66 | _, off := IntersectWithLin(dec.Uids(), v[k:], o) |
| 67 | k += off |
| 68 | |
| 69 | for k < m { |
| 70 | u := dec.LinearSeek(v[k]) |
| 71 | if len(u) == 0 { |
| 72 | break |
| 73 | } |
| 74 | _, off := IntersectWithLin(u, v[k:], o) |
| 75 | if off == 0 { |
| 76 | off = 1 // If v[k] isn't in u, move forward. |
| 77 | } |
| 78 | |
| 79 | k += off |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | // IntersectCompressedWithBin is based on the paper |
| 84 | // "Fast Intersection Algorithms for Sorted Sequences" |