File: a00100.html

package info (click to toggle)
bmagic 3.4.0-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,208 kB
  • ctags: 2,500
  • sloc: cpp: 9,399; ansic: 3,142; sh: 2,430; makefile: 340
file content (407 lines) | stat: -rw-r--r-- 18,684 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>BitMagic: Set algorithms</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="examples.html">Examples</a></div>
<h1>Set algorithms<br>
<small>
[<a class="el" href="a00094.html">BitMagic C++ Library</a>]</small>
</h1>
<p>
Collaboration diagram for Set algorithms:<center><table><tr><td><img src="a00100.png" border="0" alt="" usemap="#a00161_map">
<map name="a00161_map">
<area href="a00094.html" shape="rect" coords="19,5,152,26" alt="">
<area href="a00101.html" shape="rect" coords="344,5,448,26" alt="">
</map></td></tr></table></center>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Modules</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00101.html">Distance metrics</a></td></tr>

<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memTemplParams" nowrap colspan="2">template&lt;class BV, class It&gt; </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00100.html#ga0">bm::combine_or</a> (BV &amp;bv, It first, It last)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">OR Combine bitvector and the iterable sequence.  <a href="#ga0"></a><br></td></tr>
<tr><td class="memTemplParams" nowrap colspan="2">template&lt;class BV, class It&gt; </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00100.html#ga1">bm::combine_xor</a> (BV &amp;bv, It first, It last)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">XOR Combine bitvector and the iterable sequence.  <a href="#ga1"></a><br></td></tr>
<tr><td class="memTemplParams" nowrap colspan="2">template&lt;class BV, class It&gt; </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00100.html#ga2">bm::combine_sub</a> (BV &amp;bv, It first, It last)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">SUB Combine bitvector and the iterable sequence.  <a href="#ga2"></a><br></td></tr>
<tr><td class="memTemplParams" nowrap colspan="2">template&lt;class BV, class It&gt; </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00100.html#ga3">bm::combine_and</a> (BV &amp;bv, It first, It last)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">AND Combine bitvector and the iterable sequence.  <a href="#ga3"></a><br></td></tr>
<tr><td class="memTemplParams" nowrap colspan="2">template&lt;class BV&gt; </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top"><a class="el" href="a00092.html#a9">bm::id_t</a>&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00100.html#ga4">bm::count_intervals</a> (const BV &amp;bv)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Compute number of bit intervals (GAPs) in the bitvector.  <a href="#ga4"></a><br></td></tr>
<tr><td class="memTemplParams" nowrap colspan="2">template&lt;class BV, class It&gt; </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00100.html#ga5">bm::export_array</a> (BV &amp;bv, It first, It last)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Export bitset from an array of binary data representing the bit vector.  <a href="#ga5"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Set algorithms <hr><h2>Function Documentation</h2>
<a class="anchor" name="ga3" doxytag="bm::combine_and"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;class BV, class It&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">void combine_and           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">BV &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>bv</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>It&nbsp;</td>
          <td class="mdname" nowrap> <em>first</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>It&nbsp;</td>
          <td class="mdname" nowrap> <em>last</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
AND Combine bitvector and the iterable sequence. 
<p>
Algorithm combines bvector with sequence of integers (represents another set). When the agrument set is sorted this method can give serious increase in performance.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>bv</em>&nbsp;</td><td>- destination bitvector </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>first</em>&nbsp;</td><td>- first element of the iterated sequence </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>last</em>&nbsp;</td><td>- last element of the iterated sequence </td></tr>
  </table>
</dl>

<p>
Definition at line <a class="el" href="a00103.html#l00787">787</a> of file <a class="el" href="a00103.html">bmalgo.h</a>.
<p>
References <a class="el" href="a00103.html#l00550">bm::combine_or()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="ga0" doxytag="bm::combine_or"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;class BV, class It&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">void combine_or           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">BV &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>bv</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>It&nbsp;</td>
          <td class="mdname" nowrap> <em>first</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>It&nbsp;</td>
          <td class="mdname" nowrap> <em>last</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
OR Combine bitvector and the iterable sequence. 
<p>
Algorithm combines bvector with sequence of integers (represents another set). When the agrument set is sorted this method can give serious increase in performance.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>bv</em>&nbsp;</td><td>- destination bitvector </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>first</em>&nbsp;</td><td>- first element of the iterated sequence </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>last</em>&nbsp;</td><td>- last element of the iterated sequence </td></tr>
  </table>
</dl>

<p>
Definition at line <a class="el" href="a00103.html#l00550">550</a> of file <a class="el" href="a00103.html">bmalgo.h</a>.
<p>
References <a class="el" href="a00103.html#l00520">bm::block_range_scan()</a>, <a class="el" href="a00105.html#l00057">BMGAP_PTR</a>, <a class="el" href="a00106.html#l01704">bm::gap_limit()</a>, and <a class="el" href="a00106.html#l00843">bm::gap_set_value()</a>.
<p>
Referenced by <a class="el" href="a00103.html#l00787">bm::combine_and()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="ga2" doxytag="bm::combine_sub"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;class BV, class It&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">void combine_sub           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">BV &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>bv</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>It&nbsp;</td>
          <td class="mdname" nowrap> <em>first</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>It&nbsp;</td>
          <td class="mdname" nowrap> <em>last</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
