Returns sliding windows of width `size` over the Array. If `drop_last` is True, drops the last subarrays that are shorter than the window size.
(self, size, stride=1, drop_last=True)
| 630 | return Array(self[i * n : (i + 1) * n] for i in range(fun(self.size / n))) |
| 631 | |
| 632 | def windows(self, size, stride=1, drop_last=True): |
| 633 | """ |
| 634 | Returns sliding windows of width `size` over the Array. |
| 635 | If `drop_last` is True, drops the last subarrays that are |
| 636 | shorter than the window size. |
| 637 | """ |
| 638 | self.__validate_bool_arg(drop_last, "drop_last") |
| 639 | end = (self.size - size + 1) if drop_last else self.size |
| 640 | return Array(self[i : i + size] for i in range(0, end, stride)) |
| 641 | |
| 642 | def takeWhile(self, l): |
| 643 | """ Takes the longest prefix of elements that satisfy the given predicate. """ |
nothing calls this directly
no test coverage detected