Creates a matrix to be used for calculating distances. The most recent 'element' is put in the first row of the matrix, the second most recent 'element' in the second row and so on. Therefore, the oldest 'element' is put in the last row.
knn_elements(y, d)
A matrix.
Length of each of the 'elements'.
A matrix to be used for calculating distances.