SUB Combine bitvector and the iterable sequence. 
<p>
Algorithm combines bvector with sequence of integers (represents another set). When the agrument set is sorted this method can give serious increase in performance.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>bv</em>&nbsp;</td><td>- destination bitvector </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>first</em>&nbsp;</td><td>- first element of the iterated sequence </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>last</em>&nbsp;</td><td>- last element of the iterated sequence </td></tr>
  </table>
</dl>

<p>
Definition at line <a class="el" href="a00103.html#l00707">707</a> of file <a class="el" href="a00103.html">bmalgo.h</a>.
<p>
References <a class="el" href="a00103.html#l00520">bm::block_range_scan()</a>, <a class="el" href="a00105.html#l00057">BMGAP_PTR</a>, <a class="el" href="a00106.html#l01704">bm::gap_limit()</a>, <a class="el" href="a00106.html#l00843">bm::gap_set_value()</a>, and <a class="el" href="a00106.html#l00399">bm::gap_test()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="ga1" doxytag="bm::combine_xor"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;class BV, class It&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">void combine_xor           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">BV &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>bv</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>It&nbsp;</td>
          <td class="mdname" nowrap> <em>first</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>It&nbsp;</td>
          <td class="mdname" nowrap> <em>last</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
XOR Combine bitvector and the iterable sequence. 
<p>
Algorithm combines bvector with sequence of integers (represents another set). When the agrument set is sorted this method can give serious increase in performance.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>bv</em>&nbsp;</td><td>- destination bitvector </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>first</em>&nbsp;</td><td>- first element of the iterated sequence </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>last</em>&nbsp;</td><td>- last element of the iterated sequence </td></tr>
  </table>
</dl>

<p>
Definition at line <a class="el" href="a00103.html#l00626">626</a> of file <a class="el" href="a00103.html">bmalgo.h</a>.
<p>
References <a class="el" href="a00103.html#l00520">bm::block_range_scan()</a>, <a class="el" href="a00105.html#l00014">BM_ASSERT</a>, <a class="el" href="a00105.html#l00057">BMGAP_PTR</a>, <a class="el" href="a00106.html#l01704">bm::gap_limit()</a>, <a class="el" href="a00106.html#l00843">bm::gap_set_value()</a>, and <a class="el" href="a00106.html#l00399">bm::gap_test()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="ga4" doxytag="bm::count_intervals"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;class BV&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top"><a class="el" href="a00092.html#a9">bm::id_t</a> count_intervals           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const BV &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>bv</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Compute number of bit intervals (GAPs) in the bitvector. 
<p>
Algorithm traverses bit vector and count number of uninterrupted intervals of 1s and 0s. <pre>
    For example: 
      00001111100000 - gives us 3 intervals
      10001111100000 - 4 intervals
      00000000000000 - 1 interval
      11111111111111 - 1 interval
    </pre> <dl compact><dt><b>Returns:</b></dt><dd>Number of intervals </dd></dl>

<p>
Definition at line <a class="el" href="a00103.html#l00810">810</a> of file <a class="el" href="a00103.html">bmalgo.h</a>.
<p>
References <a class="el" href="a00106.html#l00488">bm::for_each_block()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="ga5" doxytag="bm::export_array"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="mdPrefix" colspan="4">
template&lt;class BV, class It&gt; </td>
        </tr>
        <tr>
          <td class="md" nowrap valign="top">void export_array           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">BV &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>bv</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>It&nbsp;</td>
          <td class="mdname" nowrap> <em>first</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>It&nbsp;</td>
          <td class="mdname" nowrap> <em>last</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Export bitset from an array of binary data representing the bit vector. 
<p>
Input array can be array of ints, chars or other native C types. Method works with iterators, which makes it compatible with STL containers and C arrays<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>bv</em>&nbsp;</td><td>- destination bitvector </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>first</em>&nbsp;</td><td>- first element of the iterated sequence </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>last</em>&nbsp;</td><td>- last element of the iterated sequence </td></tr>
  </table>
</dl>

<p>
Definition at line <a class="el" href="a00103.html#l00836">836</a> of file <a class="el" href="a00103.html">bmalgo.h</a>.
<p>
References <a class="el" href="a00105.html#l00014">BM_ASSERT</a>, and <a class="el" href="a00105.html#l00057">BMGAP_PTR</a>.    </td>
  </tr>
</table>
<hr size="1"><address style="align: right;"><small>Generated on Thu Apr 20 13:29:10 2006 for BitMagic by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.1 </small></address>
</body>
</html>