#N struct array-help-struct float x float y array z float;
#N struct float float y;
#N struct array-help-struct2 float x float y array z element-struct2
;
#N struct element-struct2 float x float y float w;
#N canvas 309 129 694 542 12;
#X obj 208 496 list;
#X text 34 496 see also:;
#X text 485 171 (click for details:), f 11;
#N canvas 844 217 900 716 define 0;
#X text 295 562 creation arguments:;
#X text 325 597 optional name;
#X text 322 164 read from a file;
#X text 324 195 write to a file;
#X text 32 20 "array define" maintains an array and can name it so
that other objects can find it (and later should have some alternative
\, anonymous way to be found).;
#X text 324 614 optional size (100 by default);
#X msg 35 138 const 0;
#X text 325 138 set to a constant (0 \, for instance);
#X msg 45 167 read array-object-help.txt;
#X msg 45 194 write array-object-help.txt;
#X obj 36 596 array define array-help-1;
#X msg 45 224 resize 100;
#X text 71 255 ... other messages are also forwarded to the array like
those above - xticks \, etc \, and also lists to set values.;
#X obj 154 412 r array-help-send;
#X text 221 313 send a pointer to a named receive object;
#X floatatom 154 460 5 0 0 0 - - -, f 5;
#X obj 364 407 r array-help-send;
#X floatatom 364 481 5 0 0 0 - - -, f 5;
#X text 46 570 click to open or edit array:;
#X obj 364 431 t b p;
#X obj 154 436 getsize float-array z;
#X obj 364 456 array size -s float-array z;
#X text 109 349 The pointer will be to a structure float-array and
the array itself will be the field named 'z' \, so that you can access
it as shown in these examples:;
#X obj 38 659 array define -k array-help-2 10;
#A 0 -0.320006 0 0 0 0.973333 0 0 0 0 0;
#X msg 49 313 send array-help-send;
#X text 323 580 optional -k flag to keep contents;
#X connect 6 0 10 0;
#X connect 8 0 10 0;
#X connect 9 0 10 0;
#X connect 11 0 10 0;
#X connect 13 0 20 0;
#X connect 16 0 19 0;
#X connect 19 0 21 0;
#X connect 19 1 21 1;
#X connect 20 0 15 0;
#X connect 21 0 17 0;
#X connect 24 0 10 0;
#X restore 486 212 pd define;
#X obj 112 496 text;
#X obj 90 236 array size;
#N canvas 0 50 600 400 (subpatch) 0;
#N canvas 0 50 450 250 (subpatch) 0;
#X coords 0 1 99 -1 500 300 1;
#X restore 50 50 graph;
#X restore 18 6 array;
#X text 193 210 - create \, store \, and/or edit one;
#X text 193 237 - get or change size;
#X text 194 261 - sum all or a range of elements;
#N canvas 624 95 689 679 array-and-data-structures 0;
#X obj 98 247 pointer;
#N canvas 804 396 504 278 array-help-struct 0;
#X scalar array-help-struct 20 20 \; 0 \; 0 \; -1 \; -6 \; -9 \; -10
\; -5 \; -2 \; 8 \; 12 \; 12 \; 12 \; 10 \; 8 \; 6 \; 1 \; \;;
#X obj 88 204 pointer;
#X msg 32 156 20 20;
#X obj 31 231 append array-help-struct x y;
#X msg 88 147 traverse pd-array-help-struct \, bang, f 21;
#X obj 13 83 filledpolygon 0 0 0 0 0 0 10 20 10 20 0 0 0;
#X obj 13 56 struct array-help-struct float x float y array z float
;
#X obj 17 114 plot z 500 2 25 5 5;
#X connect 1 0 3 2;
#X connect 2 0 3 0;
#X connect 4 0 1 0;
#X restore 289 159 pd array-help-struct;
#N canvas 1207 234 450 300 array-help-data 0;
#X scalar array-help-struct 84 93 \; 0 \; 0 \; -1 \; -6 \; -9 \; -10
\; -5 \; -2 \; 5 \; -7 \; -41 \; -47 \; -45 \; -34 \; -17 \; 8 \; 5
\; 2 \; -2 \; -11 \; -16 \; -26 \; -43 \; 16 \; 24 \; 26 \; 21 \; 20
\; 19 \; 17 \; 16 \; 16 \; 16 \; 16 \; 12 \; \;;
#X text 26 215 We have one datum... right-click to see contents.;
#X restore 290 189 pd array-help-data;
#X msg 98 190 traverse pd-array-help-data \, next, f 19;
#X obj 61 139 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 61 161 t b b;
#X obj 61 286 array sum -s array-help-struct z, f 19;
#X floatatom 61 327 5 0 0 0 - - -, f 5;
#X text 449 190 <- the array;
#X text 460 161 <- the structure;
#X text 56 21 The array objects can also reference arrays within structures
via pointers. The "-s" flag takes two arguments \, specifying the data
structure and the field within it that will contain the array. By default
the array should be a simple floating point array (use hte template
"float" for the array elements) but you can override that using "-f"
as shown further down.;
#X obj 115 549 pointer;
#X obj 78 441 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 78 463 t b b;
#X floatatom 78 629 5 0 0 0 - - -, f 5;
#X text 466 518 <- the array;
#N canvas 1063 375 447 373 array-help-struct2 0;
#X obj 95 252 pointer;
#X msg 39 204 20 20;
#X obj 13 94 filledpolygon 0 0 0 0 0 0 10 20 10 20 0 0 0;
#X obj 13 56 struct array-help-struct2 float x float y array z element-struct2
;
#X msg 95 195 traverse pd-array-help-struct2 \, bang, f 22;
#X obj 38 279 append array-help-struct2 x y;
#X obj 16 120 plot z 500 2 25 5;
#X connect 0 0 5 2;
#X connect 1 0 5 0;
#X connect 4 0 0 0;
#X restore 306 461 pd array-help-struct2;
#N canvas 1028 171 477 318 array-help-data2 0;
#X scalar array-help-struct2 80 30 \; -54 200 10 \; 138 -10 3 \; -32
26 0 \; 109 141 8 \; 272 19 0 \; \;;
#X text 31 267 A structure whose array has (x \, y \, w) triples -
right-click to see contents., f 40;
#X restore 307 517 pd array-help-data2;
#X msg 115 492 traverse pd-array-help-data2 \, next, f 20;
#X text 484 461 <- main structure, f 30;
#X text 484 486 <- element structure, f 30;
#N canvas 1103 205 413 178 element-struct2 0;
#X obj 13 56 struct element-struct2 float x float y float w;
#X restore 306 486 pd element-struct2;
#X obj 78 588 array sum -s array-help-struct2 z -f element-struct2
w, f 33;
#X text 58 366 Using an additional '-f' flag we can specify which field
in the array we're referring to. In this example the array has (x \,
y \, w) triples (struct element-struct2) and we're asking for the "w"
field using the "-f" flag and its two arguments.;
#X text 128 629 sum of all the 'w' values in the array;
#X text 225 267 when "-s" is given this inlet takes a pointer in place
of a name., f 35;
#X connect 0 0 6 2;
#X connect 3 0 0 0;
#X connect 4 0 5 0;
#X connect 5 0 6 0;
#X connect 5 1 3 0;
#X connect 6 0 7 0;
#X connect 11 0 22 2;
#X connect 12 0 13 0;
#X connect 13 0 22 0;
#X connect 13 1 18 0;
#X connect 18 0 11 0;
#X connect 22 0 14 0;
#X restore 87 456 pd array-and-data-structures;
#N canvas 771 174 751 261 size 0;
#X floatatom 26 95 5 1 100 0 - - -, f 5;
#X obj 25 200 print;
#X text 45 19 "array size" outputs the size (if sent a bang) or sets
the size (if sent a number).;
#X obj 25 171 array size array-help-2;
#X obj 35 122 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X text 226 169 creations arguments: either array name or "-s" and
optional "-f" flags to refer to an array in a data structure;
#X msg 249 137 symbol array-help-2;
#X text 414 110 inlet to set name or pointer;
#X text 74 94 number to set size;
#X text 59 121 bang outputs size;
#X msg 248 113 symbol array-help-1;
#X connect 0 0 3 0;
#X connect 3 0 1 0;
#X connect 4 0 3 0;
#X connect 6 0 3 1;
#X connect 10 0 3 1;
#X restore 486 236 pd size;
#X obj 90 212 array define;
#X text 84 432 accessing arrays inside data structures:;
#X text 65 6 - accessing arrays;
#X text 50 43 In Pd an array may be part of a "garray" (a graphical
array of numbers) or appear as a slot in a data structure (in which
case the elements may be arbitrary data \, not necessarily just numbers).
The "array" object can define an array (so far just of numbers but
maybe later arbitrary data structures) or access an array defined elsewhere
to get or change its size \, set or read its elements \, and so on.
;
#X text 93 183 The first argument sets its function:;
#X obj 153 496 scalar;
#X obj 90 260 array sum;
#X obj 90 332 array quantile;
#N canvas 791 201 776 362 sum 0;
#X floatatom 74 135 5 0 10 0 - - -, f 5;
#X obj 65 114 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X floatatom 65 268 5 0 0 0 - - -, f 5;
#X floatatom 111 162 5 -1 10 0 - - -, f 5;
#X text 45 19 "array sum" outputs the sum of all or a selected range
of elements of the array.;
#X obj 65 223 array sum array-help-2, f 12;
#X text 183 262 - optional number to initialize onset - default 0;
#X text 183 281 - optional number to initialize number of points -
default -1, f 61;
#X text 91 112 bang to output sum;
#X text 184 226 creation arguments: either array name or "-s" and optional
"-f" flags to refer to an array in a data structure;
#X text 124 131 onset (first index to sum from) \, zero for start of
array;
#X text 159 157 number of points or -1 for end of array;
#X text 65 328 (array-help-2 is defined in the "define" subwindow).
;
#X msg 158 189 symbol array-help-2;
#X text 322 188 set name or pointer;
#X connect 0 0 5 0;
#X connect 1 0 5 0;
#X connect 3 0 5 1;
#X connect 5 0 2 0;
#X connect 13 0 5 2;
#X restore 486 260 pd sum;
#X obj 90 284 array get;
#N canvas 342 597 805 335 get 0;
#X floatatom 135 103 5 0 10 0 - - -, f 5;
#X obj 118 78 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X floatatom 165 126 5 -1 10 0 - - -, f 5;
#X obj 119 185 array get array-help-2, f 12;
#X obj 119 226 print;
#X text 45 19 "array get" outputs all or a selected range of elements
of the array as a list.;
#X text 276 238 - optional number to initialize onset - default 0;
#X text 275 257 - optional number to initialize number of points -
default -1, f 61;
#X text 280 201 creation arguments: either array name or "-s" and optional
"-f" flags to refer to an array in a data structure;
#X text 212 128 number of points or -1 for end of array;
#X text 140 78 bang for output;
#X text 65 298 (array-help-2 is defined in the "define" subwindow).
;
#X msg 212 155 symbol array-help-2;
#X text 376 154 set name or pointer;
#X text 181 102 onset (first index to output) \, zero for start of
array;
#X connect 0 0 3 0;
#X connect 1 0 3 0;
#X connect 2 0 3 1;
#X connect 3 0 4 0;
#X connect 12 0 3 2;
#X restore 486 284 pd get;
#X obj 90 308 array set;
#N canvas 525 369 752 328 set 0;
#X obj 119 203 array set array-help-2, f 12;
#X msg 119 117 0.1 0.2 0.3 0.4 0.3 0.2 0.1;
#X text 45 19 "array set" sets values of an array from an incoming
list \, starting from a specified onset (0 by default). The size of
the array is not changed -- values that would be written past the end
of the array are dropped.;
#X floatatom 165 143 5 0 0 0 - - -, f 5;
#X text 215 141 onset (first index to write to);
#X text 252 244 - optional number to initialize onset - default 0;
#X text 256 207 creation arguments: either array name or "-s" and optional
"-f" flags to refer to an array in a data structure;
#X text 349 118 list of values to write to array;
#X text 56 265 (array-help-2 is defined in the "define" subwindow).
;
#X msg 212 170 symbol array-help-2;
#X text 376 169 set name or pointer;
#X connect 1 0 0 0;
#X connect 3 0 0 1;
#X connect 9 0 0 2;
#X restore 486 308 pd set;
#X text 194 285 - get contents as a list;
#X text 194 309 - set contents from a list;
#X text 212 333 - get a quantile;
#X obj 90 356 array random;
#N canvas 102 243 816 629 quantile+random 0;
#X floatatom 75 177 5 0 100 0 - - -, f 5;
#X obj 39 251 array quantile array-help-3, f 14;
#N canvas 0 50 450 250 (subpatch) 0;
#X array array-help-3 100 float 3;
#A 0 0 0 0 0 0 0 0 0 0 0 0 0.00715053 0.00715053 0.0285789 0.0500072
0.0714356 0.100007 0.128578 0.164292 0.207148 0.478574 0.628573 0.678572
0.721429 0.717857 0.714286 0.707143 0.7 0.692857 0.685715 0.678572
0.18572 0.164292 0.157149 0.0142931 -0.00713521 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.014293 0.0214357 0.0357213 0.078578
0.142863 0.207148 0.335718 0.407146 0.435717 0.478574 0.514288 0.557144
0.592858 0.642858 0.7 0.692857 0.692857 0.692857 0.692857 0.7 0.696429
0.349997 0.335712 0.321426 0.278569 0.192856 0.149999 0.135714 0.114285
0.0999998 0.0714298 0.0642871 0.0571443 0.0285732 0 0 0 0 0;
#X coords 0 1 99 0 200 140 1 0 0;
#X restore 37 375 graph;
#X floatatom 111 198 5 -1 100 0 - - -, f 5;
#X msg 43 524 \; array-help-3 const 0;
#X floatatom 39 131 5 -1 100 0 - - -, f 5;
#X obj 39 152 / 100;
#X floatatom 39 295 5 0 100 0 - - -, f 5;
#X floatatom 368 599 5 0 100 0 - - -, f 5;
#X obj 370 555 array random array-help-3, f 13;
#X obj 370 435 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X floatatom 383 484 5 0 0 0 - - -, f 5;
#X floatatom 420 507 5 0 0 0 - - -, f 5;
#X text 303 358 "array random" makes a pseudo-random numbver from 0
to 1 and outputs its quantile (which will therefore have probabilities
proportional to the table's values.);
#X text 394 430 bang to generate a random value;
#X msg 377 456 seed 56;
#X text 445 456 set random seed;
#X text 170 286 - optional number to initialize onset - default 0;
#X text 169 305 - optional number to initialize number of points -
default -1, f 61;
#X text 494 569 same creation arguments;
#X text 174 249 creation arguments: either array name or "-s" and optional
"-f" flags to refer to an array in a data structure;
#X text 120 174 onset (first index to sum from) \, zero for start of
array;
#X text 160 196 number of points or -1 for end of array;
#X text 130 5 "array quantile" outputs the specified quantile of the
array - so for instance \, the 0.5 quantile is the median of the array.
This generalizes the "array random" function allowing you to use the
same source of randomness on several arrays \, for example. Negative
numbers in the array are silently replaced by zero. Quantiles outside
the range 0-1 output the x values at the two extremes of the array
(0 and 99 here).;
#X text 428 481 onset;
#X text 466 505 number of points;
#X text 88 130 quantile (between 0 and 1);
#X msg 149 218 symbol array-help-2;
#X text 313 217 set name or pointer;
#X msg 471 529 symbol array-help-2;
#X text 635 528 set name or pointer;
#X connect 0 0 1 1;
#X connect 1 0 7 0;
#X connect 3 0 1 2;
#X connect 5 0 6 0;
#X connect 6 0 1 0;
#X connect 9 0 8 0;
#X connect 10 0 9 0;
#X connect 11 0 9 0;
#X connect 12 0 9 1;
#X connect 15 0 9 0;
#X connect 27 0 1 3;
#X connect 29 0 9 2;
#X restore 485 346 pd quantile+random;
#X text 195 356 - random - array as probabilities;
#X text 444 471 updated for Pd version 0.45;
#X obj 90 379 array max;
#N canvas 727 168 744 595 min+max 0;
#N canvas 0 50 450 250 (subpatch) 0;
#X array array-help-4 100 float 3;
#A 0 0.335714 0.37857 0.421427 0.442855 0.478569 0.521426 0.535711
0.55714 0.585711 0.599997 0.614282 0.63571 0.649996 0.664282 0.671424
0.699995 0.699995 0.714281 0.721424 0.707138 0.699995 0.692853 0.68571
0.671424 0.649996 0.628568 0.599997 0.571425 0.514283 0.471426 0.414284
0.385713 0.357142 0.328571 0.3 0.285714 0.271429 0.25 0.228572 0.214286
0.207143 0.200001 0.185715 0.17143 0.164287 0.157144 0.150001 0.135716
0.128573 0.12143 0.12143 0.114287 0.114287 0.114287 0.114287 0.114287
0.12143 0.125001 0.128573 0.128573 0.135716 0.139287 0.142858 0.150001
0.157144 0.157144 0.164287 0.17143 0.200001 0.214286 0.228572 0.235715
0.242857 0.257143 0.271429 0.285714 0.307142 0.321428 0.335714 0.357142
0.371427 0.385713 0.399999 0.407141 0.414284 0.421427 0.42857 0.435713
0.442855 0.457141 0.460712 0.464284 0.471426 0.478569 0.485712 0.499998
0.50714 0.514283 0.521426 0.528569;
#X coords 0 1 99 0 200 140 1 0 0;
#X restore 382 386 graph;
#X floatatom 55 275 7 0 100 0 - - -, f 7;
#X obj 57 136 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X floatatom 70 159 5 0 0 0 - - -, f 5;
#X floatatom 107 182 5 0 0 0 - - -, f 5;
#X text 179 264 - optional number to initialize onset - default 0;
#X text 178 283 - optional number to initialize number of points -
default -1, f 61;
#X text 173 229 creation arguments: either array name or "-s" and optional
"-f" flags to refer to an array in a data structure;
#X text 115 156 onset;
#X text 153 180 number of points;
#X msg 158 204 symbol array-help-2;
#X text 322 205 set name or pointer;
#X obj 57 230 array max array-help-4, f 13;
#X floatatom 123 275 5 0 100 0 - - -, f 5;
#X text 79 133 bang to find maximum;
#X text 130 5 "array max" and "array min" find the maximum and minimum
values in the array \, respectively. The first outlet is the value
and the second is the index (the x location where the value was found).
The search may be restricted to a sub-domain of the array by specifying
the "onset" and "number of points".;
#X floatatom 52 497 7 0 100 0 - - -, f 7;
#X obj 54 358 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X floatatom 67 381 5 0 0 0 - - -, f 5;
#X floatatom 104 404 5 0 0 0 - - -, f 5;
#X text 112 378 onset;
#X floatatom 120 497 5 0 100 0 - - -, f 5;
#X text 76 355 bang to find minimum;
#X text 153 402 number of points;
#X obj 54 452 array min array-help-4, f 13;
#X text 54 298 value;
#X text 118 299 index;
#X connect 2 0 12 0;
#X connect 3 0 12 0;
#X connect 4 0 12 1;
#X connect 10 0 12 2;
#X connect 12 0 1 0;
#X connect 12 1 13 0;
#X connect 17 0 24 0;
#X connect 18 0 24 0;
#X connect 19 0 24 1;
#X connect 24 0 16 0;
#X connect 24 1 21 0;
#X restore 480 392 pd min+max;
#X obj 90 402 array min;
#X text 194 403 - min - find lowest value;
#X text 193 384 - max - find highest value;
