Exemplo n.º 1
0
 private static void TstDecodeAllNext(long[] values, EliasFanoDecoder efd)
 {
     efd.ToBeforeSequence();
     long nextValue = efd.NextValue();
     foreach (long expValue in values)
     {
         Assert.IsFalse(EliasFanoDecoder.NO_MORE_VALUES == nextValue, "nextValue at end too early");
         Assert.AreEqual(expValue, nextValue);
         nextValue = efd.NextValue();
     }
     Assert.AreEqual(EliasFanoDecoder.NO_MORE_VALUES, nextValue);
 }
Exemplo n.º 2
0
        private static void TstDecodeAllNext(long[] values, EliasFanoDecoder efd)
        {
            efd.ToBeforeSequence();
            long nextValue = efd.NextValue();

            foreach (long expValue in values)
            {
                Assert.IsFalse(EliasFanoDecoder.NO_MORE_VALUES == nextValue, "nextValue at end too early");
                Assert.AreEqual(expValue, nextValue);
                nextValue = efd.NextValue();
            }
            Assert.AreEqual(EliasFanoDecoder.NO_MORE_VALUES, nextValue);
        }
Exemplo n.º 3
0
        public virtual void TestExample2NoIndex2() // Figure 2 from Vigna 2012 paper, no index, test broadword selection.
        {
            long indexInterval = 16;

            long[]           values     = new long[] { 5, 8, 8, 15, 32 }; // two low bits, high values 1,2,2,3,8.
            long[]           indexLongs = new long[0];                    // high bits 0b 0001 0000 0101 1010
            EliasFanoEncoder efEncVI    = TstEFVI(values, indexInterval, indexLongs);
            EliasFanoDecoder efDecVI    = efEncVI.Decoder;

            Assert.AreEqual(5, efDecVI.NextValue(), "initial next");
            Assert.AreEqual(32, efDecVI.AdvanceToValue(22), "advance 22");
        }
Exemplo n.º 4
0
        public virtual void TestExample2b() // Figure 2 from Vigna 2012 paper
        {
            long indexInterval = 4;

            long[]           values     = new long[] { 5, 8, 8, 15, 32 }; // two low bits, high values 1,2,2,3,8.
            long[]           indexLongs = new long[] { 8 + 12 * 16 };     // high bits 0b 0001 0000 0101 1010
            EliasFanoEncoder efEncVI    = TstEFVI(values, indexInterval, indexLongs);
            EliasFanoDecoder efDecVI    = efEncVI.GetDecoder();

            Assert.AreEqual(5, efDecVI.NextValue(), "initial next");
            Assert.AreEqual(32, efDecVI.AdvanceToValue(22), "advance 22");
        }
Exemplo n.º 5
0
 public override int NextDoc()
 {
     return(SetCurDocID(efDecoder.NextValue()));
 }