Vector Module

Functions and values

Function or value Description

cityblock v1 v2

Full Usage: cityblock v1 v2

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

Cityblock distance of two vectors

v1 : Vector<^a>

v2 : Vector<^a>

Returns: float

Example

cityblockNaN v1 v2

Full Usage: cityblockNaN v1 v2

Parameters:
Returns: float
Modifiers: inline

Cityblock distance of two vectors

v1 : Vector<float>

v2 : Vector<float>

Returns: float

Example

euclidean v1 v2

Full Usage: euclidean v1 v2

Parameters:
Returns: float
Modifiers: inline
Type parameters: ^a, ^c, ^d
v1 : Vector<^a>
v2 : Vector<^a>
Returns: float

euclideanNaN v1 v2

Full Usage: euclideanNaN v1 v2

Parameters:
Returns: float

Euclidean distance between 2 vectors (ignores nan)

v1 : Vector<float>

v2 : Vector<float>

Returns: float

Example

euclideanSquared v1 v2

Full Usage: euclideanSquared v1 v2

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

Squared Euclidean distance between 2 vectors

v1 : Vector<^a>

v2 : Vector<^a>

Returns: float

Example

hamming v1 v2

Full Usage: hamming v1 v2

Parameters:
    v1 : Vector<'a> - first vector
    v2 : Vector<'a> - second vector

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

Calculates Hamming distance between 2 vectors

Note, distance between Nan and Nan is equal to 1

v1 : Vector<'a>

first vector

v2 : Vector<'a>

second vector

Returns: int

Hamming distance between elements of given vectors

Example

 
 // e.g. v1 and v2 initialization
 let v1 = vector [1; 2; 3]
 let s2 = vector [9; 2; 3]
 
 // Apply the hamming to v1 and v2
 Vector.hamming v1 v2

minkowski v1 v2 p

Full Usage: minkowski v1 v2 p

Parameters:
    v1 : Vector<^a>
    v2 : Vector<^a>
    p : float - float constrained to `p > 0`

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

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

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

v1 : Vector<^a>
v2 : Vector<^a>
p : float

float constrained to `p > 0`

Returns: float option

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

Example

 
 // e.g. v1 and v2 initialization
 let v1 = vector [3.14; 2.0; 3.1]
 let v2 = vector [9.1; 2.5; 3.7]
 
 // Apply the minkowski distance to v1 and v2
 Vector.minkowski v1 v2 3

minkowskiNaN v1 v2 p

Full Usage: minkowskiNaN v1 v2 p

Parameters:
    v1 : Vector<float>
    v2 : Vector<float>
    p : float - float constrained to `p > 0`

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

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

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

v1 : Vector<float>
v2 : Vector<float>
p : float

float constrained to `p > 0`

Returns: float option

Minkowski distance between elements of given vectors.

Example

 
 // e.g. v1 and v2 initialization
 let v1 = vector [3.14; 2.0; 3.1]
 let v2 = vector [9.1; 2.5; 3.7]
 
 // Apply the minkowski distance to v1 and v2
 Vector.minkowskiNaN v1 v2 3