R/distance_helpers.R

Defines functions matrix.dist

# Helpers for distance computation ############################################

## distance between rows of two matrices

matrix.dist <- function(mat1, mat2) {
  outer(1:nrow(mat1), 1:nrow(mat2), Vectorize(function(r1, r2) {
    dist(rbind(mat1[r1, ], mat2[r2, ]))
  }))
}

Try the SOMbrero package in your browser

Any scripts or data that you put into this service are public.

SOMbrero documentation built on May 29, 2024, 1:27 a.m.