Skip to content

Commit 15e55b2

Browse files
committed
Merge branch 'topic/default/pythran-type' into 'branch/default'
Support for Pythran "type" Closes #60 See merge request fluiddyn/transonic!159
2 parents 83c7e8f + 301c8f6 commit 15e55b2

File tree

15 files changed

+133
-8
lines changed

15 files changed

+133
-8
lines changed

data_tests/literal_with_types.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from transonic import boost, Literal
2+
3+
4+
@boost
5+
def gen_seq(dtype: Literal[int, float], seq_type: Literal[list, set], n: int):
6+
return seq_type(map(dtype, range(n)))

data_tests/saved__backend__/cython/default_params.pxd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import cython
33
import numpy as np
44
cimport numpy as np
55

6-
ctypedef fused __func__Unionstr_None:
6+
ctypedef fused __func__Union_str_None:
77
cython.str
88

9-
cpdef func(cython.int a=*, __func__Unionstr_None b=*, cython.float c=*)
9+
cpdef func(cython.int a=*, __func__Union_str_None b=*, cython.float c=*)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import cython
2+
3+
import numpy as np
4+
cimport numpy as np
5+
6+
ctypedef fused __gen_seq__Literal_int_float:
7+
object
8+
9+
ctypedef fused __gen_seq__Literal_list_set:
10+
object
11+
12+
cpdef gen_seq(__gen_seq__Literal_int_float dtype, __gen_seq__Literal_list_set seq_type, cython.int n)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
try:
2+
import cython
3+
except ImportError:
4+
from transonic_cl import cython
5+
6+
7+
def gen_seq(dtype, seq_type, n):
8+
return seq_type(map(dtype, range(n)))
9+
10+
11+
def __transonic__():
12+
return "0.7.3"

data_tests/saved__backend__/cython/type_hint_notemplate.pxd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ ctypedef fused __compute__TypeIint_complex128I:
1313
cython.int
1414
np.complex128_t
1515

16-
ctypedef fused __compute__UnionArray_TypeIint_complex128I_NDimI1_3I_Array_float32_NDimI1_3Ip1:
16+
ctypedef fused __compute__Union_Array_TypeIint_complex128I_NDimI1_3I_Array_float32_NDimI1_3Ip1:
1717
np.ndarray[np.complex128_t, ndim=1]
1818
np.ndarray[np.complex128_t, ndim=3]
1919
np.ndarray[np.float32_t, ndim=2]
2020
np.ndarray[np.float32_t, ndim=4]
2121
np.ndarray[np.int32_t, ndim=1]
2222
np.ndarray[np.int32_t, ndim=3]
2323

24-
cpdef compute(__compute__Array_TypeIint_complex128I_NDimI1_3I a, __compute__Array_TypeIint_complex128I_NDimI1_3I b, __compute__TypeIint_complex128I c, __compute__UnionArray_TypeIint_complex128I_NDimI1_3I_Array_float32_NDimI1_3Ip1 d, cython.str e)
24+
cpdef compute(__compute__Array_TypeIint_complex128I_NDimI1_3I a, __compute__Array_TypeIint_complex128I_NDimI1_3I b, __compute__TypeIint_complex128I c, __compute__Union_Array_TypeIint_complex128I_NDimI1_3I_Array_float32_NDimI1_3Ip1 d, cython.str e)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# __protected__ from jax import jit
2+
# __protected__ @jit
3+
4+
5+
def gen_seq(dtype, seq_type, n):
6+
return seq_type(map(dtype, range(n)))
7+
8+
9+
def __transonic__():
10+
return "0.7.3"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# __protected__ from numba import njit
2+
# __protected__ @njit(cache=True, fastmath=True)
3+
4+
5+
def gen_seq(dtype, seq_type, n):
6+
return seq_type(map(dtype, range(n)))
7+
8+
9+
def __transonic__():
10+
return "0.7.3"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def gen_seq(dtype, seq_type, n):
2+
return seq_type(map(dtype, range(n)))
3+
4+
5+
def __transonic__():
6+
return "0.7.3"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def gen_seq(dtype, seq_type, n):
2+
return seq_type(map(dtype, range(n)))
3+
4+
5+
def __transonic__():
6+
return "0.7.3"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export gen_seq(float64 type, list type, int)
2+
export gen_seq(float64 type, set type, int)
3+
export gen_seq(int type, list type, int)
4+
export gen_seq(int type, set type, int)
5+
6+
export __transonic__()

0 commit comments

Comments
 (0)