Array Module

Functions and values

Function or value Description

cityblock a1 a2

Full Usage: cityblock a1 a2

Parameters:
    a1 : ^a array -
    a2 : ^a array -

Returns: float
Modifiers: inline
Type parameters: ^a, ^b

Cityblock distance of two coordinate arrays

a1 : ^a array

a2 : ^a array

Returns: float

Example

cityblockNaN a1 a2

Full Usage: cityblockNaN a1 a2

Parameters:
    a1 : float array -
    a2 : float array -

Returns: float

Cityblock distance of two coordinate float arrays (ignores nan)

a1 : float array

a2 : float array

Returns: float

Example

euclidean a1 a2

Full Usage: euclidean a1 a2

Parameters:
    a1 : ^a array -
    a2 : ^a array -

Returns: float
Modifiers: inline
Type parameters: ^a, ^c, ^d

Euclidean distance of two coordinate arrays

a1 : ^a array

a2 : ^a array

Returns: float

Example

euclideanNaN a1 a2

Full Usage: euclideanNaN a1 a2

Parameters:
    a1 : float array -
    a2 : float array -

Returns: float

Euclidean distance of two coordinate float arrays (ignores nan)

a1 : float array

a2 : float array

Returns: float

Example

euclideanNaNSquared a1 a2

Full Usage: euclideanNaNSquared a1 a2

Parameters:
    a1 : float array -
    a2 : float array -

Returns: float

Squared Euclidean distance of two coordinate float arrays (ignores nan)

a1 : float array

a2 : float array

Returns: float

Example

hamming a1 a2

Full Usage: hamming a1 a2

Parameters:
    a1 : 'a array - first array
    a2 : 'a array - second array

Returns: int Hamming distance between elements of given arrays
Modifiers: inline
Type parameters: 'a

Calculates Hamming distance of two coordinate arrays

Note, distance between Nan and Nan is equal to 1

a1 : 'a array

first array

a2 : 'a array

second array

Returns: int

Hamming distance between elements of given arrays

Example

 
 // e.g. a1 and a2 initialization
 let a1 = [|1; 2; 3|]
 let a2 = [|9; 2; 3|]
 
 // Apply the hamming to a1 and a2
 Array.hamming a1 a2

minkowski a1 a2 p

Full Usage: minkowski a1 a2 p

Parameters:
    a1 : ^a array
    a2 : ^a array
    p : float - float constrained to `p > 0`

Returns: float option Minkowski distance between elements of given arrays. Returns NaN if arrays contain NaN.
Modifiers: inline
Type parameters: ^a

The [Minkowski distance](https://en.wikipedia.org/wiki/Minkowski_distance) between two arrays of order `p`.

The two arrays need not have equal lengths: when one array is exhausted any remaining elements in the other array are ignored.

a1 : ^a array
a2 : ^a array
p : float

float constrained to `p > 0`

Returns: float option

Minkowski distance between elements of given arrays. Returns NaN if arrays contain NaN.

Example

 
 // e.g. a1 and a2 initialization
 let a1 = [|3.14; 2.0; 3.1|]
 let a2 = [|9.1; 2.5; 3.7|]
 
 // Apply the minkowski distance to a1 and a2
 Array.minkowski a1 a2 3

minkowskiNaN a1 a2 p

Full Usage: minkowskiNaN a1 a2 p

Parameters:
    a1 : float array
    a2 : float array
    p : float - float constrained to `p > 0`

Returns: float option Minkowski distance between elements of given arrays.
Modifiers: inline

The [Minkowski distance](https://en.wikipedia.org/wiki/Minkowski_distance) between two arrays (ignores NaN) of order `p`.

Non-regular differences between the sequences are ignored. The two arrays need not have equal lengths: when one array is exhausted any remaining elements in the other array are ignored.

a1 : float array
a2 : float array
p : float

float constrained to `p > 0`

Returns: float option

Minkowski distance between elements of given arrays.

Example

 
 // e.g. a1 and a2 initialization
 let a1 = [|3.14; 2.0; 3.1|]
 let a2 = [|9.1; 2.5; 3.7|]
 
 // Apply the minkowski distance to a1 and a2
 Array.minkowskiNaN a1 a2 3