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; }; }
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; }; }
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; }; }
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); }