From 49cc86f6a80ba871d6eeaa9af2c6b541dfb319e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Tue, 25 Jul 2006 14:37:35 +0000 Subject: added an abstraction to get the (real) distance between to sets of vectors (and not the squared one) svn path=/trunk/externals/iem/iemmatrix/; revision=5410 --- abs/mtx_distance-help.pd | 34 ++++++++++++++++++++++++++++++++++ abs/mtx_distance.pd | 19 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 abs/mtx_distance-help.pd create mode 100644 abs/mtx_distance.pd (limited to 'abs') diff --git a/abs/mtx_distance-help.pd b/abs/mtx_distance-help.pd new file mode 100644 index 0000000..8c6021c --- /dev/null +++ b/abs/mtx_distance-help.pd @@ -0,0 +1,34 @@ +#N canvas 83 338 841 379 10; +#X obj 33 267 mtx_print distances; +#X obj 119 179 t a a; +#X obj 157 198 mtx_print B; +#X obj 33 179 t a a; +#X obj 63 198 mtx_print A; +#X obj 33 106 t b b; +#X msg 33 85 bang; +#X obj 33 132 mtx_rand 4 3; +#X obj 119 154 mtx_rand 2 3; +#X text 482 28 part of iemmatrix; +#X text 268 138 inletA: a matrix defining vectors of dimension +; +#X text 268 158 inletB: a matrix defining vectors of dimension +; +#X obj 33 242 mtx_distance; +#X text 166 69 calculate the euclidian distance between two sets of +vectors.; +#X text 267 179 outlet: distance matrix (i \, j) \, where each element +Y(i \, j)=sqrt((A(i)-B(i)).(A(i)-B(i)))=|A(i)-B(i)|; +#X text 269 240 there is also a faster version of this object [mtx_distance2] +which does not calculate the square-root of the in-product \; use that +one if possible; +#X text 44 34 [mtx_distance]; +#X connect 1 0 12 1; +#X connect 1 1 2 0; +#X connect 3 0 12 0; +#X connect 3 1 4 0; +#X connect 5 0 7 0; +#X connect 5 1 8 0; +#X connect 6 0 5 0; +#X connect 7 0 3 0; +#X connect 8 0 1 0; +#X connect 12 0 0 0; diff --git a/abs/mtx_distance.pd b/abs/mtx_distance.pd new file mode 100644 index 0000000..20f30aa --- /dev/null +++ b/abs/mtx_distance.pd @@ -0,0 +1,19 @@ +#N canvas 323 233 661 451 10; +#X text 72 316 (c) 2005 by IOhannes m zmoelnig \, IEM KUG \, graz austria +; +#X text 72 333 for license-details see LICENSE.txt that must come with +iemmatrix.; +#X obj 115 164 mtx_distance2; +#X obj 115 78 inlet matrix1; +#X obj 264 78 inlet matrix2; +#X obj 115 209 mtx_.^ 0.5; +#X text 73 41 calculate the euclidian distance between to sets of vectors +; +#X text 229 162 for performance reasons this does not calculate the +square-root; +#X text 229 206 so here we do the square-root; +#X obj 115 240 outlet distance-matrix; +#X connect 2 0 5 0; +#X connect 3 0 2 0; +#X connect 4 0 2 1; +#X connect 5 0 9 0; -- cgit v1.2.1