<ahref="#pub-methods">Public Member Functions</a>|
<ahref="classoperations__research_1_1SparsePermutation-members.html">List of all members</a></div>
<divclass="headertitle">
<divclass="title">operations_research::SparsePermutation Class Reference</div></div>
</div><!--header-->
<divclass="contents">
<p>A compact representation for permutations of {0..N-1} that displaces few elements: it needs only O(K) memory for a permutation that displaces K elements.
<trclass="memitem:a0b05b1e840388f9aba5bbe79a392d7d6"><tdclass="memItemLeft"align="right"valign="top">const std::vector< int >& </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classoperations__research_1_1SparsePermutation.html#a0b05b1e840388f9aba5bbe79a392d7d6">Support</a> () const</td></tr>
<trclass="memdesc:a0b05b1e840388f9aba5bbe79a392d7d6"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the "support" of this permutation; that is, the set of elements displaced by it. <ahref="#a0b05b1e840388f9aba5bbe79a392d7d6">More...</a><br/></td></tr>
<trclass="memdesc:a9fc0ca5752b5ad6cc2a78ff7c512b22a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">This is useful for iterating over the pair {element, image} of a permutation: <ahref="#a9fc0ca5752b5ad6cc2a78ff7c512b22a">More...</a><br/></td></tr>
<trclass="memdesc:ac1e64e1e738964d338be3cac2b2a58fd"><tdclass="mdescLeft"> </td><tdclass="mdescRight">To add a cycle to the permutation, repeatedly call <aclass="el"href="classoperations__research_1_1SparsePermutation.html#ac1e64e1e738964d338be3cac2b2a58fd"title="To add a cycle to the permutation, repeatedly call AddToCurrentCycle() with the cycle's orbit,...">AddToCurrentCycle()</a> with the cycle's orbit, then call <aclass="el"href="classoperations__research_1_1SparsePermutation.html#ac1e42a48198d2abc8642d81f6b846fee">CloseCurrentCycle()</a>; This shouldn't be called on trivial cycles (of length 1). <ahref="#ac1e64e1e738964d338be3cac2b2a58fd">More...</a><br/></td></tr>
<trclass="memitem:abca48ca404a02f35f06f295814407100"><tdclass="memItemLeft"align="right"valign="top">void </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classoperations__research_1_1SparsePermutation.html#abca48ca404a02f35f06f295814407100">RemoveCycles</a> (const std::vector< int >&cycle_indices)</td></tr>
<trclass="memdesc:abca48ca404a02f35f06f295814407100"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Removes the cycles with given indices from the permutation. <ahref="#abca48ca404a02f35f06f295814407100">More...</a><br/></td></tr>
<trclass="memdesc:a6886dcada3acf697af20e88ce32a7ae1"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Output all non-identity cycles of the permutation, sorted lexicographically (each cycle is described starting by its smallest element; and all cycles are sorted lexicographically against each other). <ahref="#a6886dcada3acf697af20e88ce32a7ae1">More...</a><br/></td></tr>
<divclass="textblock"><p>A compact representation for permutations of {0..N-1} that displaces few elements: it needs only O(K) memory for a permutation that displaces K elements. </p>
<pclass="definition">Definition at line <aclass="el"href="sparse__permutation_8h_source.html#l00027">27</a> of file <aclass="el"href="sparse__permutation_8h_source.html">sparse_permutation.h</a>.</p>
</div><h2class="groupheader">Constructor & Destructor Documentation</h2>
<pclass="definition">Definition at line <aclass="el"href="sparse__permutation_8h_source.html#l00029">29</a> of file <aclass="el"href="sparse__permutation_8h_source.html">sparse_permutation.h</a>.</p>
</div>
</div>
<h2class="groupheader">Member Function Documentation</h2>
<p>To add a cycle to the permutation, repeatedly call <aclass="el"href="classoperations__research_1_1SparsePermutation.html#ac1e64e1e738964d338be3cac2b2a58fd"title="To add a cycle to the permutation, repeatedly call AddToCurrentCycle() with the cycle's orbit,...">AddToCurrentCycle()</a> with the cycle's orbit, then call <aclass="el"href="classoperations__research_1_1SparsePermutation.html#ac1e42a48198d2abc8642d81f6b846fee">CloseCurrentCycle()</a>; This shouldn't be called on trivial cycles (of length 1). </p>
<pclass="definition">Definition at line <aclass="el"href="sparse__permutation_8h_source.html#l00084">84</a> of file <aclass="el"href="sparse__permutation_8h_source.html">sparse_permutation.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="sparse__permutation_8h_source.html#l00090">90</a> of file <aclass="el"href="sparse__permutation_8h_source.html">sparse_permutation.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="sparse__permutation_8h_source.html#l00117">117</a> of file <aclass="el"href="sparse__permutation_8h_source.html">sparse_permutation.h</a>.</p>
<p>Output all non-identity cycles of the permutation, sorted lexicographically (each cycle is described starting by its smallest element; and all cycles are sorted lexicographically against each other). </p>
<p>This isn't efficient; use for debugging only. Example: "(1 4 3) (5 9) (6 8 7)". </p>
<p>This is useful for iterating over the pair {element, image} of a permutation: </p>
<p>for (int c = 0; c < perm.NumCycles(); ++c) { int element = LastElementInCycle(c); for (int image : perm.Cycle(c)) { ///< The pair is (element, image). ... element = image; } }</p>
<dlclass="todo"><dt><b><aclass="el"href="todo.html#_todo000013">Todo:</a></b></dt><dd>(user): Provide a full iterator for this? Note that we have more information with the loop above. Not sure it is needed though. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="sparse__permutation_8h_source.html#l00124">124</a> of file <aclass="el"href="sparse__permutation_8h_source.html">sparse_permutation.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="sparse__permutation_8h_source.html#l00033">33</a> of file <aclass="el"href="sparse__permutation_8h_source.html">sparse_permutation.h</a>.</p>
<dlclass="todo"><dt><b><aclass="el"href="todo.html#_todo000012">Todo:</a></b></dt><dd>(user,user): complete the reader API. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="sparse__permutation_8h_source.html#l00032">32</a> of file <aclass="el"href="sparse__permutation_8h_source.html">sparse_permutation.h</a>.</p>
<p>Returns the "support" of this permutation; that is, the set of elements displaced by it. </p>
<pclass="definition">Definition at line <aclass="el"href="sparse__permutation_8h_source.html#l00037">37</a> of file <aclass="el"href="sparse__permutation_8h_source.html">sparse_permutation.h</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>