public static SequenceBuilder GetSeqXLB_DiffSetRL64(short t = 16, short b = 127, IIEncoder64 coder = null) { if (coder == null) { coder = new EliasDelta64 (); } return GetSeqXLB (t, BitmapBuilders.GetDiffSetRL64 (b, coder)); }
/// <summary> /// build methods /// </summary> public void Build(IEnumerable<long> orderedList, long n, short b, IIEncoder64 coder = null) { this.N = n; this.B = b; this.M = 0; if (coder == null) { coder = new EliasDelta64 (); } this.Coder = coder; long prev = -1; var ctx = new BitStreamCtxRL (); foreach (var current in orderedList) { if (current == 0) { prev = AccStart; } this.M++; long diff = current - prev; //Console.WriteLine ("DIFF {0}, num: {1}, current: {2}", diff, this.M, current); if (diff == 1) { ++ctx.run_len; } else { this.Commit (ctx); // Console.WriteLine ("%%%%%% diff: {0}, prev: {1}, curr: {2}", diff, prev, current); Coder.Encode (this.Stream, diff); } if ((this.M % this.B) == 0) { this.Commit (ctx); this.Samples.Add (current); this.Offsets.Add (this.Stream.CountBits); } if (current >= this.N) { this.N = current + 1; } prev = current; } this.Commit (ctx); /*for (int i = 0; i < this.Samples.Count; i++) { Console.WriteLine ("-- i: {0}, samples: {1}, offset: {2}", i, Samples[i], Offsets[i]); }*/ }
/// <summary> /// build methods /// </summary> public void Build(IEnumerable<long> orderedList, long n, short b, IIEncoder64 coder = null) { this.N = n; this.B = b; this.M = 0; if (coder == null) { coder = new EliasDelta64 (); } this.Coder = coder; long prev = -1; foreach (var current in orderedList) { try { this.Add (current, prev); prev = current; } catch (Exception e) { Console.WriteLine (e.ToString ()); Console.WriteLine (e.StackTrace); throw e; } } this.Commit (); }