# Readme on slmetric_pw (version 2.0)

Dahua Lin (dhlin@mit.edu)
Massachusetts Institute of Technology
August 16, 2007.

## Introduction

slmetric_pw.h is an m-function to compute metrics between two sets of vectors in pairwise way. Compared to other metric computing functions, it has the following features:

- It supports about 20 metric types, including Euclidean distance (L2), Normalized Correlation, City-Block distance (L1), Quadratic distance, Minkowski distance, Hamming distance, Histogram Intersect, Chi-square distance, and information theoretical divergences, etc.
- It is highly optimized by taking full advantage of vectorized computation. For some distances that are difficult to be fully vectorized, like city-block distance, C-mex implementation is offered.
- It is easy to use with simple syntax.
- It is sufficiently documented. You can type in "help slmetric_pw" to see the help on its usage. Examples are available to show how to invoke the function.

## Installation

1. Please make sure that your MATLAB version is 2007a(7.4.0) or above. The function cannot be used in lower versions.
2. Extract the zipped package and add the path to MATLAB paths.
3. The pre-compiled mex files (for win32) have been included in the package. If necessary, you can re-compile them in your environment by running slmetric_pw_compile.
4. Now it can be used. If you wish, you can first try the examples in the help.

## Background

slmetric_pw.h is an important function in the core module of sltoolbox, which is a large set of functions for accomplishing many statistical learning tasks.

I am now developing the second version of sltoolbox. Considering that some of the core functions can be applied to a much wider domain in technical computing, and that a long time is needed to make a new version of the whole toolbox ready. I would like to release some of these functions independently so that more fields can benefit from them.

The function has been substantially rewritten based on new features of MATLAB 2007a with enhanced efficiency and stability.