Namespace Distances

namespace distances

Functions

double dtw(const std::vector<double> &a, const std::vector<double> &b)

Calculates the Dynamic Time Warping Distance.

Return
array The resulting distance between a and b.
Parameters
  • a: The input time series of reference.
  • b: The input query.

af::array dtw(const af::array &tss)

Calculates the Dynamic Time Warping Distance.

Return
af::array An upper triangular matrix where each position corresponds to the distance between two time series. Diagonal elements will be zero. For example: Position row 0 column 1 records the distance between time series 0 and time series 1.
Parameters
  • tss: Expects an input array whose dimension zero is the length of the time series (all the same) and dimension one indicates the number of time series.

af::array euclidean(const af::array &tss)

Calculates euclidean distances between time series.

Return
af::array An upper triangular matrix where each position corresponds to the distance between two time series. Diagonal elements will be zero. For example: Position row 0 column 1 records the distance between time series 0 and time series 1.
Parameters
  • tss: Expects an input array whose dimension zero is the length of the time series (all the same) and dimension one indicates the number of time series.

af::array hamming(const af::array &tss)

Calculates hamming distances between time series.

Return
af::array An upper triangular matrix where each position corresponds to the distance between two time series. Diagonal elements will be zero. For example: Position row 0 column 1 records the distance between time series 0 and time series 1.
Parameters
  • tss: Expects an input array whose dimension zero is the length of the time series (all the same) and dimension one indicates the number of time series.

af::array manhattan(const af::array &tss)

Calculates manhattan distances between time series.

Return
af::array An upper triangular matrix where each position corresponds to the distance between two time series. Diagonal elements will be zero. For example: Position row 0 column 1 records the distance between time series 0 and time series 1.
Parameters
  • tss: Expects an input array whose dimension zero is the length of the time series (all the same) and dimension one indicates the number of time series.

af::array sbd(const af::array &tss)

Calculates the Shape-Based distance (SBD). It computes the normalized cross-correlation and it returns 1.0 minus the value that maximizes the correlation value between each pair of time series.

Return
array An upper triangular matrix where each position corresponds to the distance between two time series. Diagonal elements will be zero. For example: Position row 0 column 1 records the distance between time series 0 and time series 1.
Parameters
  • tss: Expects an input array whose dimension zero is the length of the time series (all the same) and dimension one indicates the number of time series.

af::array squaredEuclidean(const af::array &tss)

Calculates non squared version of the euclidean distance.

Return
array An upper triangular matrix where each position corresponds to the distance between two time series. Diagonal elements will be zero. For example: Position row 0 column 1 records the distance between time series 0 and time series 1.
Parameters
  • tss: Expects an input array whose dimension zero is the length of the time series (all the same) and dimension one indicates the number of time series.