70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/rbbcc/disp_helper.rb', line 70
def print_linear_hist(vals, val_type)
stars_max = $stars_max
log2_dist_max = 64
idx_max = -1
val_max = 0
vals.each_with_index do |v, i|
idx_max = i if v > 0
val_max = v if v > val_max
end
= " %-13s : count distribution"
body = " %-10d : %-8d |%-*s|"
stars = stars_max
if idx_max >= 0
puts( % val_type);
end
(0...(idx_max + 1)).each do |i|
val = vals[i]
puts(body % [i, val, stars,
stars(val, val_max, stars)])
end
end
|