Partition representations: Difference between revisions

Jump to navigation Jump to search
m
Line 135: Line 135:
</source>
</source>
{{Works in|[[J]]}}
{{Works in|[[J]]}}
Here <source lang=j inline>-.</source> is [[Negate]], <source lang=j inline><</source> is [[Box]], and <source lang=j inline>;._1</source> uses the Cut operator <source lang=j inline>;.</source> with dropped initial elements.
Here <source lang=j inline>-.</source> is [[Not]], <source lang=j inline><</source> is [[Box]], and <source lang=j inline>;._1</source> uses the Cut operator <source lang=j inline>;.</source> with dropped initial elements.


The [[Boolean]] control vector used by Mesh serves as another way to represent partitions. Unlike the case with [[Partitioned Enclose]], a Boolean vector here is sufficient to represent any partition including those with empty divisions. This is possible because of the vector's increased length: while Partitioned Enclose uses only one Boolean for each element in the partitioned vector, the mesh vector has a 1 for each element in the partitioned vector as well as a 0 for each divider.
The [[Boolean]] control vector used by Mesh serves as another way to represent partitions. Unlike the case with [[Partitioned Enclose]], a Boolean vector here is sufficient to represent any partition including those with empty divisions. This is possible because of the vector's increased length: while Partitioned Enclose uses only one Boolean for each element in the partitioned vector, the mesh vector has a 1 for each element in the partitioned vector as well as a 0 for each divider.
Line 146: Line 146:
1 1 1 0 0 1 0 1 1 0
1 1 1 0 0 1 0 1 1 0
</source>
</source>
In the above functions, the only difference in code is exchanging 0 and 1, and the only difference in output is an extra trailing 0 when computed from the division lengths. The mesh representation makes the partition representation duality especially clear, as the dual representation can be obtained simply by [[Negate|negating]] the mesh vector.
In the above functions, the only difference in code is exchanging 0 and 1, and the only difference in output is an extra trailing 0 when computed from the division lengths. The mesh representation makes the partition representation duality especially clear, as the dual representation can be obtained simply by [[Not|negating]] the mesh vector.

Navigation menu