Skip to content
Snippets Groups Projects
Commit ab40d9e9 authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Implement Stencils.shape

parent 1e3371d9
No related branches found
No related tags found
No related merge requests found
...@@ -39,6 +39,12 @@ class Stencil(list): ...@@ -39,6 +39,12 @@ class Stencil(list):
new_stencil = [s for s in self if all(s[i] % t == 0 for i, t in enumerate(strides))] new_stencil = [s for s in self if all(s[i] % t == 0 for i, t in enumerate(strides))]
return Stencil(new_stencil, self.ndim) return Stencil(new_stencil, self.ndim)
@property
def shape(self):
mins = [min(s[i] for s in self) for i in range(self.ndim)]
maxs = [max(s[i] for s in self) for i in range(self.ndim)]
return tuple(a-b+1 for a, b in zip(maxs, mins))
class LineStencil(Stencil): class LineStencil(Stencil):
"""Stencil along one dimension. Results in a 1D filter""" """Stencil along one dimension. Results in a 1D filter"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment