Revision 47b430f6e116f153b5f406d88ce26f868027a447 authored by Toni Giorgino on 30 November 2007, 00:00:00 UTC, committed by Gabor Csardi on 30 November 2007, 00:00:00 UTC
1 parent f3fa0a2
Raw File
distance.R
###############################################################
#                                                             #
#   (c) Toni Giorgino <toni.giorgino@gmail.com>           #
#       Laboratory for Biomedical Informatics                 #
#       University of Pavia - Italy                           #
#       www.labmedinfo.org                                    #
#                                                             #
#   $Id: distance.R 51 2007-12-11 10:59:08Z tonig $
#                                                             #
###############################################################


## Euclidean squared distance.
## should work on vectors (in R^n) too

## `euclideanSquared` <-
## function(a,b) {
##   z<-a-b;
##   z<-drop(z %*% z);                     #inner dot product
##   return (z);
## }

`euclideanSquared` <-
  function(a,b) {
    return((a-b)^2);
  }


`euclideanDistance` <-
  function(a,b) {
    return(abs(a-b));
  }
back to top