From 30f76a93e90102e113c63409dc7b44cb0e54dad7 Mon Sep 17 00:00:00 2001 From: Franz Zotter Date: Sun, 20 Aug 2006 17:32:31 +0000 Subject: improved version of mtx_ispeak finding peaks at the borders of the matrix. svn path=/trunk/externals/iem/iemmatrix/; revision=5676 --- abs/mtx_ispeak-help.pd | 11 +++++--- abs/mtx_ispeakb-help.pd | 72 +++++++++++++++++++++++++++++++++++++++++++++++++ abs/mtx_ispeakb.pd | 52 +++++++++++++++++++++++++++++++++++ 3 files changed, 131 insertions(+), 4 deletions(-) create mode 100644 abs/mtx_ispeakb-help.pd create mode 100644 abs/mtx_ispeakb.pd diff --git a/abs/mtx_ispeak-help.pd b/abs/mtx_ispeak-help.pd index e8badbb..c66565e 100644 --- a/abs/mtx_ispeak-help.pd +++ b/abs/mtx_ispeak-help.pd @@ -1,4 +1,4 @@ -#N canvas 83 338 841 379 10; +#N canvas 553 163 841 379 10; #X text 482 28 part of iemmatrix; #X text 43 34 [mtx_ispeak]; #X text 166 69 searches for peaks in the rows of a matrix. peak locations @@ -58,13 +58,16 @@ are set to 1 \, others to 0; #X obj 33 205 mtx_int; #X obj 33 185 mtx_* 4; #X msg 33 143 1 20; -#X text 301 307 (note: bad performance at edges and larger peaks); #X obj 33 242 mtx_ispeak; +#X obj 535 325 mtx_ispeakb; +#X text 304 306 (note: bad performance at borders and larger peaks) +; +#X text 308 326 for improved version see also:; #X connect 3 0 4 0; #X connect 7 0 9 0; #X connect 8 0 13 0; #X connect 12 0 7 0; -#X connect 12 0 16 0; +#X connect 12 0 15 0; #X connect 13 0 12 0; #X connect 14 0 8 0; -#X connect 16 0 3 0; +#X connect 15 0 3 0; diff --git a/abs/mtx_ispeakb-help.pd b/abs/mtx_ispeakb-help.pd new file mode 100644 index 0000000..4cd9cc3 --- /dev/null +++ b/abs/mtx_ispeakb-help.pd @@ -0,0 +1,72 @@ +#N canvas 83 338 841 379 10; +#X text 482 28 part of iemmatrix; +#X text 166 69 searches for peaks in the rows of a matrix. peak locations +are set to 1 \, others to 0; +#N canvas 0 0 450 300 convert2tablemsg 0; +#X obj 130 35 inlet; +#X obj 169 216 outlet; +#X obj 130 60 t a a; +#X obj 160 82 mtx_size; +#X obj 130 107 list split 3; +#X obj 220 107 change; +#X msg 220 129 resize \$1; +#X obj 169 154 list prepend 0; +#X connect 0 0 2 0; +#X connect 2 0 4 0; +#X connect 2 1 3 0; +#X connect 3 1 5 0; +#X connect 4 1 7 0; +#X connect 5 0 6 0; +#X connect 6 0 1 0; +#X connect 7 0 1 0; +#X restore 33 284 pd convert2tablemsg; +#X obj 33 306 s view_peaks; +#N canvas 0 0 450 300 graph1 0; +#X array view_peaks 20 float 1; +#A 0 0 1 1 0 1 1 1 0 1 1 0 0 1 0 1 1 1 0 0 1; +#X coords 0 1 19 0 200 20 1; +#X restore 327 192 graph; +#N canvas 0 0 450 300 graph1 0; +#X array view_landscape 20 float 1; +#A 0 0 0 0 0 2 2 2 0 0 0 0 2 3 1 3 3 3 0 0 3; +#X coords 0 3 19 0 200 50 1; +#X restore 326 228 graph; +#N canvas 0 0 450 300 convert2tablemsg 0; +#X obj 130 35 inlet; +#X obj 169 216 outlet; +#X obj 130 60 t a a; +#X obj 160 82 mtx_size; +#X obj 130 107 list split 3; +#X msg 220 129 resize \$1; +#X obj 169 154 list prepend 0; +#X obj 220 107 change; +#X connect 0 0 2 0; +#X connect 2 0 4 0; +#X connect 2 1 3 0; +#X connect 3 1 7 0; +#X connect 4 1 6 0; +#X connect 5 0 1 0; +#X connect 6 0 1 0; +#X connect 7 0 5 0; +#X restore 172 284 pd convert2tablemsg; +#X obj 33 165 mtx_rand; +#X obj 172 306 s view_landscape; +#X text 268 138 inletA: matrix/vector containing values (landscape) +; +#X text 268 157 outletB: matrix/vector logical 1 at peaks; +#X obj 33 205 mtx_int; +#X obj 33 185 mtx_* 4; +#X msg 33 143 1 20; +#X text 43 34 [mtx_ispeakb]; +#X text 301 307 (note: this is the improved version to [mtx_ispeak]) +; +#X obj 33 242 mtx_ispeakb; +#X text 300 325 (better performance at the borders of the array); +#X connect 2 0 3 0; +#X connect 6 0 8 0; +#X connect 7 0 12 0; +#X connect 11 0 6 0; +#X connect 11 0 16 0; +#X connect 12 0 11 0; +#X connect 13 0 7 0; +#X connect 16 0 2 0; diff --git a/abs/mtx_ispeakb.pd b/abs/mtx_ispeakb.pd new file mode 100644 index 0000000..18a9fcb --- /dev/null +++ b/abs/mtx_ispeakb.pd @@ -0,0 +1,52 @@ +#N canvas 639 183 450 611 10; +#X obj 120 32 inlet; +#X obj 120 566 outlet; +#X obj 120 301 t a a; +#X obj 120 342 mtx_&&; +#X obj 180 322 mtx_<= 0; +#X obj 120 322 mtx_>= 0; +#X obj 120 280 mtx_diff row -1; +#X obj 180 303 mtx_roll 1; +#X text 277 252 searches; +#X text 270 277 matrix rows; +#X text 268 303 for peaks; +#X text 248 338 returns 1 at peak location; +#X text 297 360 0 elsewhere; +#X obj 120 75 t a a a a; +#X obj 188 75 mtx_size; +#X obj 249 75 - 1; +#X obj 232 123 mtx_slice; +#X msg 249 95 1 \$1 end \$1; +#X obj 139 147 mtx_concat row; +#X obj 120 174 mtx_slice 1 2 end 2; +#X obj 120 197 mtx_concat row; +#X obj 120 414 t a a; +#X obj 149 436 mtx_size; +#X obj 120 509 mtx_slice; +#X msg 200 477 1 2 end \$1; +#X obj 200 457 - 1; +#X connect 0 0 13 0; +#X connect 2 0 5 0; +#X connect 2 1 7 0; +#X connect 3 0 21 0; +#X connect 4 0 3 1; +#X connect 5 0 3 0; +#X connect 6 0 2 0; +#X connect 7 0 4 0; +#X connect 13 0 19 0; +#X connect 13 1 18 0; +#X connect 13 2 16 0; +#X connect 13 3 14 0; +#X connect 14 1 15 0; +#X connect 15 0 17 0; +#X connect 16 0 18 1; +#X connect 17 0 16 1; +#X connect 18 0 20 1; +#X connect 19 0 20 0; +#X connect 20 0 6 0; +#X connect 21 0 23 0; +#X connect 21 1 22 0; +#X connect 22 1 25 0; +#X connect 23 0 1 0; +#X connect 24 0 23 1; +#X connect 25 0 24 0; -- cgit v1.2.1