ocaml-containers/0.17/CCBV.html
2016-04-22 23:45:40 +02:00

234 lines
No EOL
14 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="CCFQueue.html">
<link rel="next" href="CCMixtbl.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of class methods" rel=Appendix href="index_methods.html">
<link title="Index of class types" rel=Appendix href="index_class_types.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="CCVector" rel="Chapter" href="CCVector.html">
<link title="CCPrint" rel="Chapter" href="CCPrint.html">
<link title="CCError" rel="Chapter" href="CCError.html">
<link title="CCHeap" rel="Chapter" href="CCHeap.html">
<link title="CCList" rel="Chapter" href="CCList.html">
<link title="CCOpt" rel="Chapter" href="CCOpt.html">
<link title="CCPair" rel="Chapter" href="CCPair.html">
<link title="CCFun" rel="Chapter" href="CCFun.html">
<link title="CCHash" rel="Chapter" href="CCHash.html">
<link title="CCInt" rel="Chapter" href="CCInt.html">
<link title="CCBool" rel="Chapter" href="CCBool.html">
<link title="CCFloat" rel="Chapter" href="CCFloat.html">
<link title="CCArray" rel="Chapter" href="CCArray.html">
<link title="CCRef" rel="Chapter" href="CCRef.html">
<link title="CCSet" rel="Chapter" href="CCSet.html">
<link title="CCOrd" rel="Chapter" href="CCOrd.html">
<link title="CCRandom" rel="Chapter" href="CCRandom.html">
<link title="CCString" rel="Chapter" href="CCString.html">
<link title="CCHashtbl" rel="Chapter" href="CCHashtbl.html">
<link title="CCMap" rel="Chapter" href="CCMap.html">
<link title="CCFormat" rel="Chapter" href="CCFormat.html">
<link title="CCIO" rel="Chapter" href="CCIO.html">
<link title="CCInt64" rel="Chapter" href="CCInt64.html">
<link title="CCChar" rel="Chapter" href="CCChar.html">
<link title="CCResult" rel="Chapter" href="CCResult.html">
<link title="Containers" rel="Chapter" href="Containers.html">
<link title="CCKTree" rel="Chapter" href="CCKTree.html">
<link title="CCKList" rel="Chapter" href="CCKList.html">
<link title="CCLazy_list" rel="Chapter" href="CCLazy_list.html">
<link title="CCMultiMap" rel="Chapter" href="CCMultiMap.html">
<link title="CCMultiSet" rel="Chapter" href="CCMultiSet.html">
<link title="CCTrie" rel="Chapter" href="CCTrie.html">
<link title="CCFlatHashtbl" rel="Chapter" href="CCFlatHashtbl.html">
<link title="CCCache" rel="Chapter" href="CCCache.html">
<link title="CCPersistentHashtbl" rel="Chapter" href="CCPersistentHashtbl.html">
<link title="CCDeque" rel="Chapter" href="CCDeque.html">
<link title="CCFQueue" rel="Chapter" href="CCFQueue.html">
<link title="CCBV" rel="Chapter" href="CCBV.html">
<link title="CCMixtbl" rel="Chapter" href="CCMixtbl.html">
<link title="CCMixmap" rel="Chapter" href="CCMixmap.html">
<link title="CCRingBuffer" rel="Chapter" href="CCRingBuffer.html">
<link title="CCIntMap" rel="Chapter" href="CCIntMap.html">
<link title="CCPersistentArray" rel="Chapter" href="CCPersistentArray.html">
<link title="CCMixset" rel="Chapter" href="CCMixset.html">
<link title="CCHashconsedSet" rel="Chapter" href="CCHashconsedSet.html">
<link title="CCGraph" rel="Chapter" href="CCGraph.html">
<link title="CCHashSet" rel="Chapter" href="CCHashSet.html">
<link title="CCBitField" rel="Chapter" href="CCBitField.html">
<link title="CCHashTrie" rel="Chapter" href="CCHashTrie.html">
<link title="CCBloom" rel="Chapter" href="CCBloom.html">
<link title="CCWBTree" rel="Chapter" href="CCWBTree.html">
<link title="CCRAL" rel="Chapter" href="CCRAL.html">
<link title="CCAllocCache" rel="Chapter" href="CCAllocCache.html">
<link title="CCImmutArray" rel="Chapter" href="CCImmutArray.html">
<link title="CCHet" rel="Chapter" href="CCHet.html">
<link title="Containers_string" rel="Chapter" href="Containers_string.html">
<link title="CCKMP" rel="Chapter" href="CCKMP.html">
<link title="CCLevenshtein" rel="Chapter" href="CCLevenshtein.html">
<link title="CCApp_parse" rel="Chapter" href="CCApp_parse.html">
<link title="CCParse" rel="Chapter" href="CCParse.html">
<link title="CCBigstring" rel="Chapter" href="CCBigstring.html">
<link title="CCArray1" rel="Chapter" href="CCArray1.html">
<link title="CCPool" rel="Chapter" href="CCPool.html">
<link title="CCLock" rel="Chapter" href="CCLock.html">
<link title="CCSemaphore" rel="Chapter" href="CCSemaphore.html">
<link title="CCThread" rel="Chapter" href="CCThread.html">
<link title="CCBlockingQueue" rel="Chapter" href="CCBlockingQueue.html">
<link title="CCTimer" rel="Chapter" href="CCTimer.html">
<link title="Containers_advanced" rel="Chapter" href="Containers_advanced.html">
<link title="CCLinq" rel="Chapter" href="CCLinq.html">
<link title="CCBatch" rel="Chapter" href="CCBatch.html">
<link title="CCCat" rel="Chapter" href="CCCat.html">
<link title="CCMonadIO" rel="Chapter" href="CCMonadIO.html">
<link title="Containers_io_is_deprecated" rel="Chapter" href="Containers_io_is_deprecated.html">
<link title="CCUnix" rel="Chapter" href="CCUnix.html">
<link title="CCSexp" rel="Chapter" href="CCSexp.html">
<link title="CCSexpM" rel="Chapter" href="CCSexpM.html"><title>Containers doc : CCBV</title>
</head>
<body>
<div class="navbar"><a class="pre" href="CCFQueue.html" title="CCFQueue">Previous</a>
&nbsp;<a class="up" href="index.html" title="Index">Up</a>
&nbsp;<a class="post" href="CCMixtbl.html" title="CCMixtbl">Next</a>
</div>
<h1>Module <a href="type_CCBV.html">CCBV</a></h1>
<pre><span class="keyword">module</span> CCBV: <code class="code"><span class="keyword">sig</span></code> <a href="CCBV.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info module top">
<h2 id="2_ImperativeBitvectors">Imperative Bitvectors</h2>
<p>
The size of the bitvector is rounded up to the multiple of 30 or 62.
In other words some functions such as <a href="CCBV.html#VALiter"><code class="code"><span class="constructor">CCBV</span>.iter</code></a> might iterate on more
bits than what was originally asked for.<br>
</div>
<hr width="100%">
<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type"></code>t</span> </pre>
<div class="info ">
A resizable bitvector<br>
</div>
<pre><span id="VALempty"><span class="keyword">val</span> empty</span> : <code class="type">unit -> <a href="CCBV.html#TYPEt">t</a></code></pre><div class="info ">
Empty bitvector<br>
</div>
<pre><span id="VALcreate"><span class="keyword">val</span> create</span> : <code class="type">size:int -> bool -> <a href="CCBV.html#TYPEt">t</a></code></pre><div class="info ">
Create a bitvector of given size, with given default value<br>
</div>
<pre><span id="VALcopy"><span class="keyword">val</span> copy</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> <a href="CCBV.html#TYPEt">t</a></code></pre><div class="info ">
Copy of bitvector<br>
</div>
<pre><span id="VALcardinal"><span class="keyword">val</span> cardinal</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> int</code></pre><div class="info ">
Number of bits set<br>
</div>
<pre><span id="VALlength"><span class="keyword">val</span> length</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> int</code></pre><div class="info ">
Length of underlying array<br>
</div>
<pre><span id="VALresize"><span class="keyword">val</span> resize</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> int -> unit</code></pre><div class="info ">
Resize the BV so that it has at least the given physical length
<code class="code">resize bv n</code> should make <code class="code">bv</code> able to store <code class="code">(<span class="constructor">Sys</span>.word_size - 2)* n</code> bits<br>
</div>
<pre><span id="VALis_empty"><span class="keyword">val</span> is_empty</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
Any bit set?<br>
</div>
<pre><span id="VALset"><span class="keyword">val</span> set</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> int -> unit</code></pre><div class="info ">
Set i-th bit.<br>
</div>
<pre><span id="VALget"><span class="keyword">val</span> get</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> int -> bool</code></pre><div class="info ">
Is the i-th bit true? Returns false if the index is too high<br>
</div>
<pre><span id="VALreset"><span class="keyword">val</span> reset</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> int -> unit</code></pre><div class="info ">
Set i-th bit to 0<br>
</div>
<pre><span id="VALflip"><span class="keyword">val</span> flip</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> int -> unit</code></pre><div class="info ">
Flip i-th bit<br>
</div>
<pre><span id="VALclear"><span class="keyword">val</span> clear</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> unit</code></pre><div class="info ">
Set every bit to 0<br>
</div>
<pre><span id="VALiter"><span class="keyword">val</span> iter</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> (int -> bool -> unit) -> unit</code></pre><div class="info ">
Iterate on all bits<br>
</div>
<pre><span id="VALiter_true"><span class="keyword">val</span> iter_true</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> (int -> unit) -> unit</code></pre><div class="info ">
Iterate on bits set to 1<br>
</div>
<pre><span id="VALto_list"><span class="keyword">val</span> to_list</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> int list</code></pre><div class="info ">
List of indexes that are true<br>
</div>
<pre><span id="VALto_sorted_list"><span class="keyword">val</span> to_sorted_list</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> int list</code></pre><div class="info ">
Same as <a href="CCBV.html#VALto_list"><code class="code"><span class="constructor">CCBV</span>.to_list</code></a>, but also guarantees the list is sorted in
increasing order<br>
</div>
<pre><span id="VALof_list"><span class="keyword">val</span> of_list</span> : <code class="type">int list -> <a href="CCBV.html#TYPEt">t</a></code></pre><div class="info ">
From a list of true bits<br>
</div>
<pre><span id="VALfirst"><span class="keyword">val</span> first</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> int</code></pre><div class="info ">
First set bit, or<br>
<b>Raises</b> <code>Not_found</code> if all bits are 0<br>
</div>
<pre><span id="VALfilter"><span class="keyword">val</span> filter</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> (int -> bool) -> unit</code></pre><div class="info ">
<code class="code">filter bv p</code> only keeps the true bits of <code class="code">bv</code> whose <code class="code">index</code>
satisfies <code class="code">p index</code><br>
</div>
<pre><span id="VALunion_into"><span class="keyword">val</span> union_into</span> : <code class="type">into:<a href="CCBV.html#TYPEt">t</a> -> <a href="CCBV.html#TYPEt">t</a> -> unit</code></pre><div class="info ">
<code class="code">union ~into bv</code> sets <code class="code">into</code> to the union of itself and <code class="code">bv</code>.<br>
</div>
<pre><span id="VALinter_into"><span class="keyword">val</span> inter_into</span> : <code class="type">into:<a href="CCBV.html#TYPEt">t</a> -> <a href="CCBV.html#TYPEt">t</a> -> unit</code></pre><div class="info ">
<code class="code">inter ~into bv</code> sets <code class="code">into</code> to the intersection of itself and <code class="code">bv</code><br>
</div>
<pre><span id="VALunion"><span class="keyword">val</span> union</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> <a href="CCBV.html#TYPEt">t</a> -> <a href="CCBV.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">union bv1 bv2</code> returns the union of the two sets<br>
</div>
<pre><span id="VALinter"><span class="keyword">val</span> inter</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> <a href="CCBV.html#TYPEt">t</a> -> <a href="CCBV.html#TYPEt">t</a></code></pre><div class="info ">
<code class="code">inter bv1 bv2</code> returns the intersection of the two sets<br>
</div>
<pre><span id="VALselect"><span class="keyword">val</span> select</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> 'a array -> 'a list</code></pre><div class="info ">
<code class="code">select arr bv</code> selects the elements of <code class="code">arr</code> whose index
corresponds to a true bit in <code class="code">bv</code>. If <code class="code">bv</code> is too short, elements of <code class="code">arr</code>
with too high an index cannot be selected and are therefore not
selected.<br>
</div>
<pre><span id="VALselecti"><span class="keyword">val</span> selecti</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> 'a array -> ('a * int) list</code></pre><div class="info ">
Same as <a href="CCBV.html#VALselect"><code class="code"><span class="constructor">CCBV</span>.select</code></a>, but selected elements are paired with their index<br>
</div>
<pre><span id="TYPEsequence"><span class="keyword">type</span> <code class="type">'a</code> sequence</span> = <code class="type">('a -> unit) -> unit</code> </pre>
<pre><span id="VALto_seq"><span class="keyword">val</span> to_seq</span> : <code class="type"><a href="CCBV.html#TYPEt">t</a> -> int <a href="CCBV.html#TYPEsequence">sequence</a></code></pre>
<pre><span id="VALof_seq"><span class="keyword">val</span> of_seq</span> : <code class="type">int <a href="CCBV.html#TYPEsequence">sequence</a> -> <a href="CCBV.html#TYPEt">t</a></code></pre>
<pre><span id="VALprint"><span class="keyword">val</span> print</span> : <code class="type">Format.formatter -> <a href="CCBV.html#TYPEt">t</a> -> unit</code></pre><div class="info ">
Print the bitvector as a string of bits<br>
<b>Since</b> 0.13<br>
</div>
</body></html>