Uses a small fixed number of bits to represent numbers. Truncated binary.
Inheritance: IIEncoder32
Exemple #1
0
        public static SequenceBuilder GetWT(
			BitmapFromBitStream bitmap_builder = null,
			Func<int, IIEncoder32> get_coder = null
		)
        {
            if (bitmap_builder == null) {
                bitmap_builder = BitmapBuilders.GetGGMN_wt(16);
            }
            return delegate (IList<int> seq, int sigma) {
                var wt = new WaveletTree ();
                wt.BitmapBuilder = bitmap_builder;
                // var enc = new BinaryCoding (numbits);
                IIEncoder32 enc;
                if (get_coder == null) {
                    int numbits = (int)Math.Ceiling (Math.Log (sigma, 2));
                    enc = new BinaryCoding (numbits);
                } else {
                    enc = get_coder(sigma);
                }
                wt.Build (seq, sigma, enc);
                return wt;
            };
        }
Exemple #2
0
 public static SequenceBuilder GetWT_BinaryCoding(BitmapFromBitStream bitmap_builder)
 {
     return delegate (IList<int> seq, int sigma) {
         var wt = new WaveletTree ();
         wt.BitmapBuilder = bitmap_builder;
         int numbits = (int)Math.Ceiling (Math.Log (sigma, 2));
         var enc = new BinaryCoding (numbits);
         wt.Build (enc, sigma, seq);
         return wt;
     };
 }
Exemple #3
0
        public static SequenceBuilder GetWT_GGMN_BinaryCoding(short b)
        {
            return delegate (IList<int> seq, int sigma) {
                var wt = new WaveletTree ();
                wt.BitmapBuilder = BitmapBuilders.GetGGMN_wt (b);
                int numbits = (int)Math.Ceiling (Math.Log (sigma, 2));
                var enc = new BinaryCoding (numbits);
                wt.Build (enc, sigma, seq);
                return wt;

            };
        }
Exemple #4
0
 public void Build(IList<int> text, int alphabet_size, IIEncoder32 coder = null)
 {
     this.Alphabet = new WT_Leaf[alphabet_size];
     this.Root = new WT_Inner (null, true);
     if (coder == null) {
         coder = new BinaryCoding(ListIFS.GetNumBits(alphabet_size-1));
     }
     this.Coder = coder;
     for (int i = 0; i < text.Count; i++) {
         this.Add (text [i]);
     }
     this.FinishBuild (this.Root);
 }