示例#1
0
        public static void InitialEntropyCodes(int HistogramTypeInt, global::Array <uint> data, int length, int literals_per_histogram, int max_histograms, int stride, global::Array <object> vec)
        {
            unchecked {
                int total_histograms = ((length / literals_per_histogram) + 1);
                if ((total_histograms > max_histograms))
                {
                    total_histograms = max_histograms;
                }

                int seed_0       = 7;
                int block_length = (length / total_histograms);
                {
                    int _g1 = 0;
                    int _g  = total_histograms;
                    while ((_g1 < _g))
                    {
                        int i   = _g1++;
                        int pos = ((length * i) / total_histograms);
                        if ((i != 0))
                        {
                            seed_0 = ((uint)((seed_0 * 16807)));
                            seed_0 = ((uint)(((uint)((((uint)(seed_0)) >> 0)))));
                            if (((bool)((seed_0 == 0))))
                            {
                                seed_0 = ((uint)(1));
                            }

                            pos = ((int)(((uint)((((uint)((seed_0 % block_length))) + pos)))));
                        }

                        if (((pos + stride) >= length))
                        {
                            pos = ((length - stride) - 1);
                        }

                        global::encode.histogram.Histogram histo = new global::encode.histogram.Histogram(((int)(HistogramTypeInt)));
                        histo.Add2(data, pos, stride);
                        vec.push(histo);
                    }
                }
            }
        }
示例#2
0
        public static void RandomSample(global::Array <uint> seed, global::Array <uint> data, int length, int stride, global::encode.histogram.Histogram sample)
        {
            unchecked {
                int pos = 0;
                if ((stride >= length))
                {
                    pos    = 0;
                    stride = length;
                }
                else
                {
                    seed[0] = ((uint)((seed[0] * 16807)));
                    seed[0] = ((uint)(((uint)((((uint)(seed[0])) >> 0)))));
                    if (((bool)((seed[0] == 0))))
                    {
                        seed[0] = ((uint)(1));
                    }

                    pos = ((int)(((uint)((seed[0] % (((length - stride) + 1)))))));
                }

                sample.Add2(data, pos, stride);
            }
        }