mirror of
https://github.com/boostorg/gil.git
synced 2026-02-09 23:22:11 +00:00
113 lines
5.3 KiB
HTML
113 lines
5.3 KiB
HTML
|
||
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
<meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||
|
||
<title>Making a cumulative histogram - Boost.GIL documentation</title>
|
||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||
<link rel="stylesheet" href="../_static/style.css" type="text/css" />
|
||
<script type="text/javascript">
|
||
var DOCUMENTATION_OPTIONS = {
|
||
URL_ROOT: '../',
|
||
VERSION: '',
|
||
COLLAPSE_MODINDEX: false,
|
||
FILE_SUFFIX: '.html'
|
||
};
|
||
</script>
|
||
<script type="text/javascript" src="../_static/documentation_options.js"></script>
|
||
<script type="text/javascript" src="../_static/jquery.js"></script>
|
||
<script type="text/javascript" src="../_static/underscore.js"></script>
|
||
<script type="text/javascript" src="../_static/doctools.js"></script>
|
||
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
|
||
<script src="../_static/searchtools.js"></script>
|
||
<script src="../_static/language_data.js"></script>
|
||
<link rel="index" title="Index" href="../genindex.html" />
|
||
<link rel="search" title="Search" href="../search.html" />
|
||
<link rel="top" title="Boost.GIL documentation" href="../index.html" />
|
||
<link rel="up" title="Histogram" href="index.html" />
|
||
<link rel="next" title="STL compatibility" href="stl_compatibility.html" />
|
||
<link rel="prev" title="Making a sub-histogram" href="subhistogram.html" />
|
||
</head>
|
||
<body>
|
||
<div class="header">
|
||
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
|
||
"header">
|
||
<tr>
|
||
<td valign="top" width="300">
|
||
<h3><a href="../index.html"><img
|
||
alt="C++ Boost" src="../_static/gil.png" border="0"></a></h3>
|
||
</td>
|
||
|
||
<td >
|
||
<h1 align="center"><a href="../index.html"></a></h1>
|
||
</td>
|
||
<td>
|
||
<div id="searchbox" style="display: none">
|
||
<form class="search" action="../search.html" method="get">
|
||
<input type="text" name="q" size="18" />
|
||
<input type="submit" value="Search" />
|
||
<input type="hidden" name="check_keywords" value="yes" />
|
||
<input type="hidden" name="area" value="default" />
|
||
</form>
|
||
</div>
|
||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<hr/>
|
||
<div class="content">
|
||
<div class="navbar" style="text-align:right;">
|
||
|
||
|
||
<a class="prev" title="Making a sub-histogram" href="subhistogram.html"><img src="../_static/prev.png" alt="prev"/></a>
|
||
<a class="up" title="Histogram" href="index.html"><img src="../_static/up.png" alt="up"/></a>
|
||
<a class="next" title="STL compatibility" href="stl_compatibility.html"><img src="../_static/next.png" alt="next"/></a>
|
||
|
||
</div>
|
||
|
||
<section id="making-a-cumulative-histogram">
|
||
<span id="cumulative-histogram"></span><h1>Making a cumulative histogram</h1>
|
||
<section id="overview">
|
||
<h2>Overview</h2>
|
||
<p>A cumulative histogram is a histogram in which each bin stores the count / frequency of itself
|
||
as well as all the bins with keys ‘smaller’ than the particular bin.
|
||
As such, a notion of ordering among its keys should be existent in the histogram.</p>
|
||
<p>The GIL histogram class has the ability to convert itself into its cumulative version.</p>
|
||
<p>Since the container needs to first get an ordering
|
||
over the keys a key sorting takes place before calculating the cumulative histogram.</p>
|
||
<p>Example:</p>
|
||
<blockquote>
|
||
<div><div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">histogram</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span><span class="w"> </span><span class="kt">float</span><span class="o">></span><span class="w"> </span><span class="n">h</span><span class="p">;</span><span class="w"></span>
|
||
<span class="cm">/*</span>
|
||
<span class="cm">Fill histogram ...</span>
|
||
<span class="cm">*/</span><span class="w"></span>
|
||
<span class="k">auto</span><span class="w"> </span><span class="n">h1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">cumulative_histogram</span><span class="p">(</span><span class="n">h</span><span class="p">);</span><span class="w"></span>
|
||
</pre></div>
|
||
</div>
|
||
</div></blockquote>
|
||
<p>Tip: <em>In case you need to store the cumulative histogram elsewhere, consider creating a copy of the histogram
|
||
and then call the function</em>.</p>
|
||
</section>
|
||
</section>
|
||
|
||
|
||
<div class="navbar" style="text-align:right;">
|
||
|
||
|
||
<a class="prev" title="Making a sub-histogram" href="subhistogram.html"><img src="../_static/prev.png" alt="prev"/></a>
|
||
<a class="up" title="Histogram" href="index.html"><img src="../_static/up.png" alt="up"/></a>
|
||
<a class="next" title="STL compatibility" href="stl_compatibility.html"><img src="../_static/next.png" alt="next"/></a>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="footer" role="contentinfo">
|
||
Last updated on 2024-09-18 18:09:04.
|
||
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 4.3.2.
|
||
</div>
|
||
</body>
|
||
</html> |