~ubuntu-branches/ubuntu/trusty/bmagic/trusty-proposed

« back to all changes in this revision

Viewing changes to doc/html/a00010.html

  • Committer: Bazaar Package Importer
  • Author(s): Roberto C. Sanchez
  • Date: 2010-04-08 16:47:58 UTC
  • mfrom: (4.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100408164758-3vu6wmrk1dnzqnnj
Tags: 3.6.4-1
* New upstream release
* Update to Standards-Version 3.8.4 (no changes)

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
</div>
23
23
<div class="contents">
24
24
<h1>sample10.cpp</h1><p>Example of how to get random subset of a bit-vector For more information please visit: <a href="http://bmagic.sourceforge.net">http://bmagic.sourceforge.net</a></p>
25
 
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="a00079.html">bm::random_subset</a></dd></dl>
 
25
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="a00080.html">bm::random_subset</a></dd></dl>
26
26
<div class="fragment"><pre class="fragment"><span class="comment">/*</span>
27
27
<span class="comment">Copyright(c) 2002-2005 Anatoliy Kuznetsov(anatoliy_kuznetsov at yahoo.com)</span>
28
28
<span class="comment"></span>
56
56
 
57
57
 
58
58
<span class="preprocessor">#include &lt;iostream&gt;</span>
59
 
<span class="preprocessor">#include &quot;<a class="code" href="a00087.html">bm.h</a>&quot;</span>
60
 
<span class="preprocessor">#include &quot;<a class="code" href="a00095.html">bmrandom.h</a>&quot;</span>
 
59
<span class="preprocessor">#include &quot;<a class="code" href="a00088.html">bm.h</a>&quot;</span>
 
60
<span class="preprocessor">#include &quot;<a class="code" href="a00096.html">bmrandom.h</a>&quot;</span>
61
61
 
62
62
<span class="keyword">using namespace </span>std;
63
63
 
64
 
<span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt; <span class="keywordtype">void</span> <a name="a0"></a><a class="code" href="a00113.html#ab7f435443f8dbf9f50e4ad0efea8b1f8">PrintContainer</a>(T first, T last)
 
64
<span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt; <span class="keywordtype">void</span> <a name="a0"></a><a class="code" href="a00114.html#ab7f435443f8dbf9f50e4ad0efea8b1f8">PrintContainer</a>(T first, T last)
65
65
{
66
66
    <span class="keywordflow">if</span> (first == last)
67
67
        cout &lt;&lt; <span class="stringliteral">&quot;&lt;EMPTY SET&gt;&quot;</span>;
72
72
}
73
73
 
74
74
 
75
 
<span class="keywordtype">int</span> <a name="a1"></a><a class="code" href="a00105.html#a840291bc02cba5474a4cb46a9b9566fe">main</a>(<span class="keywordtype">void</span>)
 
75
<span class="keywordtype">int</span> <a name="a1"></a><a class="code" href="a00106.html#a840291bc02cba5474a4cb46a9b9566fe">main</a>(<span class="keywordtype">void</span>)
76
76
{
77
77
    <a name="_a2"></a><a class="code" href="a00044.html" title="bitvector with runtime compression of bits.">bm::bvector&lt;&gt;</a>   bv;    
78
78
 
95
95
 
96
96
    <span class="comment">// random sampler instance can be shared between calls</span>
97
97
    <span class="comment">//</span>
98
 
    <a name="_a4"></a><a class="code" href="a00079.html">bm::random_subset&lt;bm::bvector&lt;&gt;</a> &gt; rand_sampler;
99
 
    rand_sampler.<a name="a5"></a><a class="code" href="a00079.html#addbc2e7ae5308fed4c92da441b236ce4" title="Get random subset of input vector.">sample</a>(bvsubset1, bv, 20);
100
 
    rand_sampler.<a class="code" href="a00079.html#addbc2e7ae5308fed4c92da441b236ce4" title="Get random subset of input vector.">sample</a>(bvsubset2, bv, 20);
 
98
    <a name="_a4"></a><a class="code" href="a00080.html">bm::random_subset&lt;bm::bvector&lt;&gt;</a> &gt; rand_sampler;
 
99
    rand_sampler.<a name="a5"></a><a class="code" href="a00080.html#addbc2e7ae5308fed4c92da441b236ce4" title="Get random subset of input vector.">sample</a>(bvsubset1, bv, 20);
 
100
    rand_sampler.<a class="code" href="a00080.html#addbc2e7ae5308fed4c92da441b236ce4" title="Get random subset of input vector.">sample</a>(bvsubset2, bv, 20);
101
101
 
102
 
    <a class="code" href="a00113.html#ab7f435443f8dbf9f50e4ad0efea8b1f8">PrintContainer</a>(bvsubset1.<a name="a6"></a><a class="code" href="a00044.html#aad48c661f843e32c9893438a6f27a8f0" title="Returns enumerator pointing on the first non-zero bit.">first</a>(), bvsubset1.<a name="a7"></a><a class="code" href="a00044.html#a2c6e522f858fdc466765d2c0f269f590" title="Returns enumerator pointing on the next bit after the last.">end</a>());
 
102
    <a class="code" href="a00114.html#ab7f435443f8dbf9f50e4ad0efea8b1f8">PrintContainer</a>(bvsubset1.<a name="a6"></a><a class="code" href="a00044.html#aad48c661f843e32c9893438a6f27a8f0" title="Returns enumerator pointing on the first non-zero bit.">first</a>(), bvsubset1.<a name="a7"></a><a class="code" href="a00044.html#a2c6e522f858fdc466765d2c0f269f590" title="Returns enumerator pointing on the next bit after the last.">end</a>());
103
103
    cout &lt;&lt; endl;
104
 
    <a class="code" href="a00113.html#ab7f435443f8dbf9f50e4ad0efea8b1f8">PrintContainer</a>(bvsubset2.<a class="code" href="a00044.html#aad48c661f843e32c9893438a6f27a8f0" title="Returns enumerator pointing on the first non-zero bit.">first</a>(), bvsubset2.<a class="code" href="a00044.html#a2c6e522f858fdc466765d2c0f269f590" title="Returns enumerator pointing on the next bit after the last.">end</a>());
 
104
    <a class="code" href="a00114.html#ab7f435443f8dbf9f50e4ad0efea8b1f8">PrintContainer</a>(bvsubset2.<a class="code" href="a00044.html#aad48c661f843e32c9893438a6f27a8f0" title="Returns enumerator pointing on the first non-zero bit.">first</a>(), bvsubset2.<a class="code" href="a00044.html#a2c6e522f858fdc466765d2c0f269f590" title="Returns enumerator pointing on the next bit after the last.">end</a>());
105
105
 
106
106
    <span class="keywordflow">return</span> 0;
107
107
}
108
108
 
109
109
</pre></div> </div>
110
 
<hr size="1"/><address style="text-align: right;"><small>Generated on Fri Jan 8 20:09:19 2010 for BitMagic by&nbsp;
 
110
<hr size="1"/><address style="text-align: right;"><small>Generated on Tue Mar 23 20:47:54 2010 for BitMagic by&nbsp;
111
111
<a href="http://www.doxygen.org/index.html">
112
112
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
113
113
</body>