manual_Permutation.cpp 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. /* manual_Permutation.cpp
  2. *
  3. * Copyright (C) 2005-2018 David Weenink
  4. *
  5. * This code is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This code is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /*
  19. 20050709 djmw
  20. */
  21. #include "ManPagesM.h"
  22. void manual_Permutation_init (ManPages me);
  23. void manual_Permutation_init (ManPages me)
  24. {
  25. MAN_BEGIN (U"Permutation", U"djmw", 20050721)
  26. INTRO (U"One of the @@types of objects@ in Praat. A Permutation object with %n elements consists of some ordering of "
  27. "the numbers 1,2...%n.")
  28. ENTRY (U"Interpretation")
  29. NORMAL (U"A permutation like for example (2,3,5,4,1) is an %arrangement of the five objects 1, 2, 3, 4, and 5. "
  30. "It tells us that the second object is in the first position, the third object is in the second position, "
  31. "the fifth object in the third position and so on.")
  32. NORMAL (U"If we combine a Permutation together with an other object, like a Strings for example, we may force a "
  33. "new arrangement of the strings, according to the specification in the Permutation (see @@Strings & Permutation: Permute strings@)." )
  34. ENTRY (U"Commands")
  35. NORMAL (U"Creation:")
  36. LIST_ITEM (U"\\bu @@Create Permutation...@")
  37. NORMAL (U"Query:")
  38. LIST_ITEM (U"\\bu ##Get number of elements#")
  39. LIST_ITEM (U"\\bu @@Permutation: Get value...|Get value...@")
  40. LIST_ITEM (U"\\bu @@Permutation: Get index...|Get index...@")
  41. NORMAL (U"Modification:")
  42. LIST_ITEM (U"\\bu @@Permutation: Sort|Sort@")
  43. LIST_ITEM (U"\\bu @@Permutation: Swap blocks...|Swap blocks...@")
  44. LIST_ITEM (U"\\bu @@Permutation: Swap positions...|Swap positions...@")
  45. LIST_ITEM (U"\\bu @@Permutation: Swap numbers...|Swap numbers...@")
  46. LIST_ITEM (U"\\bu @@Permutation: Swap one from range...|Swap one from range...@")
  47. NORMAL (U"Permutations:")
  48. LIST_ITEM (U"\\bu @@Permutation: Permute randomly...|Permute randomly...@")
  49. LIST_ITEM (U"\\bu @@Permutation: Permute randomly (blocks)...|Permute randomly (blocks)...@")
  50. LIST_ITEM (U"\\bu @@Permutation: Interleave...|Interleave...@")
  51. LIST_ITEM (U"\\bu @@Permutation: Rotate...|Rotate...@")
  52. LIST_ITEM (U"\\bu @@Permutation: Reverse...|Reverse...@")
  53. LIST_ITEM (U"\\bu @@Permutation: Invert|Invert@")
  54. NORMAL (U"Successive permutations:")
  55. LIST_ITEM (U"\\bu @@Permutations: Multiply|Multiply@")
  56. ENTRY (U"Usage")
  57. LIST_ITEM (U"@@Strings & Permutation: Permute strings@ to rearrange the strings in a Strings object.")
  58. LIST_ITEM (U"@@TableOfReal & Permutation: Permute rows@ to rearrange the rows in a TableOfReal object.")
  59. MAN_END
  60. MAN_BEGIN (U"Create Permutation...", U"djmw", 20050709)
  61. INTRO (U"A command to create a @Permutation of the numbers 1,2, ..., %numberOfElements.")
  62. ENTRY (U"Settings")
  63. TAG (U"##Name")
  64. DEFINITION (U"the name of the new permutation.")
  65. TAG (U"##Number of elements%")
  66. DEFINITION (U"the number of elements in the permutation.")
  67. TAG (U"##Identity permutation")
  68. DEFINITION (U"determines whether the permution will be a randomly chosen one, or the @@identity permutation@.")
  69. MAN_END
  70. MAN_BEGIN (U"identity permutation", U"djmw", 20050713)
  71. INTRO (U"The identity permutation is (1,2,3,...,%numberOfElements), i.e. the numbers 1 to "
  72. "%numberOfElements in their natural order. ")
  73. MAN_END
  74. MAN_BEGIN (U"Permutation: Get value...", U"djmw", 20050709)
  75. INTRO (U"Get the value at the index position.")
  76. ENTRY (U"Example")
  77. NORMAL (U"The query for the value at index 3 for the permutation (3,2,4,5,1) gives 4.")
  78. MAN_END
  79. MAN_BEGIN (U"Permutation: Get index...", U"djmw", 20050714)
  80. INTRO (U"Get the index position of the value. ")
  81. ENTRY (U"Example")
  82. NORMAL (U"The query for the index of value 3 for the permutation (3,2,4,5,1) gives 1.")
  83. MAN_END
  84. MAN_BEGIN (U"Permutation: Table jump...", U"djmw", 20180228)
  85. INTRO (U"Reorder by jumping columnwise to next row over the permutation indices layed out like a table. ")
  86. ENTRY (U"Settings")
  87. TAG (U"##Jump size#")
  88. DEFINITION (U"defines how many indices to jump over, i.e. the number of columns in the \"table\".")
  89. TAG (U"##First#")
  90. DEFINITION (U"The first new position.")
  91. ENTRY (U"Example 1")
  92. NORMAL (U"Consider the identity permutation of 14 elements layed out like a table with %%jumpSize% = 4 columns.")
  93. CODE (U" 1 2 3 4")
  94. CODE (U" 5 6 7 8")
  95. CODE (U" 9 10 11 12")
  96. CODE (U"13 14")
  97. NORMAL (U"1. ##Table jump: 4, 1# will result in the permutation (1, 5. 9, 13, 2, 6, 10, 14, 3, 7, 11, 4, 8, 12)")
  98. NORMAL (U"2. ##Table jump: 4, 2# will result in the permutation (2, 6, 10, 14, 3, 7, 11, 4, 8, 12, 1, 5. 9, 13)")
  99. NORMAL (U"3. ##Table jump: 4, 5# will result in the permutation (5. 9, 13, 2, 6, 10, 14, 3, 7, 11, 4, 8, 12, 1)")
  100. NORMAL (U"4. ##Table jump: 4, 12# will result in the permutation (12, 1, 5. 9, 13, 2, 6, 10, 14, 3, 7, 11, 4, 8)")
  101. ENTRY (U"Example 2")
  102. NORMAL (U"Consider the identity permutation of 14 elements layed out like a table with %%jumpSize% = 7 columns.")
  103. CODE (U" 1 2 3 4 5 6 7")
  104. CODE (U" 8 9 10 11 12 13 14")
  105. NORMAL (U"1. ##Table jump: 7, 1# will result in the permutation (1, 8, 2, 9, 3, 10, 4, 11, 5, 12, 6, 13, 7, 14)")
  106. MAN_END
  107. MAN_BEGIN (U"Permutation: Reverse...", U"djmw", 20110105)
  108. INTRO (U"Reverse the elements in the given range.")
  109. ENTRY (U"Setting")
  110. TAG (U"##Index range#")
  111. DEFINITION (U"defines the range of indices that will be reversed.")
  112. ENTRY (U"Examples")
  113. NORMAL (U"1. With ##Index range# = [0,0], the permutation (1,2,3,4,5) is turned into (5,4,3,2,1). ")
  114. NORMAL (U"2. With ##Index range# = [3,0], the permutation (1,2,3,4,5) is turned into (1,2,5,4,3). ")
  115. MAN_END
  116. MAN_BEGIN (U"Permutation: Swap one from range...", U"djmw", 20110105)
  117. INTRO (U"An element at an index, randomly chosen from a range, will be permuted with an element at a prescribed index position.")
  118. ENTRY (U"Settings")
  119. TAG (U"##Index range#")
  120. DEFINITION (U"defines the range of indices from which one will be randomly chosen.")
  121. TAG (U"##Index#")
  122. DEFINITION (U"defines the special index position whose element will be interchanged with the one chosen from the range.")
  123. TAG (U"##Forbid same")
  124. DEFINITION (U"when %on, forbids the randomly chosen position and the index position to be the same. "
  125. "This switch is only of relevance when the chosen range happens to overlap the index position.")
  126. ENTRY (U"Examples")
  127. NORMAL (U"With ##Index range# = [0,0], ##Index# = 3, ##Forbid same# is %off and (1,2,3,4,5) as the starting permutation, the outcome might be one of "
  128. "the five permutations (3,2,1,4,5), (1,3,2,4,5), (1,2,3,4,5), (1,2,4,3,5), (1,2,5,4,3). If ##Forbid same# were chosen as %on, the "
  129. "(1,2,3,4,5) permutation is forbidden and the outcome could only be one of the four remaining permutations.")
  130. MAN_END
  131. MAN_BEGIN (U"Permutation: Permute randomly...", U"djmw", 20111123)
  132. INTRO (U"Generates a new @@Permutation@ by randomly permuting a range of elements in the selected Permutation object.")
  133. ENTRY (U"Setting")
  134. TAG (U"##Index range#")
  135. DEFINITION (U"defines the range of elements that will be permuted. The elements outside this range will be kept intact.")
  136. ENTRY (U"Example")
  137. NORMAL (U"If we start with the permutation (4,6,3,1,5,2,7) and a chosen ##Index range# that runs from 3 to 6, a new permutation will be generated as follows:")
  138. LIST_ITEM (U"1. A new permutation of the same dimension as the selected one will be created. ")
  139. LIST_ITEM (U"2. Because the index range starts at 3, the first two elements of the selected permutation will be copied "
  140. "to the first two locations in the newly created permutation. The new permutation is now (4,6,.,.,.,.,.), where a "
  141. "dot (.) means that the element is unspecified.")
  142. LIST_ITEM (U"3. The elements 3 to 6 of the selected permutation, i.e. the numbers (3,1,5,2) will be randomly permuted. "
  143. "There are 24 possible permutations of these 4 numbers. Say the outcome happens to be (5,1,3,2). The new permutation is now (4,6,5,1,3,2,.).")
  144. LIST_ITEM (U"4. The remaining element (7) is copied to the new permutation. Finally, this results "
  145. "in the new permutation being (4,6,5,1,3,2,7).")
  146. MAN_END
  147. MAN_BEGIN (U"Permutation: Permute randomly (blocks)...", U"djmw", 20110105)
  148. INTRO (U"Generates a new @Permutation by randomly permuting blocks of size %blocksize.")
  149. ENTRY (U"Settings")
  150. TAG (U"##Index range#")
  151. DEFINITION (U"the range of elements whose blocks will be permuted.")
  152. TAG (U"##Block size#")
  153. DEFINITION (U"the size of the blocks that will be permuted. There must fit an integer number of blocks "
  154. "in the chosen range.")
  155. TAG (U"##Permute within blocks#")
  156. DEFINITION (U"when %on, the elements in each block are also randomly permuted.")
  157. TAG (U"##No doublets#")
  158. DEFINITION (U"guarantees that the first element in each block does not equal the last element of the previous block modulo "
  159. "the block size. E.g. the numbers 3, 6, 9 are all equal modulo 3. "
  160. "This parameter only has effect when ##Permute within blocks# is %on.")
  161. ENTRY (U"Examples")
  162. NORMAL (U"1. With ##Index range# = [0,0], ##Block size# = 3 and ##Permute within blocks# is %off, the permutation ((1,2,3),(4,5,6),(7,8,9)) "
  163. "is turned into one of six possible permutations, for example into ((4,5,6),(7,8,9),(1,2,3)). (The option ##No doublets# will be ignored and the parentheses are only there to indicate the blocks.)")
  164. NORMAL (U"2. With ##Index range# = [0,0], ##Block size# = 3, ##Permute within blocks# is %on and ##No doublets# is %off, "
  165. "the permutation ((1,2,3),(4,5,6),(7,8,9)) might turn into ((5,4,6),(9,8,7),(3,1,2)).")
  166. NORMAL (U"3. With the same options as 2 but ##No doublets# is %on, the previously given outcome is forbidden because "
  167. "the last element of the first block (6) and the first element of the next block (9) are equal modulo 3 (the "
  168. "blocksize). A valid outcome might then be ((5,4,6),(8,9,7),(3,1,2)).")
  169. MAN_END
  170. MAN_BEGIN (U"Permutation: Swap blocks...", U"djmw", 20110105)
  171. INTRO (U"A command to swap the contents of two index ranges in the selected @Permutation.")
  172. ENTRY (U"Settings")
  173. TAG (U"##From index#, ##To index#")
  174. DEFINITION (U"the two starting positions from where elements are to be swapped. The blocks may overlap.")
  175. TAG (U"##Block size#")
  176. DEFINITION (U"determines the number of pairs to swap. ")
  177. ENTRY (U"Behaviour")
  178. NORMAL (U"If the ##Block size# equals one, only the elements at the ##From index# and ##To index# position are swapped. If blocksize is greater than one, the two elements at ##From index#+1 and ##To index#+1 will be swapped too. This goes on until the last two elements in each block have been swapped.")
  179. ENTRY (U"Examples")
  180. NORMAL (U"1. Swap two blocks: with ##From index# = 1, ##To index# = 4, and ##Block size# = 2, the permutation (1,2,3,4,5) is turned into (4,5,3,1,2).")
  181. NORMAL (U"2. Swap two elements: with ##From index# = 1, ##To index# = 4, and ##Block size# = 1, the permutation (1,2,3,4,5) is turned into (4,2,3,1,5).")
  182. NORMAL (U"3. Swap two overlapping blocks: with ##From index# = 1, ##To index# = 3, and ##Block size# = 3, the permutation (1,2,3,4,5) is turned into "
  183. "(3,4,5,2,1).")
  184. MAN_END
  185. MAN_BEGIN (U"Permutation: Swap positions...", U"djmw", 20110105)
  186. INTRO (U"Swaps the contents at two indices in the selected @@Permutation@.")
  187. ENTRY (U"Settings")
  188. TAG (U"##First index#, ##Second index#")
  189. DEFINITION (U"the two indices from where elements have to be swapped. The order of these indices is not important.")
  190. ENTRY (U"Example")
  191. NORMAL (U"With ##First index# = 1 and ##Second index# = 3, the permutation (1,3,4,2,5) is turned into (4,3,1,2,5).")
  192. MAN_END
  193. MAN_BEGIN (U"Permutation: Swap numbers...", U"djmw", 20110105)
  194. INTRO (U"Swaps two numbers in the selected @@Permutation@.")
  195. ENTRY (U"Settings")
  196. TAG (U"##First number#, ##Second number#")
  197. DEFINITION (U"the two numbers that have to be swapped. The order of these numbers is not important.")
  198. ENTRY (U"Example")
  199. NORMAL (U"With ##First number# = 1 and ##Second number# = 3, the permutation (1,3,4,2,5) is turned into (3,1,4,2,5).")
  200. MAN_END
  201. MAN_BEGIN (U"Permutation: Interleave...", U"djmw", 20110105)
  202. INTRO (U"Generates a new @Permutation by interleaving elements from successive blocks. ")
  203. NORMAL (U"We always start with the first element in the first block. When the offset is zero, the next element will be the first "
  204. "element of the second block, then the first element of the third block. After the first element of the last block, we start again "
  205. "with the second elements in each block. And so on. (In card playing, with two blocks of 26 cards each, this is called a faro "
  206. "shuffle and eight successive faro shuffles will return the deck to precisely the order in which you began.)")
  207. NORMAL (U"If the offset differs from zero and equals 1 for example, we start with the first element in the first block, then the "
  208. "second element in the second block, the third element in the third block and so on. When the last element of a block is reached "
  209. "and the number of blocks is not exhausted the next element will be the first from the next block. When the last block is reached, "
  210. "we start the same cycle again with the next lower element in the first block (which by the way need not be the second element, "
  211. "see also example 4).")
  212. ENTRY (U"Settings")
  213. TAG (U"##Index range#")
  214. DEFINITION (U"the range of elements that will be permuted.")
  215. TAG (U"##Block size#")
  216. DEFINITION (U"the size of a block. An integer number of blocks must fit "
  217. "in the chosen ##Index range#.")
  218. TAG (U"##Offset#")
  219. DEFINITION (U"determines the relative positions of selected elements in successive blocks.")
  220. ENTRY (U"Examples")
  221. NORMAL (U"1. With ##Index range# = [0,0], ##Block size# = 3, and ##Offset# = 0, the permutation ((1,2,3),(4,5,6),(7,8,9)) is turned into (1,4,7,2,5,8,3,6,9).")
  222. NORMAL (U"2. With ##Index range# = [0,0], ##Block size# = 3, and ##Offset# = 1, the permutation ((1,2,3),(4,5,6),(7,8,9)) is turned into (1,5,9,2,6,7,3,4,8).")
  223. NORMAL (U"3. With ##Index range# = [0,0], ##Block size# = 3, and ##Offset# = 2, the permutation ((1,2,3),(4,5,6),(7,8,9)) is turned into (1,6,8,2,4,9,3,5,7).")
  224. NORMAL (U"4. With ##Index range# = [0,0], ##Block size# = 4, and ##Offset# = 1, the permutation ((1,2,3,4),(5,6,7,8)) is turned into (1,6,3,8,2,7,4,5).")
  225. MAN_END
  226. MAN_BEGIN (U"lexicographic permutation order", U"djmw", 20140131)
  227. INTRO (U"We can order the %n numbers 1, 2, 3,..., n in %n! different ways. Each of these n! orderings represents a different permutation of "
  228. "the numbers 1, 2, 3,..., n. For example, if %n equals 3 we have 6 (=3\\.c2\\.c1) possible orderings: (1,2,3), (1,3,2), (2,1,3), (2,3,1), (3,1,2) and (3,2,1). "
  229. "The %%lexicographic permutation order% starts from the identity permutation (1,2,..., n). By successively swapping only two numbers one "
  230. "obtains all possible permutations. The last permutation in lexicographic order will be the permutation with all numbers in reversed order, "
  231. "i.e. (n,n-1,...,2,1). The example given above has all 6 permutations in lexicographic permutation order.")
  232. MAN_END
  233. MAN_BEGIN (U"Permutation: Next", U"djmw", 20140131)
  234. INTRO (U"Get the next @@Permutation|permutation@ in @@lexicographic permutation order@. ")
  235. NORMAL (U"The next permutation is obtained from the selected permutation "
  236. "by swapping values %%at only two positions%. Starting with the identity permutation and "
  237. "repeatedly applying this function will iterate through all possible permutations. If no further permutation "
  238. "is available, i.e. the selected permutation is at the lexicographic end position (n, n-1, ..., 3, 2, 1), the current permutation will not change anymore. ")
  239. ENTRY (U"Examples")
  240. NORMAL (U"If we start with (1,2,3,4) successively applying ##Next# will generate the following sequence (1,2,4,3), (1,3,2,4), (1,3,4,2), (1,4,2,3), (1,4,3,2), etc.")
  241. MAN_END
  242. MAN_BEGIN (U"Permutation: Previous", U"djmw", 20140131)
  243. NORMAL (U"Get the previous @@Permutation|permutation@ in @@lexicographic permutation order@. The previous permutation is obtained "
  244. "from the selected permutation by swapping values %%at only two positions%. If no further permutation "
  245. "is available, i.e. the current permutation is at the lexicographic start position (1, 2, 3, ..., n-1, n), the current permutation will not change anymore. ")
  246. NORMAL (U"The ##Previous# operation follows the opposite order of @@Permutation: Next@.")
  247. MAN_END
  248. MAN_BEGIN (U"Permutation: Rotate...", U"djmw", 20110105)
  249. INTRO (U"A circular shift of all elements within the given range.")
  250. ENTRY (U"Settings")
  251. TAG (U"##Index range#")
  252. DEFINITION (U"the range of elements that will be circularly permuted.") // ambiguous; are these the positions or the numbers?
  253. TAG (U"##Step size#")
  254. DEFINITION (U"define how many positions each element will be shifted.")
  255. ENTRY (U"Examples")
  256. NORMAL (U"1. With ##Step size# = 2 and ##Index range# = [1,5], the permutation (1,2,3,4,5) is turned into (4,5,1,2,3). ")
  257. NORMAL (U"2. With ##Step size# = 2 and ##Index range# = [2,5], the permutation ((1),(2,3,4,5)) is turned into ((1),(4,5,2,3))")
  258. NORMAL (U"3. With ##Step size# = -1 and ##Index range# = [0,0], the permutation (1,2,3,4,5) is turned into (2,3,4,5,1).")
  259. MAN_END
  260. MAN_BEGIN (U"Permutation: Invert", U"djmw", 20050709)
  261. INTRO (U"Generates the inverse of the selected @Permutation.")
  262. ENTRY (U"Example")
  263. NORMAL (U"If the permutation is (1,5,3,2,4) the inverse will be (1,4,3,5,2). If we @@Permutations: Multiply|multiply@ these two permutations the result will be the identity permutation (1,2,3,4,5).")
  264. MAN_END
  265. MAN_BEGIN (U"Permutations: Multiply", U"djmw", 20050717)
  266. INTRO (U"Apply the selected @@Permutation@s one after the other. ")
  267. NORMAL (U"Permutations are %not commutative, i.e. applying permutation %p__1_ after %p__2_ might not give the same outcome as applying "
  268. "%p__2_ after %p__1_.")
  269. MAN_END
  270. MAN_BEGIN (U"Permutation: Sort", U"djmw", 20050709)
  271. INTRO (U"Sorts the elements ascending, i.e. set the selected @@Permutation@ to the @@identity permutation@.")
  272. MAN_END
  273. MAN_BEGIN (U"TableOfReal & Permutation: Permute rows", U"djmw", 20050709)
  274. INTRO (U"Generate a new @TableOfReal with a row ordering determined by the @Permutation.")
  275. ENTRY (U"Example")
  276. NORMAL (U"If the selected TableOfReal has 5 rows and the permutation is (5,4,3,2,1) the first row of the new TableOfReal equals the fifth row of the selected, the second row of new equals the fourth row of the selected and so on.")
  277. MAN_END
  278. MAN_BEGIN (U"Strings & Permutation: Permute strings", U"djmw", 20140130)
  279. INTRO (U"Generate a new @Strings with a strings ordering determined by the @Permutation.")
  280. NORMAL (U"The number of strings in the #Strings and the number of elements in the #Permutation have to be equal.")
  281. ENTRY (U"Examples")
  282. NORMAL (U"1. If the selected Strings has the 4 strings ordered as \"heed\", \"hid\", \"hood\", \"hud\", and the permutation is "
  283. "(4,3,2,1), the new Strings has the ordering \"hud\", \"hood\", \"hid\", \"heed\".")
  284. NORMAL (U"2. In the example that is discussed in the @@ExperimentMFC|listening experiment@ section, we have four stimuli \"heed.wav\", "
  285. "\"hid.wav\", \"hood.wav\", \"hud.wav\" that we want to present three times to each subject with a <PermuteBalancedNoDoublets> "
  286. "randomization strategy, i.e. stimuli presented in blocks of four, randomized, and no two successive stimuli equal. "
  287. "This type of randomization can easily be accomplished with a Permutation object and a Strings." )
  288. LIST_ITEM (U"1. Fill the Strings object with 12 strings, i.e. three repetitions of the four stimuli. ")
  289. LIST_ITEM (U"2. Create a Permutation object with 12 elements and perform ##@@Permutation: Permute randomly (blocks)...|Permute randomly (blocks):@ 0, 0, 4, \"yes\", \"yes\"#. We randomly permute blocks of size 4 and permute randomly within these blocks and make sure that on the transition from on block to the other no two stimuli are equal. (Of course, the random permutation of the blocks makes no difference here since all the blocks have the same content.)")
  290. LIST_ITEM (U"3. Select the Strings and the Permutation together and choose ##Permute strings#. "
  291. "Now the new Strings will contain the new ordering of the stimuli.")
  292. MAN_END
  293. MAN_BEGIN (U"Strings: To Permutation...", U"djmw", 20050721)
  294. INTRO (U"Generates a @Permutation with the same number of elements as the @Strings.")
  295. ENTRY (U"Setting")
  296. TAG (U"##Sort")
  297. DEFINITION (U"determines whether the Permutation will have an element ordering that can be used to sort the Strings alphabetically.")
  298. ENTRY (U"Example")
  299. NORMAL (U"If \"Sort\" is %on, and the selected Strings contains 4 strings ordered as \"hud\", \"hid\", \"hood\", "
  300. "\"heed\", the generated Permutation will be (4,2,3,1). If you now select the String and the Permutation "
  301. "together and choose @@Strings & Permutation: Permute strings|Permute strings@, the new Strings will have "
  302. "the strings ordered alphabetically as \"heed\", \"hid\", \"hood\", \"hud\". "
  303. "You can also sort the Strings alphabetically descending, by first @@Permutation: Reverse...|reversing@ "
  304. "the elements in the Permutation before you select the Permutation and the Strings together. ")
  305. MAN_END
  306. MAN_BEGIN (U"Index", U"djmw", 20050725)
  307. INTRO (U"One of the @@Types of objects|types of objects@ in the P\\s{RAAT} program.")
  308. MAN_END
  309. MAN_BEGIN (U"Strings: To Index", U"djmw", 20050721)
  310. INTRO (U"Generates an @Index from the selected @Strings.")
  311. ENTRY (U"Example")
  312. NORMAL (U"We start from the following #Strings:")
  313. CODE (U"6 (number of strings)")
  314. CODE (U"\"hallo\"")
  315. CODE (U"\"dag allemaal\"")
  316. CODE (U"\"hallo\"")
  317. CODE (U"\"tot morgen\"")
  318. CODE (U"\"hallo\"")
  319. CODE (U"\"tot morgen\"")
  320. NORMAL (U"This will give us the following #Index:")
  321. CODE (U"1 (number of columns) \"\" (no column name)")
  322. CODE (U"\"dag allemaal\"")
  323. CODE (U"\"hallo\"")
  324. CODE (U"\"tot morgen\"")
  325. CODE (U"6 (number of elements)")
  326. CODE (U"2")
  327. CODE (U"1")
  328. CODE (U"2")
  329. CODE (U"3")
  330. CODE (U"2")
  331. CODE (U"3")
  332. MAN_END
  333. MAN_BEGIN (U"Index: To Permutation...", U"djmw", 20050725)
  334. INTRO (U"Generates a @Permutation from the selected @Index by randomly permuting blocks of equivalent elements.")
  335. NORMAL (U"Suppose your data consists of groups of equivalent elements and the number of elements in the groups are not equal. You want to make random ordering of your data such that the elements in a group stay together. The following example shows you how.")
  336. ENTRY (U"Setting")
  337. TAG (U"##Permute within classes")
  338. DEFINITION (U"determines whether the elements within a class will be randomly permuted.")
  339. ENTRY (U"Example")
  340. NORMAL (U"Suppose your data, for example a @Strings, consists of groups of equivalent elements and the number of elements in the groups are not equal. You want to make a random ordering of your data such that the elements in a group stay together. The following example shows you how.")
  341. NORMAL (U"We start from the following Strings:")
  342. CODE (U"6 (number of strings)")
  343. CODE (U"\"hallo\"")
  344. CODE (U"\"dag allemaal\"")
  345. CODE (U"\"hallo\"")
  346. CODE (U"\"tot morgen\"")
  347. CODE (U"\"hallo\"")
  348. CODE (U"\"tot morgen\"")
  349. NORMAL (U"We choose @@Strings: To Index|To Index@ which will give us the following #Index:")
  350. CODE (U"1 (number of columns) \"\" (no column name)")
  351. CODE (U"\"dag allemaal\"")
  352. CODE (U"\"hallo\"")
  353. CODE (U"\"tot morgen\"")
  354. CODE (U"6 (number of elements)")
  355. CODE (U"2")
  356. CODE (U"1")
  357. CODE (U"2")
  358. CODE (U"3")
  359. CODE (U"2")
  360. CODE (U"3")
  361. NORMAL (U"We choose ##To Permutation# and with ##Permute within classes# %off, this might generate the permutation (2,4,6,1,3,5).")
  362. NORMAL (U"Selecting the Permutation and the Strings together and choosing @@Strings & Permutation: "
  363. "Permute strings|Permute strings@ will generate the following Strings:")
  364. CODE (U"\"dag allemaal\"")
  365. CODE (U"\"tot morgen\"")
  366. CODE (U"\"tot morgen\"")
  367. CODE (U"\"hallo\"")
  368. CODE (U"\"hallo\"")
  369. CODE (U"\"hallo\"")
  370. NORMAL (U"We see that the permutation always keeps identical strings together.")
  371. MAN_END
  372. MAN_BEGIN (U"Index: Extract part...", U"djmw", 20050725)
  373. INTRO (U"Creates a new @Index by copying a part of selected Index.")
  374. ENTRY (U"Example")
  375. NORMAL (U"Given the following Index:")
  376. CODE (U"1 (number of columns) \"\" (no column name)")
  377. CODE (U"\"dag allemaal\"")
  378. CODE (U"\"hallo\"")
  379. CODE (U"\"tot morgen\"")
  380. CODE (U"6 (number of elements)")
  381. CODE (U"2")
  382. CODE (U"1")
  383. CODE (U"2")
  384. CODE (U"3")
  385. CODE (U"2")
  386. CODE (U"3")
  387. NORMAL (U"The command ##Extract part... 1 2# gives you the new Index:")
  388. CODE (U"1 (number of columns) \"\" (no column name)")
  389. CODE (U"\"dag allemaal\"")
  390. CODE (U"\"hallo\"")
  391. CODE (U"\"tot morgen\"")
  392. CODE (U"6 (number of elements)")
  393. CODE (U"2")
  394. CODE (U"1")
  395. NORMAL (U"Note that all classes stay intact and may have zero references like for example the \"tot morgen\" class. ")
  396. MAN_END
  397. }
  398. /* End of file manual_Permutation.cpp */