How to use the transonic.boost function in transonic

To help you get started, we’ve selected a few transonic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fluiddyn / transonic / data_tests / subpackages.py View on Github external
@boost
def test_sp_special(v: int, x: float):
    return jv(v, x)
github fluiddyn / transonic / data_tests / subpackages.py View on Github external
@boost
def test_np_fft(u: "float[]"):
    u_fft = rfft(u)
    return u_fft
github fluiddyn / transonic / tmp / cython_class.py View on Github external
    @boost
    def method2(self, b : int):
        return self.a + b
@boost
github fluiddyn / transonic / doc / for_dev / scikit-image / future / cmorph.py View on Github external
@boost(wraparound=False, boundscheck=False, cdivision=True, nonecheck=False)
def _erode(
    image: A,
    selem: A,
    out: Optional[A] = None,
    shift_x: np.int8 = 0,
    shift_y: np.int8 = 0,
):
    """Return greyscale morphological erosion of an image.

    Morphological erosion sets a pixel at (i,j) to the minimum over all pixels
    in the neighborhood centered at (i,j). Erosion shrinks bright regions and
    enlarges dark regions.

    Parameters
    ----------
    image : ndarray
github fluiddyn / transonic / doc / examples / mixed_classic_type_hint.py View on Github external
@boost
def func(a: float, b: float):
    return (a * np.log(b)).max()
github fluiddyn / transonic / doc / examples / inlined / add.py View on Github external
@boost(inline=True)
def add(a: T, b: T) -> T:
    return a + b
github fluiddyn / transonic / doc / for_dev / scikit-image / future / _unwrap_1d.py View on Github external
@boost
def unwrap_1d(image: A, unwrapped_image: A):
    """Phase unwrapping using the naive approach."""
    unwrapped_image[0] = image[0]
    periods = 0
    for i in range(1, image.shape[0]):
        difference = image[i] - image[i - 1]
        if difference > pi:
            periods -= 1
        elif difference < -pi:
            periods += 1
        unwrapped_image[i] = image[i] + 2 * pi * periods
github fluiddyn / transonic / tmp / var_annot / simple.py View on Github external
@boost
def func(a: A):
    i: int
    n: int = a.shape[0]

    for i in range(n):
        a[i] = a[i] + 1.
github fluiddyn / transonic / doc / for_dev / scikit-image / future / _colormixer.py View on Github external
@boost(boundscheck=False, wraparound=False, cdivision=True, nonecheck=False)
def py_hsv_2_rgb(H: float, S: float, V: float):
    """Convert an HSV value to RGB.

    Automatic clipping.

    Parameters
    ----------
    H : float
        From 0. - 360.
    S : float
        From 0. - 1.
    V : float
        From 0. - 1.

    Returns
    -------