I have a list of n-dimensional sequences of varying length, but fixed n.
e.g. n=3
1. [ [1, 2, 3], [4, 5, 6], [4, 4, 4] ]
2. [ [4, 6, 7], [6, 4, 3] ]
3. [ [7, 9, 1], [6, 2, 0], [0, 7, 3], [3, 3, 8] ]
I want to create lists of all subsequences of window size w from these. E.g. for w = 2,
List 1: [ [1, 2, 3], [4, 5, 6] ]
List 2: [ [4, 5, 6] , [ 4, 4, 4] ]
List 3: [ [4, 6, 7], [6, 4, 3] ]
List 4: [ [7, 9, 1], [6, 2, 0] ] and so on...
I want a fast implementation of this in Python. I tried to implement the solution here: Split Python sequence (time series/array) into subsequences with overlap, but I am not sure how the strides are calculated for n-dimensional data points and I am getting weird results.
What is the best way to get such subsequences for variable window sizes?