Пример #1
0
        public static Tuple <int [], int []> acummulate_histogram_with_next(int [] histogram, int minimal_bin_value)
        {
            int accumulated_value      = 0;
            int acummulating_bin_index = 0;

            int [] bin_mapping = new int [histogram.Length];

            for (int index = 0; index < histogram.Length; index++)
            {
                accumulated_value += histogram[index];
                bin_mapping[index] = acummulating_bin_index;

                if (minimal_bin_value <= accumulated_value)
                {
                    accumulated_value  = 0;
                    bin_mapping[index] = acummulating_bin_index;
                    acummulating_bin_index++;
                }
            }
            if (accumulated_value != 0)
            {
                ToolsCollection.ReplaceRBA(bin_mapping, acummulating_bin_index, acummulating_bin_index - 1);
            }

            int [] acummulated_histogram = new int [acummulating_bin_index];
            for (int index = 0; index < histogram.Length; index++)
            {
                acummulated_histogram[bin_mapping[index]] += histogram[index];
            }
            return(new Tuple <int [], int []>(acummulated_histogram, bin_mapping));
        }