In [3]:
import matplotlib.pyplot as plt
import numpy as np
#import xxhash
L = np.array([1,2,3,4,5,6,7,8,9,0,1,2])
In [13]:
def getAllWindows(L,L2=None,lenght=3):
if L2 is None:
L2 = L[:-1]
if L.size<lenght:
if L2.size<lenght:
return []
return getAllWindows(L2,L2[:-1],lenght)
if L.size>lenght:
return getAllWindows(L[1:],L2,lenght)
return [L]+getAllWindows(L[1:],L2,lenght)
In [14]:
windows = getAllWindows(L,lenght=3)
windows
Out[14]:
In [ ]: