Skip to main content
. 2019 Oct 21;21(10):1023. doi: 10.3390/e21101023
Algorithm 2. Plain Algorithm. To transform a finite time series {xt} of elements from a totally ordered set X into a sequence of non-negative integers {nt}, select a pattern order m⩾2 and a time lag τ⩾1, and proceed according to the pseudocode below. The value nt∈{0,1,…,m!−1} then uniquely identifies the ordinal pattern Πt of order m, which is extracted from the time series {xt} at time index t using the time lag τ. The function encode_pattern is specified in Algorithm 1.
1 function encode_sequence
2 input
3  m ∈N with m ⩾2
4  τ ∈N with τ ⩾1
5  {xt} with xt ∈X and t∈{1,2,…,N}
6 output
7  {nt} with nt ∈{0,1,…,m!−1} and t∈{1,2,…,N−(m−1)τ}
8 begin
9  for t←1 to N−(m−1)τ do
10    nt← encode_pattern (xt,xt+τ,…,xt+(m−1)τ)
11    end
12 end.