<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://qetlab.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Vec_partitions</id>
	<title>Vec partitions - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://qetlab.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Vec_partitions"/>
	<link rel="alternate" type="text/html" href="https://qetlab.com/wiki/index.php?title=Vec_partitions&amp;action=history"/>
	<updated>2026-08-24T18:57:53Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://qetlab.com/wiki/index.php?title=Vec_partitions&amp;diff=505&amp;oldid=prev</id>
		<title>Nathaniel: Created page with &quot;{{Function |name=vec_partitions |desc=Produces all possible partitions of a vector |cat=Helper functions |upd=October 18, 2014 |v=0.50 |...&quot;</title>
		<link rel="alternate" type="text/html" href="https://qetlab.com/wiki/index.php?title=Vec_partitions&amp;diff=505&amp;oldid=prev"/>
		<updated>2014-10-18T23:49:33Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Function |name=vec_partitions |desc=Produces all possible partitions of a vector |cat=&lt;a href=&quot;/List_of_functions#Helper_functions&quot; title=&quot;List of functions&quot;&gt;Helper functions&lt;/a&gt; |upd=October 18, 2014 |v=0.50 |...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Function&lt;br /&gt;
|name=vec_partitions&lt;br /&gt;
|desc=Produces all possible partitions of a vector&lt;br /&gt;
|cat=[[List of functions#Helper_functions|Helper functions]]&lt;br /&gt;
|upd=October 18, 2014&lt;br /&gt;
|v=0.50&lt;br /&gt;
|helper=1}}&lt;br /&gt;
&amp;lt;tt&amp;gt;&amp;#039;&amp;#039;&amp;#039;vec_partitions&amp;#039;&amp;#039;&amp;#039;&amp;lt;/tt&amp;gt; is a [[List of functions|function]] that returns all partitions a given vector into a specified number of parts. Note that, for this function, the order of the parts does matter, but the order of the elements within the parts does not matter (for example, when partitioning the vector &amp;lt;tt&amp;gt;[1,2,3,4]&amp;lt;/tt&amp;gt;, the partition &amp;lt;tt&amp;gt;{[1],[2,3,4]}&amp;lt;/tt&amp;gt; is the same as &amp;lt;tt&amp;gt;{[1],[3,2,4]}&amp;lt;/tt&amp;gt;, but distinct from &amp;lt;tt&amp;gt;{[2,3,4],[1]}&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
* &amp;lt;tt&amp;gt;PT = vec_partitions(V,P)&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;PT = vec_partitions(V,P,SZ)&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Argument descriptions==&lt;br /&gt;
* &amp;lt;tt&amp;gt;V&amp;lt;/tt&amp;gt;: A vector to be partitioned.&lt;br /&gt;
* &amp;lt;tt&amp;gt;P&amp;lt;/tt&amp;gt;: A positive integer: the number of parts to partition &amp;lt;tt&amp;gt;P&amp;lt;/tt&amp;gt; into.&lt;br /&gt;
* &amp;lt;tt&amp;gt;SZ&amp;lt;/tt&amp;gt; (optional, default &amp;lt;tt&amp;gt;[1,1,...,1]&amp;lt;/tt&amp;gt;): A vector such that only the partitions with the property that the j-th part contains at least &amp;lt;tt&amp;gt;SZ(j)&amp;lt;/tt&amp;gt; elements (for all j) are returned.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
The following code generates all 14 partitions of the vector &amp;lt;tt&amp;gt;[1,2,3,4]&amp;lt;/tt&amp;gt; into two parts. It then displays two of those partitions (the first and sixth).&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; pt = vec_partitions(1:4,2);&lt;br /&gt;
&amp;gt;&amp;gt; length(pt)&lt;br /&gt;
&lt;br /&gt;
ans =&lt;br /&gt;
&lt;br /&gt;
    14&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; celldisp(pt{1})&lt;br /&gt;
 &lt;br /&gt;
ans{1} =&lt;br /&gt;
 &lt;br /&gt;
     1&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
ans{2} =&lt;br /&gt;
 &lt;br /&gt;
     2     3     4&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;gt;&amp;gt; celldisp(pt{6})&lt;br /&gt;
 &lt;br /&gt;
ans{1} =&lt;br /&gt;
 &lt;br /&gt;
     1     3&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
ans{2} =&lt;br /&gt;
 &lt;br /&gt;
     2     4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{SourceCode|name=vec_partitions|helper=1}}&lt;/div&gt;</summary>
		<author><name>Nathaniel</name></author>
	</entry>
</feed>