distance: Calculate pairwise Euclidean or angular distances efficiently

Description Usage Arguments Details Value

View source: R/distance.R

Description

This function is a wrapper around a C++ function that calculates pairwise distances in a memory- and CPU-efficient manner.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
distance(x, i, j, distance_method, threads = NULL, verbose)

## S3 method for class 'matrix'
distance(x, i, j, distance_method = "Euclidean",
  threads = NULL, verbose = getOption("verbose", TRUE))

## S3 method for class 'CsparseMatrix'
distance(x, i, j, distance_method = "Euclidean",
  threads = NULL, verbose = getOption("verbose", TRUE))

## S3 method for class 'TsparseMatrix'
distance(x, i, j, distance_method = "Euclidean",
  threads = NULL, verbose = getOption("verbose", TRUE))

Arguments

x

A (potentially sparse) matrix, where examples are columns and features are rows.

i

0-indexed vector of column indices.

j

0-indexed vector of column indices.

distance_method

One of "Euclidean" or "Cosine."

threads

The maximum number of threads to spawn. Determined automatically if NULL (the default).

verbose

Verbosity.

Details

The Euclidean or angular distances between columns in 'x' identified by parameters 'i' and 'j' are calculated and returned.

Value

A vector of the distances between the columns in 'x' indexed by 'i' and 'j', with attribute method giving the distance_method.


largeVis documentation built on Feb. 17, 2018, 1:01 a.m.