You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, other options would certainly be useful. In my case, when dealing with differential equations with periodic boundary conditions, numba.stencil in its current form unfortunately can’t be used. If a mode 'wrap' were implemented, where array accesses outside the valid range would be taken modulo the length of the relevant array dimension, numba.stencil could also handle periodic boundary conditions.
For completeness, perhaps it is worth to draw inspiration from scipy.ndimage (e. g. scipy.ndimage.laplace, scipy.ndimage.convolve) for consistency (considering the identical naming and functionality of cval, perhaps this is already on the radar?):
'reflect' (d c b a | a b c d | d c b a)
The input is extended by reflecting about the edge of the last pixel.
'constant' (k k k k | a b c d | k k k k)
The input is extended by filling all values beyond the edge with the same constant value, defined by the cval parameter.
'nearest' (a a a a | a b c d | d d d d)
The input is extended by replicating the last pixel.
'mirror' (d c b | a b c d | c b a)
The input is extended by reflecting about the center of the last pixel.
'wrap' (a b c d | a b c d | a b c d)
The input is extended by wrapping around to the opposite edge.
The text was updated successfully, but these errors were encountered:
Is this currently on the numba roadmap? If not, would it be possible for a high-level breakdown of what this might entail to see if a contributor may be able help out?
I've created the following decorator, which adds the border using numpy pad and removes it afterwards, effectivley allowing the stencil decorator to use all border options of numpy.pad:
@kleinsimon Please see the original post. The design was to integrate different border handling into the stencil decorator itself over time. A benefit then is that you don't have to specify the borderWidth but it can be computed automatically (or through the neighborhood option.) Also, have you tested this by calling test from within a parallel region? I don't think that is going to work. Can you adapt your approach to work within the stencil decorator and within a parallel context?
Feature request
Currently, even though
numba.stencil
is designed in a way that allows different “modes”, it only supports one:However, other options would certainly be useful. In my case, when dealing with differential equations with periodic boundary conditions,
numba.stencil
in its current form unfortunately can’t be used. If a mode'wrap'
were implemented, where array accesses outside the valid range would be taken modulo the length of the relevant array dimension,numba.stencil
could also handle periodic boundary conditions.For completeness, perhaps it is worth to draw inspiration from
scipy.ndimage
(e. g.scipy.ndimage.laplace
,scipy.ndimage.convolve
) for consistency (considering the identical naming and functionality ofcval
, perhaps this is already on the radar?):The text was updated successfully, but these errors were encountered: