File: | /tmp/pyrefcon/scipy/scipy/optimize/_group_columns.cpp |
Warning: | line 631, column 25 PyObject ownership leak with reference count of 1 |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | #include <pythonic/core.hpp> | |||
2 | #include <pythonic/python/core.hpp> | |||
3 | #include <pythonic/types/bool.hpp> | |||
4 | #include <pythonic/types/int.hpp> | |||
5 | #ifdef _OPENMP | |||
6 | #include <omp.h> | |||
7 | #endif | |||
8 | #include <pythonic/include/types/ndarray.hpp> | |||
9 | #include <pythonic/include/types/int32.hpp> | |||
10 | #include <pythonic/include/types/numpy_texpr.hpp> | |||
11 | #include <pythonic/include/types/int.hpp> | |||
12 | #include <pythonic/types/int32.hpp> | |||
13 | #include <pythonic/types/ndarray.hpp> | |||
14 | #include <pythonic/types/int.hpp> | |||
15 | #include <pythonic/types/numpy_texpr.hpp> | |||
16 | #include <pythonic/include/builtins/False.hpp> | |||
17 | #include <pythonic/include/builtins/True.hpp> | |||
18 | #include <pythonic/include/builtins/getattr.hpp> | |||
19 | #include <pythonic/include/builtins/pythran/and_.hpp> | |||
20 | #include <pythonic/include/builtins/range.hpp> | |||
21 | #include <pythonic/include/builtins/tuple.hpp> | |||
22 | #include <pythonic/include/numpy/empty.hpp> | |||
23 | #include <pythonic/include/numpy/intp.hpp> | |||
24 | #include <pythonic/include/numpy/ndarray/fill.hpp> | |||
25 | #include <pythonic/include/numpy/ones.hpp> | |||
26 | #include <pythonic/include/operator_/add.hpp> | |||
27 | #include <pythonic/include/operator_/eq.hpp> | |||
28 | #include <pythonic/include/operator_/ge.hpp> | |||
29 | #include <pythonic/include/operator_/gt.hpp> | |||
30 | #include <pythonic/include/operator_/iadd.hpp> | |||
31 | #include <pythonic/include/operator_/lt.hpp> | |||
32 | #include <pythonic/include/operator_/neg.hpp> | |||
33 | #include <pythonic/include/operator_/not_.hpp> | |||
34 | #include <pythonic/include/types/slice.hpp> | |||
35 | #include <pythonic/include/types/str.hpp> | |||
36 | #include <pythonic/builtins/False.hpp> | |||
37 | #include <pythonic/builtins/True.hpp> | |||
38 | #include <pythonic/builtins/getattr.hpp> | |||
39 | #include <pythonic/builtins/pythran/and_.hpp> | |||
40 | #include <pythonic/builtins/range.hpp> | |||
41 | #include <pythonic/builtins/tuple.hpp> | |||
42 | #include <pythonic/numpy/empty.hpp> | |||
43 | #include <pythonic/numpy/intp.hpp> | |||
44 | #include <pythonic/numpy/ndarray/fill.hpp> | |||
45 | #include <pythonic/numpy/ones.hpp> | |||
46 | #include <pythonic/operator_/add.hpp> | |||
47 | #include <pythonic/operator_/eq.hpp> | |||
48 | #include <pythonic/operator_/ge.hpp> | |||
49 | #include <pythonic/operator_/gt.hpp> | |||
50 | #include <pythonic/operator_/iadd.hpp> | |||
51 | #include <pythonic/operator_/lt.hpp> | |||
52 | #include <pythonic/operator_/neg.hpp> | |||
53 | #include <pythonic/operator_/not_.hpp> | |||
54 | #include <pythonic/types/slice.hpp> | |||
55 | #include <pythonic/types/str.hpp> | |||
56 | namespace __pythran__group_columns | |||
57 | { | |||
58 | struct group_sparse | |||
59 | { | |||
60 | typedef void callable; | |||
61 | typedef void pure; | |||
62 | template <typename argument_type0 , typename argument_type1 , typename argument_type2 , typename argument_type3 > | |||
63 | struct type | |||
64 | { | |||
65 | typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::ones{})>::type>::type __type0; | |||
66 | typedef typename std::remove_cv<typename std::remove_reference<argument_type1>::type>::type __type1; | |||
67 | typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::intp{})>::type>::type __type2; | |||
68 | typedef decltype(std::declval<__type0>()(std::declval<__type1>(), std::declval<__type2>())) __type3; | |||
69 | typedef typename pythonic::assignable<decltype(pythonic::operator_::neg(std::declval<__type3>()))>::type __type4; | |||
70 | typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::builtins::functor::range{})>::type>::type __type5; | |||
71 | typedef decltype(std::declval<__type5>()(std::declval<__type1>())) __type7; | |||
72 | typedef typename std::remove_cv<typename std::iterator_traits<typename std::remove_reference<__type7>::type::iterator>::value_type>::type __type8; | |||
73 | typedef indexable<__type8> __type9; | |||
74 | typedef typename __combined<__type4,__type9>::type __type10; | |||
75 | typedef typename pythonic::assignable<long>::type __type11; | |||
76 | typedef container<typename std::remove_reference<__type11>::type> __type12; | |||
77 | typedef typename __combined<__type10,__type12,__type9,__type12>::type __type13; | |||
78 | typedef decltype(pythonic::builtins::getattr(pythonic::types::attr::SHAPE{}, std::declval<__type13>())) __type14; | |||
79 | typedef typename std::tuple_element<0,typename std::remove_reference<__type14>::type>::type __type15; | |||
80 | typedef decltype(std::declval<__type5>()(std::declval<__type15>())) __type16; | |||
81 | typedef typename std::remove_cv<typename std::iterator_traits<typename std::remove_reference<__type16>::type::iterator>::value_type>::type __type17; | |||
82 | typedef indexable<__type17> __type18; | |||
83 | typedef typename __combined<__type10,__type18>::type __type19; | |||
84 | typedef typename pythonic::returnable<typename __combined<__type19,__type12,__type9,__type12,__type18>::type>::type result_type; | |||
85 | } | |||
86 | ; | |||
87 | template <typename argument_type0 , typename argument_type1 , typename argument_type2 , typename argument_type3 > | |||
88 | typename type<argument_type0, argument_type1, argument_type2, argument_type3>::result_type operator()(argument_type0&& m, argument_type1&& n, argument_type2&& indices, argument_type3&& indptr) const | |||
89 | ; | |||
90 | } ; | |||
91 | struct group_dense | |||
92 | { | |||
93 | typedef void callable; | |||
94 | typedef void pure; | |||
95 | template <typename argument_type0 , typename argument_type1 , typename argument_type2 > | |||
96 | struct type | |||
97 | { | |||
98 | typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::ones{})>::type>::type __type0; | |||
99 | typedef typename std::remove_cv<typename std::remove_reference<argument_type1>::type>::type __type1; | |||
100 | typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::intp{})>::type>::type __type2; | |||
101 | typedef decltype(std::declval<__type0>()(std::declval<__type1>(), std::declval<__type2>())) __type3; | |||
102 | typedef typename pythonic::assignable<decltype(pythonic::operator_::neg(std::declval<__type3>()))>::type __type4; | |||
103 | typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::builtins::functor::range{})>::type>::type __type5; | |||
104 | typedef decltype(std::declval<__type5>()(std::declval<__type1>())) __type7; | |||
105 | typedef typename std::remove_cv<typename std::iterator_traits<typename std::remove_reference<__type7>::type::iterator>::value_type>::type __type8; | |||
106 | typedef indexable<__type8> __type9; | |||
107 | typedef typename __combined<__type4,__type9>::type __type10; | |||
108 | typedef typename pythonic::assignable<long>::type __type11; | |||
109 | typedef container<typename std::remove_reference<__type11>::type> __type12; | |||
110 | typedef typename __combined<__type10,__type12,__type9,__type12>::type __type13; | |||
111 | typedef decltype(pythonic::builtins::getattr(pythonic::types::attr::SHAPE{}, std::declval<__type13>())) __type14; | |||
112 | typedef typename std::tuple_element<0,typename std::remove_reference<__type14>::type>::type __type15; | |||
113 | typedef decltype(std::declval<__type5>()(std::declval<__type15>())) __type16; | |||
114 | typedef typename std::remove_cv<typename std::iterator_traits<typename std::remove_reference<__type16>::type::iterator>::value_type>::type __type17; | |||
115 | typedef indexable<__type17> __type18; | |||
116 | typedef typename __combined<__type10,__type18>::type __type19; | |||
117 | typedef typename pythonic::returnable<typename __combined<__type19,__type12,__type9,__type12,__type18>::type>::type result_type; | |||
118 | } | |||
119 | ; | |||
120 | template <typename argument_type0 , typename argument_type1 , typename argument_type2 > | |||
121 | typename type<argument_type0, argument_type1, argument_type2>::result_type operator()(argument_type0&& m, argument_type1&& n, argument_type2&& A) const | |||
122 | ; | |||
123 | } ; | |||
124 | template <typename argument_type0 , typename argument_type1 , typename argument_type2 , typename argument_type3 > | |||
125 | typename group_sparse::type<argument_type0, argument_type1, argument_type2, argument_type3>::result_type group_sparse::operator()(argument_type0&& m, argument_type1&& n, argument_type2&& indices, argument_type3&& indptr) const | |||
126 | { | |||
127 | typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::ones{})>::type>::type __type0; | |||
128 | typedef typename std::remove_cv<typename std::remove_reference<argument_type1>::type>::type __type1; | |||
129 | typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::intp{})>::type>::type __type2; | |||
130 | typedef decltype(std::declval<__type0>()(std::declval<__type1>(), std::declval<__type2>())) __type3; | |||
131 | typedef typename pythonic::assignable<decltype(pythonic::operator_::neg(std::declval<__type3>()))>::type __type4; | |||
132 | typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::builtins::functor::range{})>::type>::type __type5; | |||
133 | typedef decltype(std::declval<__type5>()(std::declval<__type1>())) __type7; | |||
134 | typedef typename std::remove_cv<typename std::iterator_traits<typename std::remove_reference<__type7>::type::iterator>::value_type>::type __type8; | |||
135 | typedef indexable<__type8> __type9; | |||
136 | typedef typename __combined<__type4,__type9>::type __type10; | |||
137 | typedef typename pythonic::assignable<long>::type __type11; | |||
138 | typedef long __type12; | |||
139 | typedef decltype(pythonic::operator_::add(std::declval<__type11>(), std::declval<__type12>())) __type13; | |||
140 | typedef typename __combined<__type11,__type13>::type __type14; | |||
141 | typedef typename __combined<__type14,__type12>::type __type15; | |||
142 | typedef container<typename std::remove_reference<__type15>::type> __type16; | |||
143 | typedef typename __combined<__type10,__type16,__type9,__type16>::type __type17; | |||
144 | typedef decltype(pythonic::builtins::getattr(pythonic::types::attr::SHAPE{}, std::declval<__type17>())) __type18; | |||
145 | typedef typename std::tuple_element<0,typename std::remove_reference<__type18>::type>::type __type19; | |||
146 | typedef decltype(std::declval<__type5>()(std::declval<__type19>())) __type20; | |||
147 | typedef typename std::remove_cv<typename std::iterator_traits<typename std::remove_reference<__type20>::type::iterator>::value_type>::type __type21; | |||
148 | typedef indexable<__type21> __type22; | |||
149 | typedef typename __combined<__type10,__type22>::type __type23; | |||
150 | typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::empty{})>::type>::type __type26; | |||
151 | typedef typename std::remove_cv<typename std::remove_reference<argument_type0>::type>::type __type27; | |||
152 | typedef typename pythonic::assignable<decltype(std::declval<__type26>()(std::declval<__type27>(), std::declval<__type2>()))>::type __type28; | |||
153 | typedef typename std::remove_cv<typename std::remove_reference<argument_type2>::type>::type __type29; | |||
154 | typedef typename std::remove_cv<typename std::remove_reference<argument_type3>::type>::type __type30; | |||
155 | typedef decltype(std::declval<__type30>()[std::declval<__type8>()]) __type32; | |||
156 | typedef decltype(pythonic::operator_::add(std::declval<__type8>(), std::declval<__type12>())) __type35; | |||
157 | typedef decltype(std::declval<__type30>()[std::declval<__type35>()]) __type36; | |||
158 | typedef decltype(std::declval<__type5>()(std::declval<__type32>(), std::declval<__type36>())) __type37; | |||
159 | typedef typename std::remove_cv<typename std::iterator_traits<typename std::remove_reference<__type37>::type::iterator>::value_type>::type __type38; | |||
160 | typedef decltype(std::declval<__type29>()[std::declval<__type38>()]) __type39; | |||
161 | typedef indexable<__type39> __type40; | |||
162 | typedef typename __combined<__type28,__type40>::type __type41; | |||
163 | typedef decltype(std::declval<__type30>()[std::declval<__type21>()]) __type45; | |||
164 | typedef decltype(pythonic::operator_::add(std::declval<__type21>(), std::declval<__type12>())) __type48; | |||
165 | typedef decltype(std::declval<__type30>()[std::declval<__type48>()]) __type49; | |||
166 | typedef decltype(std::declval<__type5>()(std::declval<__type45>(), std::declval<__type49>())) __type50; | |||
167 | typedef typename std::remove_cv<typename std::iterator_traits<typename std::remove_reference<__type50>::type::iterator>::value_type>::type __type51; | |||
168 | typedef decltype(std::declval<__type29>()[std::declval<__type51>()]) __type52; | |||
169 | typedef indexable<__type52> __type53; | |||
170 | typedef typename __combined<__type41,__type53>::type __type54; | |||
171 | typedef container<typename std::remove_reference<__type12>::type> __type55; | |||
172 | typename pythonic::assignable<typename __combined<__type23,__type16,__type9,__type16,__type22>::type>::type groups = pythonic::operator_::neg(pythonic::numpy::functor::ones{}(n, pythonic::numpy::functor::intp{})); | |||
173 | typename pythonic::assignable<typename __combined<__type14,__type12>::type>::type current_group = 0L; | |||
174 | typename pythonic::assignable<typename __combined<__type54,__type55,__type40,__type53>::type>::type union_ = pythonic::numpy::functor::empty{}(m, pythonic::numpy::functor::intp{}); | |||
175 | { | |||
176 | long __target139669610893520 = n; | |||
177 | for (long i=0L; i < __target139669610893520; i += 1L) | |||
178 | { | |||
179 | if (pythonic::operator_::ge(groups.fast(i), 0L)) | |||
180 | { | |||
181 | continue; | |||
182 | } | |||
183 | groups.fast(i) = current_group; | |||
184 | typename pythonic::lazy<decltype(pythonic::builtins::True)>::type all_grouped = pythonic::builtins::True; | |||
185 | pythonic::numpy::ndarray::functor::fill{}(union_, 0L); | |||
186 | { | |||
187 | long __target139669610897072 = indptr.fast(pythonic::operator_::add(i, 1L)); | |||
188 | for (long k=indptr.fast(i); k < __target139669610897072; k += 1L) | |||
189 | { | |||
190 | union_[indices[k]] = 1L; | |||
191 | } | |||
192 | } | |||
193 | { | |||
194 | long __target139669610897120 = std::get<0>(pythonic::builtins::getattr(pythonic::types::attr::SHAPE{}, groups)); | |||
195 | for (long j=0L; j < __target139669610897120; j += 1L) | |||
196 | { | |||
197 | if (pythonic::operator_::lt(groups.fast(j), 0L)) | |||
198 | { | |||
199 | all_grouped = pythonic::builtins::False; | |||
200 | } | |||
201 | else | |||
202 | { | |||
203 | continue; | |||
204 | } | |||
205 | typename pythonic::lazy<decltype(pythonic::builtins::False)>::type intersect = pythonic::builtins::False; | |||
206 | { | |||
207 | long __target139669610913360 = indptr.fast(pythonic::operator_::add(j, 1L)); | |||
208 | for (long k_=indptr.fast(j); k_ < __target139669610913360; k_ += 1L) | |||
209 | { | |||
210 | if (pythonic::operator_::eq(union_[indices[k_]], 1L)) | |||
211 | { | |||
212 | intersect = pythonic::builtins::True; | |||
213 | break; | |||
214 | } | |||
215 | } | |||
216 | } | |||
217 | if (pythonic::operator_::not_(intersect)) | |||
218 | { | |||
219 | { | |||
220 | long __target139669610938080 = indptr.fast(pythonic::operator_::add(j, 1L)); | |||
221 | for (long k__=indptr.fast(j); k__ < __target139669610938080; k__ += 1L) | |||
222 | { | |||
223 | union_[indices[k__]] = 1L; | |||
224 | } | |||
225 | } | |||
226 | groups.fast(j) = current_group; | |||
227 | } | |||
228 | } | |||
229 | } | |||
230 | if (all_grouped) | |||
231 | { | |||
232 | break; | |||
233 | } | |||
234 | else | |||
235 | { | |||
236 | current_group += 1L; | |||
237 | } | |||
238 | } | |||
239 | } | |||
240 | return groups; | |||
241 | } | |||
242 | template <typename argument_type0 , typename argument_type1 , typename argument_type2 > | |||
243 | typename group_dense::type<argument_type0, argument_type1, argument_type2>::result_type group_dense::operator()(argument_type0&& m, argument_type1&& n, argument_type2&& A) const | |||
244 | { | |||
245 | typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::ones{})>::type>::type __type0; | |||
246 | typedef typename std::remove_cv<typename std::remove_reference<argument_type1>::type>::type __type1; | |||
247 | typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::intp{})>::type>::type __type2; | |||
248 | typedef decltype(std::declval<__type0>()(std::declval<__type1>(), std::declval<__type2>())) __type3; | |||
249 | typedef typename pythonic::assignable<decltype(pythonic::operator_::neg(std::declval<__type3>()))>::type __type4; | |||
250 | typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::builtins::functor::range{})>::type>::type __type5; | |||
251 | typedef decltype(std::declval<__type5>()(std::declval<__type1>())) __type7; | |||
252 | typedef typename std::remove_cv<typename std::iterator_traits<typename std::remove_reference<__type7>::type::iterator>::value_type>::type __type8; | |||
253 | typedef indexable<__type8> __type9; | |||
254 | typedef typename __combined<__type4,__type9>::type __type10; | |||
255 | typedef typename pythonic::assignable<long>::type __type11; | |||
256 | typedef long __type12; | |||
257 | typedef decltype(pythonic::operator_::add(std::declval<__type11>(), std::declval<__type12>())) __type13; | |||
258 | typedef typename __combined<__type11,__type13>::type __type14; | |||
259 | typedef typename __combined<__type14,__type12>::type __type15; | |||
260 | typedef container<typename std::remove_reference<__type15>::type> __type16; | |||
261 | typedef typename __combined<__type10,__type16,__type9,__type16>::type __type17; | |||
262 | typedef decltype(pythonic::builtins::getattr(pythonic::types::attr::SHAPE{}, std::declval<__type17>())) __type18; | |||
263 | typedef typename std::tuple_element<0,typename std::remove_reference<__type18>::type>::type __type19; | |||
264 | typedef decltype(std::declval<__type5>()(std::declval<__type19>())) __type20; | |||
265 | typedef typename std::remove_cv<typename std::iterator_traits<typename std::remove_reference<__type20>::type::iterator>::value_type>::type __type21; | |||
266 | typedef indexable<__type21> __type22; | |||
267 | typedef typename __combined<__type10,__type22>::type __type23; | |||
268 | typedef typename std::remove_cv<typename std::remove_reference<decltype(pythonic::numpy::functor::empty{})>::type>::type __type26; | |||
269 | typedef typename std::remove_cv<typename std::remove_reference<argument_type0>::type>::type __type27; | |||
270 | typedef typename pythonic::assignable<decltype(std::declval<__type26>()(std::declval<__type27>(), std::declval<__type2>()))>::type __type28; | |||
271 | typedef typename std::remove_cv<typename std::remove_reference<argument_type2>::type>::type __type29; | |||
272 | typedef typename pythonic::assignable<decltype(pythonic::builtins::getattr(pythonic::types::attr::T{}, std::declval<__type29>()))>::type __type30; | |||
273 | typedef decltype(std::declval<__type30>()[std::declval<__type21>()]) __type32; | |||
274 | typedef decltype(pythonic::operator_::add(std::declval<__type28>(), std::declval<__type32>())) __type33; | |||
275 | typedef typename __combined<__type28,__type33>::type __type34; | |||
276 | typedef decltype(std::declval<__type30>()[std::declval<__type8>()]) __type37; | |||
277 | typename pythonic::assignable_noescape<decltype(pythonic::builtins::getattr(pythonic::types::attr::T{}, A))>::type B = pythonic::builtins::getattr(pythonic::types::attr::T{}, A); | |||
278 | typename pythonic::assignable<typename __combined<__type23,__type16,__type9,__type16,__type22>::type>::type groups = pythonic::operator_::neg(pythonic::numpy::functor::ones{}(n, pythonic::numpy::functor::intp{})); | |||
279 | typename pythonic::assignable<typename __combined<__type14,__type12>::type>::type current_group = 0L; | |||
280 | typename pythonic::assignable<typename __combined<__type34,__type37,__type32>::type>::type union_ = pythonic::numpy::functor::empty{}(m, pythonic::numpy::functor::intp{}); | |||
281 | { | |||
282 | long __target139669605474208 = n; | |||
283 | for (long i=0L; i < __target139669605474208; i += 1L) | |||
284 | { | |||
285 | if (pythonic::operator_::ge(groups.fast(i), 0L)) | |||
286 | { | |||
287 | continue; | |||
288 | } | |||
289 | groups.fast(i) = current_group; | |||
290 | typename pythonic::lazy<decltype(pythonic::builtins::True)>::type all_grouped = pythonic::builtins::True; | |||
291 | union_[pythonic::types::contiguous_slice(pythonic::builtins::None,pythonic::builtins::None)] = B.fast(i); | |||
292 | { | |||
293 | long __target139669595736864 = std::get<0>(pythonic::builtins::getattr(pythonic::types::attr::SHAPE{}, groups)); | |||
294 | for (long j=0L; j < __target139669595736864; j += 1L) | |||
295 | { | |||
296 | if (pythonic::operator_::lt(groups.fast(j), 0L)) | |||
297 | { | |||
298 | all_grouped = pythonic::builtins::False; | |||
299 | } | |||
300 | else | |||
301 | { | |||
302 | continue; | |||
303 | } | |||
304 | typename pythonic::lazy<decltype(pythonic::builtins::False)>::type intersect = pythonic::builtins::False; | |||
305 | { | |||
306 | long __target139669595833104 = m; | |||
307 | for (long k=0L; k < __target139669595833104; k += 1L) | |||
308 | { | |||
309 | if (pythonic::builtins::pythran::and_([&] () { return pythonic::operator_::gt(union_.fast(k), 0L); }, [&] () { return pythonic::operator_::gt(B.fast(pythonic::types::make_tuple(j, k)), 0L); })) | |||
310 | { | |||
311 | intersect = pythonic::builtins::True; | |||
312 | break; | |||
313 | } | |||
314 | } | |||
315 | } | |||
316 | if (pythonic::operator_::not_(intersect)) | |||
317 | { | |||
318 | union_ += B.fast(j); | |||
319 | groups.fast(j) = current_group; | |||
320 | } | |||
321 | } | |||
322 | } | |||
323 | if (all_grouped) | |||
324 | { | |||
325 | break; | |||
326 | } | |||
327 | else | |||
328 | { | |||
329 | current_group += 1L; | |||
330 | } | |||
331 | } | |||
332 | } | |||
333 | return groups; | |||
334 | } | |||
335 | } | |||
336 | #include <pythonic/python/exception_handler.hpp> | |||
337 | #ifdef ENABLE_PYTHON_MODULE1 | |||
338 | typename __pythran__group_columns::group_sparse::type<long, long, pythonic::types::ndarray<long,pythonic::types::pshape<long>>, pythonic::types::ndarray<long,pythonic::types::pshape<long>>>::result_type group_sparse0(long&& m, long&& n, pythonic::types::ndarray<long,pythonic::types::pshape<long>>&& indices, pythonic::types::ndarray<long,pythonic::types::pshape<long>>&& indptr) | |||
339 | { | |||
340 | ||||
341 | PyThreadState *_save = PyEval_SaveThread(); | |||
342 | try { | |||
343 | auto res = __pythran__group_columns::group_sparse()(m, n, indices, indptr); | |||
344 | PyEval_RestoreThread(_save); | |||
345 | return res; | |||
346 | } | |||
347 | catch(...) { | |||
348 | PyEval_RestoreThread(_save); | |||
349 | throw; | |||
350 | } | |||
351 | ; | |||
352 | } | |||
353 | typename __pythran__group_columns::group_sparse::type<long, long, pythonic::types::ndarray<npy_int32,pythonic::types::pshape<long>>, pythonic::types::ndarray<npy_int32,pythonic::types::pshape<long>>>::result_type group_sparse1(long&& m, long&& n, pythonic::types::ndarray<npy_int32,pythonic::types::pshape<long>>&& indices, pythonic::types::ndarray<npy_int32,pythonic::types::pshape<long>>&& indptr) | |||
354 | { | |||
355 | ||||
356 | PyThreadState *_save = PyEval_SaveThread(); | |||
357 | try { | |||
358 | auto res = __pythran__group_columns::group_sparse()(m, n, indices, indptr); | |||
359 | PyEval_RestoreThread(_save); | |||
360 | return res; | |||
361 | } | |||
362 | catch(...) { | |||
363 | PyEval_RestoreThread(_save); | |||
364 | throw; | |||
365 | } | |||
366 | ; | |||
367 | } | |||
368 | typename __pythran__group_columns::group_dense::type<long, long, pythonic::types::ndarray<long,pythonic::types::pshape<long,long>>>::result_type group_dense0(long&& m, long&& n, pythonic::types::ndarray<long,pythonic::types::pshape<long,long>>&& A) | |||
369 | { | |||
370 | ||||
371 | PyThreadState *_save = PyEval_SaveThread(); | |||
372 | try { | |||
373 | auto res = __pythran__group_columns::group_dense()(m, n, A); | |||
374 | PyEval_RestoreThread(_save); | |||
375 | return res; | |||
376 | } | |||
377 | catch(...) { | |||
378 | PyEval_RestoreThread(_save); | |||
379 | throw; | |||
380 | } | |||
381 | ; | |||
382 | } | |||
383 | typename __pythran__group_columns::group_dense::type<long, long, pythonic::types::numpy_texpr<pythonic::types::ndarray<long,pythonic::types::pshape<long,long>>>>::result_type group_dense1(long&& m, long&& n, pythonic::types::numpy_texpr<pythonic::types::ndarray<long,pythonic::types::pshape<long,long>>>&& A) | |||
384 | { | |||
385 | ||||
386 | PyThreadState *_save = PyEval_SaveThread(); | |||
387 | try { | |||
388 | auto res = __pythran__group_columns::group_dense()(m, n, A); | |||
389 | PyEval_RestoreThread(_save); | |||
390 | return res; | |||
391 | } | |||
392 | catch(...) { | |||
393 | PyEval_RestoreThread(_save); | |||
394 | throw; | |||
395 | } | |||
396 | ; | |||
397 | } | |||
398 | typename __pythran__group_columns::group_dense::type<long, long, pythonic::types::ndarray<npy_int32,pythonic::types::pshape<long,long>>>::result_type group_dense2(long&& m, long&& n, pythonic::types::ndarray<npy_int32,pythonic::types::pshape<long,long>>&& A) | |||
399 | { | |||
400 | ||||
401 | PyThreadState *_save = PyEval_SaveThread(); | |||
402 | try { | |||
403 | auto res = __pythran__group_columns::group_dense()(m, n, A); | |||
404 | PyEval_RestoreThread(_save); | |||
405 | return res; | |||
406 | } | |||
407 | catch(...) { | |||
408 | PyEval_RestoreThread(_save); | |||
409 | throw; | |||
410 | } | |||
411 | ; | |||
412 | } | |||
413 | typename __pythran__group_columns::group_dense::type<long, long, pythonic::types::numpy_texpr<pythonic::types::ndarray<npy_int32,pythonic::types::pshape<long,long>>>>::result_type group_dense3(long&& m, long&& n, pythonic::types::numpy_texpr<pythonic::types::ndarray<npy_int32,pythonic::types::pshape<long,long>>>&& A) | |||
414 | { | |||
415 | ||||
416 | PyThreadState *_save = PyEval_SaveThread(); | |||
417 | try { | |||
418 | auto res = __pythran__group_columns::group_dense()(m, n, A); | |||
419 | PyEval_RestoreThread(_save); | |||
420 | return res; | |||
421 | } | |||
422 | catch(...) { | |||
423 | PyEval_RestoreThread(_save); | |||
424 | throw; | |||
425 | } | |||
426 | ; | |||
427 | } | |||
428 | ||||
429 | static PyObject * | |||
430 | __pythran_wrap_group_sparse0(PyObject *self, PyObject *args, PyObject *kw) | |||
431 | { | |||
432 | PyObject* args_obj[4+1]; | |||
433 | ||||
434 | char const* keywords[] = {"m", "n", "indices", "indptr", nullptr}; | |||
435 | if(! PyArg_ParseTupleAndKeywords(args, kw, "OOOO", | |||
436 | (char**)keywords , &args_obj[0], &args_obj[1], &args_obj[2], &args_obj[3])) | |||
437 | return nullptr; | |||
438 | if(is_convertible<long>(args_obj[0]) && is_convertible<long>(args_obj[1]) && is_convertible<pythonic::types::ndarray<long,pythonic::types::pshape<long>>>(args_obj[2]) && is_convertible<pythonic::types::ndarray<long,pythonic::types::pshape<long>>>(args_obj[3])) | |||
439 | return to_python(group_sparse0(from_python<long>(args_obj[0]), from_python<long>(args_obj[1]), from_python<pythonic::types::ndarray<long,pythonic::types::pshape<long>>>(args_obj[2]), from_python<pythonic::types::ndarray<long,pythonic::types::pshape<long>>>(args_obj[3]))); | |||
440 | else { | |||
441 | return nullptr; | |||
442 | } | |||
443 | } | |||
444 | ||||
445 | static PyObject * | |||
446 | __pythran_wrap_group_sparse1(PyObject *self, PyObject *args, PyObject *kw) | |||
447 | { | |||
448 | PyObject* args_obj[4+1]; | |||
449 | ||||
450 | char const* keywords[] = {"m", "n", "indices", "indptr", nullptr}; | |||
451 | if(! PyArg_ParseTupleAndKeywords(args, kw, "OOOO", | |||
452 | (char**)keywords , &args_obj[0], &args_obj[1], &args_obj[2], &args_obj[3])) | |||
453 | return nullptr; | |||
454 | if(is_convertible<long>(args_obj[0]) && is_convertible<long>(args_obj[1]) && is_convertible<pythonic::types::ndarray<npy_int32,pythonic::types::pshape<long>>>(args_obj[2]) && is_convertible<pythonic::types::ndarray<npy_int32,pythonic::types::pshape<long>>>(args_obj[3])) | |||
455 | return to_python(group_sparse1(from_python<long>(args_obj[0]), from_python<long>(args_obj[1]), from_python<pythonic::types::ndarray<npy_int32,pythonic::types::pshape<long>>>(args_obj[2]), from_python<pythonic::types::ndarray<npy_int32,pythonic::types::pshape<long>>>(args_obj[3]))); | |||
456 | else { | |||
457 | return nullptr; | |||
458 | } | |||
459 | } | |||
460 | ||||
461 | static PyObject * | |||
462 | __pythran_wrap_group_dense0(PyObject *self, PyObject *args, PyObject *kw) | |||
463 | { | |||
464 | PyObject* args_obj[3+1]; | |||
465 | ||||
466 | char const* keywords[] = {"m", "n", "A", nullptr}; | |||
467 | if(! PyArg_ParseTupleAndKeywords(args, kw, "OOO", | |||
468 | (char**)keywords , &args_obj[0], &args_obj[1], &args_obj[2])) | |||
469 | return nullptr; | |||
470 | if(is_convertible<long>(args_obj[0]) && is_convertible<long>(args_obj[1]) && is_convertible<pythonic::types::ndarray<long,pythonic::types::pshape<long,long>>>(args_obj[2])) | |||
471 | return to_python(group_dense0(from_python<long>(args_obj[0]), from_python<long>(args_obj[1]), from_python<pythonic::types::ndarray<long,pythonic::types::pshape<long,long>>>(args_obj[2]))); | |||
472 | else { | |||
473 | return nullptr; | |||
474 | } | |||
475 | } | |||
476 | ||||
477 | static PyObject * | |||
478 | __pythran_wrap_group_dense1(PyObject *self, PyObject *args, PyObject *kw) | |||
479 | { | |||
480 | PyObject* args_obj[3+1]; | |||
481 | ||||
482 | char const* keywords[] = {"m", "n", "A", nullptr}; | |||
483 | if(! PyArg_ParseTupleAndKeywords(args, kw, "OOO", | |||
484 | (char**)keywords , &args_obj[0], &args_obj[1], &args_obj[2])) | |||
485 | return nullptr; | |||
486 | if(is_convertible<long>(args_obj[0]) && is_convertible<long>(args_obj[1]) && is_convertible<pythonic::types::numpy_texpr<pythonic::types::ndarray<long,pythonic::types::pshape<long,long>>>>(args_obj[2])) | |||
487 | return to_python(group_dense1(from_python<long>(args_obj[0]), from_python<long>(args_obj[1]), from_python<pythonic::types::numpy_texpr<pythonic::types::ndarray<long,pythonic::types::pshape<long,long>>>>(args_obj[2]))); | |||
488 | else { | |||
489 | return nullptr; | |||
490 | } | |||
491 | } | |||
492 | ||||
493 | static PyObject * | |||
494 | __pythran_wrap_group_dense2(PyObject *self, PyObject *args, PyObject *kw) | |||
495 | { | |||
496 | PyObject* args_obj[3+1]; | |||
497 | ||||
498 | char const* keywords[] = {"m", "n", "A", nullptr}; | |||
499 | if(! PyArg_ParseTupleAndKeywords(args, kw, "OOO", | |||
500 | (char**)keywords , &args_obj[0], &args_obj[1], &args_obj[2])) | |||
501 | return nullptr; | |||
502 | if(is_convertible<long>(args_obj[0]) && is_convertible<long>(args_obj[1]) && is_convertible<pythonic::types::ndarray<npy_int32,pythonic::types::pshape<long,long>>>(args_obj[2])) | |||
503 | return to_python(group_dense2(from_python<long>(args_obj[0]), from_python<long>(args_obj[1]), from_python<pythonic::types::ndarray<npy_int32,pythonic::types::pshape<long,long>>>(args_obj[2]))); | |||
504 | else { | |||
505 | return nullptr; | |||
506 | } | |||
507 | } | |||
508 | ||||
509 | static PyObject * | |||
510 | __pythran_wrap_group_dense3(PyObject *self, PyObject *args, PyObject *kw) | |||
511 | { | |||
512 | PyObject* args_obj[3+1]; | |||
513 | ||||
514 | char const* keywords[] = {"m", "n", "A", nullptr}; | |||
515 | if(! PyArg_ParseTupleAndKeywords(args, kw, "OOO", | |||
516 | (char**)keywords , &args_obj[0], &args_obj[1], &args_obj[2])) | |||
517 | return nullptr; | |||
518 | if(is_convertible<long>(args_obj[0]) && is_convertible<long>(args_obj[1]) && is_convertible<pythonic::types::numpy_texpr<pythonic::types::ndarray<npy_int32,pythonic::types::pshape<long,long>>>>(args_obj[2])) | |||
519 | return to_python(group_dense3(from_python<long>(args_obj[0]), from_python<long>(args_obj[1]), from_python<pythonic::types::numpy_texpr<pythonic::types::ndarray<npy_int32,pythonic::types::pshape<long,long>>>>(args_obj[2]))); | |||
520 | else { | |||
521 | return nullptr; | |||
522 | } | |||
523 | } | |||
524 | ||||
525 | static PyObject * | |||
526 | __pythran_wrapall_group_sparse(PyObject *self, PyObject *args, PyObject *kw) | |||
527 | { | |||
528 | return pythonic::handle_python_exception([self, args, kw]() | |||
529 | -> PyObject* { | |||
530 | ||||
531 | if(PyObject* obj = __pythran_wrap_group_sparse0(self, args, kw)) | |||
532 | return obj; | |||
533 | PyErr_Clear(); | |||
534 | ||||
535 | ||||
536 | if(PyObject* obj = __pythran_wrap_group_sparse1(self, args, kw)) | |||
537 | return obj; | |||
538 | PyErr_Clear(); | |||
539 | ||||
540 | return pythonic::python::raise_invalid_argument( | |||
541 | "group_sparse", "\n"" - group_sparse(int, int, int[:], int[:])\n"" - group_sparse(int, int, int32[:], int32[:])", args, kw); | |||
542 | }); | |||
543 | } | |||
544 | ||||
545 | ||||
546 | static PyObject * | |||
547 | __pythran_wrapall_group_dense(PyObject *self, PyObject *args, PyObject *kw) | |||
548 | { | |||
549 | return pythonic::handle_python_exception([self, args, kw]() | |||
550 | -> PyObject* { | |||
551 | ||||
552 | if(PyObject* obj = __pythran_wrap_group_dense0(self, args, kw)) | |||
553 | return obj; | |||
554 | PyErr_Clear(); | |||
555 | ||||
556 | ||||
557 | if(PyObject* obj = __pythran_wrap_group_dense1(self, args, kw)) | |||
558 | return obj; | |||
559 | PyErr_Clear(); | |||
560 | ||||
561 | ||||
562 | if(PyObject* obj = __pythran_wrap_group_dense2(self, args, kw)) | |||
563 | return obj; | |||
564 | PyErr_Clear(); | |||
565 | ||||
566 | ||||
567 | if(PyObject* obj = __pythran_wrap_group_dense3(self, args, kw)) | |||
568 | return obj; | |||
569 | PyErr_Clear(); | |||
570 | ||||
571 | return pythonic::python::raise_invalid_argument( | |||
572 | "group_dense", "\n"" - group_dense(int, int, int[:,:])\n"" - group_dense(int, int, int32[:,:])", args, kw); | |||
573 | }); | |||
574 | } | |||
575 | ||||
576 | ||||
577 | static PyMethodDef Methods[] = { | |||
578 | { | |||
579 | "group_sparse", | |||
580 | (PyCFunction)__pythran_wrapall_group_sparse, | |||
581 | METH_VARARGS0x0001 | METH_KEYWORDS0x0002, | |||
582 | "Supported prototypes:\n""\n"" - group_sparse(int, int, int[:], int[:])\n"" - group_sparse(int, int, int32[:], int32[:])"},{ | |||
583 | "group_dense", | |||
584 | (PyCFunction)__pythran_wrapall_group_dense, | |||
585 | METH_VARARGS0x0001 | METH_KEYWORDS0x0002, | |||
586 | "Supported prototypes:\n""\n"" - group_dense(int, int, int[:,:])\n"" - group_dense(int, int, int32[:,:])"}, | |||
587 | {NULL__null, NULL__null, 0, NULL__null} | |||
588 | }; | |||
589 | ||||
590 | ||||
591 | #if PY_MAJOR_VERSION3 >= 3 | |||
592 | static struct PyModuleDef moduledef = { | |||
593 | PyModuleDef_HEAD_INIT{ { 1, __null }, __null, 0, __null, }, | |||
594 | "_group_columns", /* m_name */ | |||
595 | "\n""Pythran implementation of columns grouping for finite difference Jacobian\n""estimation. Used by ._numdiff.group_columns and based on the Cython version.\n""", /* m_doc */ | |||
596 | -1, /* m_size */ | |||
597 | Methods, /* m_methods */ | |||
598 | NULL__null, /* m_reload */ | |||
599 | NULL__null, /* m_traverse */ | |||
600 | NULL__null, /* m_clear */ | |||
601 | NULL__null, /* m_free */ | |||
602 | }; | |||
603 | #define PYTHRAN_RETURNreturn theModule return theModule | |||
604 | #define PYTHRAN_MODULE_INIT(s)PyInit_s PyInit_##s | |||
605 | #else | |||
606 | #define PYTHRAN_RETURNreturn theModule return | |||
607 | #define PYTHRAN_MODULE_INIT(s)PyInit_s init##s | |||
608 | #endif | |||
609 | PyMODINIT_FUNCextern "C" PyObject* | |||
610 | PYTHRAN_MODULE_INIT(_group_columns)PyInit__group_columns(void) | |||
611 | #ifndef _WIN32 | |||
612 | __attribute__ ((visibility("default"))) | |||
613 | #if defined(GNUC) && !defined(__clang__1) | |||
614 | __attribute__ ((externally_visible)) | |||
615 | #endif | |||
616 | #endif | |||
617 | ; | |||
618 | PyMODINIT_FUNCextern "C" PyObject* | |||
619 | PYTHRAN_MODULE_INIT(_group_columns)PyInit__group_columns(void) { | |||
620 | import_array(){if (_import_array() < 0) {PyErr_Print(); PyErr_SetString( PyExc_ImportError, "numpy.core.multiarray failed to import"); return __null; } } | |||
| ||||
621 | #if PY_MAJOR_VERSION3 >= 3 | |||
622 | PyObject* theModule = PyModule_Create(&moduledef)PyModule_Create2(&moduledef, 1013); | |||
623 | #else | |||
624 | PyObject* theModule = Py_InitModule3("_group_columns", | |||
625 | Methods, | |||
626 | "\n""Pythran implementation of columns grouping for finite difference Jacobian\n""estimation. Used by ._numdiff.group_columns and based on the Cython version.\n""" | |||
627 | ); | |||
628 | #endif | |||
629 | if(! theModule) | |||
630 | PYTHRAN_RETURNreturn theModule; | |||
631 | PyObject * theDoc = Py_BuildValue("(sss)", | |||
| ||||
632 | "0.9.12", | |||
633 | "2021-07-14 11:02:32.015111", | |||
634 | "a53c0985fd17c87db53e7ebcc89cc4061afa755198524f12f74d09265ae2b18a"); | |||
635 | if(! theDoc) | |||
636 | PYTHRAN_RETURNreturn theModule; | |||
637 | PyModule_AddObject(theModule, | |||
638 | "__pythran__", | |||
639 | theDoc); | |||
640 | ||||
641 | ||||
642 | PYTHRAN_RETURNreturn theModule; | |||
643 | } | |||
644 | ||||
645 | #endif |
1 | #ifndef Py_BuildValue |
2 | struct _object; |
3 | typedef struct _object PyObject; |
4 | PyObject* clang_analyzer_PyObject_New_Reference(); |
5 | PyObject* Py_BuildValue(const char *format, ...) { |
6 | return clang_analyzer_PyObject_New_Reference(); |
7 | } |
8 | #else |
9 | #warning "API Py_BuildValue is defined as a macro." |
10 | #endif |