Update to isl-0.20-35-ge0a98b62
[polly-mirror.git] / lib / External / isl / interface / isl.py
blobb6607720e1bd6e59f562a075df039a60f1e994bd
1 from ctypes import *
3 isl = cdll.LoadLibrary("libisl.so")
4 libc = cdll.LoadLibrary("libc.so.6")
6 class Error(Exception):
7 pass
9 class Context:
10 defaultInstance = None
12 def __init__(self):
13 ptr = isl.isl_ctx_alloc()
14 self.ptr = ptr
16 def __del__(self):
17 isl.isl_ctx_free(self)
19 def from_param(self):
20 return c_void_p(self.ptr)
22 @staticmethod
23 def getDefaultInstance():
24 if Context.defaultInstance == None:
25 Context.defaultInstance = Context()
26 return Context.defaultInstance
28 isl.isl_ctx_alloc.restype = c_void_p
29 isl.isl_ctx_free.argtypes = [Context]
31 class union_pw_multi_aff(object):
32 def __init__(self, *args, **keywords):
33 if "ptr" in keywords:
34 self.ctx = keywords["ctx"]
35 self.ptr = keywords["ptr"]
36 return
37 if len(args) == 1 and args[0].__class__ is pw_multi_aff:
38 self.ctx = Context.getDefaultInstance()
39 self.ptr = isl.isl_union_pw_multi_aff_from_pw_multi_aff(isl.isl_pw_multi_aff_copy(args[0].ptr))
40 return
41 if len(args) == 1 and type(args[0]) == str:
42 self.ctx = Context.getDefaultInstance()
43 self.ptr = isl.isl_union_pw_multi_aff_read_from_str(self.ctx, args[0].encode('ascii'))
44 return
45 if len(args) == 1 and args[0].__class__ is union_pw_aff:
46 self.ctx = Context.getDefaultInstance()
47 self.ptr = isl.isl_union_pw_multi_aff_from_union_pw_aff(isl.isl_union_pw_aff_copy(args[0].ptr))
48 return
49 raise Error
50 def __del__(self):
51 if hasattr(self, 'ptr'):
52 isl.isl_union_pw_multi_aff_free(self.ptr)
53 def __str__(arg0):
54 try:
55 if not arg0.__class__ is union_pw_multi_aff:
56 arg0 = union_pw_multi_aff(arg0)
57 except:
58 raise
59 ptr = isl.isl_union_pw_multi_aff_to_str(arg0.ptr)
60 res = cast(ptr, c_char_p).value.decode('ascii')
61 libc.free(ptr)
62 return res
63 def __repr__(self):
64 s = str(self)
65 if '"' in s:
66 return 'isl.union_pw_multi_aff("""%s""")' % s
67 else:
68 return 'isl.union_pw_multi_aff("%s")' % s
69 def add(arg0, arg1):
70 try:
71 if not arg0.__class__ is union_pw_multi_aff:
72 arg0 = union_pw_multi_aff(arg0)
73 except:
74 raise
75 try:
76 if not arg1.__class__ is union_pw_multi_aff:
77 arg1 = union_pw_multi_aff(arg1)
78 except:
79 raise
80 ctx = arg0.ctx
81 res = isl.isl_union_pw_multi_aff_add(isl.isl_union_pw_multi_aff_copy(arg0.ptr), isl.isl_union_pw_multi_aff_copy(arg1.ptr))
82 return union_pw_multi_aff(ctx=ctx, ptr=res)
83 def flat_range_product(arg0, arg1):
84 try:
85 if not arg0.__class__ is union_pw_multi_aff:
86 arg0 = union_pw_multi_aff(arg0)
87 except:
88 raise
89 try:
90 if not arg1.__class__ is union_pw_multi_aff:
91 arg1 = union_pw_multi_aff(arg1)
92 except:
93 raise
94 ctx = arg0.ctx
95 res = isl.isl_union_pw_multi_aff_flat_range_product(isl.isl_union_pw_multi_aff_copy(arg0.ptr), isl.isl_union_pw_multi_aff_copy(arg1.ptr))
96 return union_pw_multi_aff(ctx=ctx, ptr=res)
97 def pullback(arg0, arg1):
98 if arg1.__class__ is union_pw_multi_aff:
99 res = isl.isl_union_pw_multi_aff_pullback_union_pw_multi_aff(isl.isl_union_pw_multi_aff_copy(arg0.ptr), isl.isl_union_pw_multi_aff_copy(arg1.ptr))
100 return union_pw_multi_aff(ctx=arg0.ctx, ptr=res)
101 def union_add(arg0, arg1):
102 try:
103 if not arg0.__class__ is union_pw_multi_aff:
104 arg0 = union_pw_multi_aff(arg0)
105 except:
106 raise
107 try:
108 if not arg1.__class__ is union_pw_multi_aff:
109 arg1 = union_pw_multi_aff(arg1)
110 except:
111 raise
112 ctx = arg0.ctx
113 res = isl.isl_union_pw_multi_aff_union_add(isl.isl_union_pw_multi_aff_copy(arg0.ptr), isl.isl_union_pw_multi_aff_copy(arg1.ptr))
114 return union_pw_multi_aff(ctx=ctx, ptr=res)
116 isl.isl_union_pw_multi_aff_from_pw_multi_aff.restype = c_void_p
117 isl.isl_union_pw_multi_aff_from_pw_multi_aff.argtypes = [c_void_p]
118 isl.isl_union_pw_multi_aff_read_from_str.restype = c_void_p
119 isl.isl_union_pw_multi_aff_read_from_str.argtypes = [Context, c_char_p]
120 isl.isl_union_pw_multi_aff_from_union_pw_aff.restype = c_void_p
121 isl.isl_union_pw_multi_aff_from_union_pw_aff.argtypes = [c_void_p]
122 isl.isl_union_pw_multi_aff_add.restype = c_void_p
123 isl.isl_union_pw_multi_aff_add.argtypes = [c_void_p, c_void_p]
124 isl.isl_union_pw_multi_aff_flat_range_product.restype = c_void_p
125 isl.isl_union_pw_multi_aff_flat_range_product.argtypes = [c_void_p, c_void_p]
126 isl.isl_union_pw_multi_aff_pullback_union_pw_multi_aff.restype = c_void_p
127 isl.isl_union_pw_multi_aff_pullback_union_pw_multi_aff.argtypes = [c_void_p, c_void_p]
128 isl.isl_union_pw_multi_aff_union_add.restype = c_void_p
129 isl.isl_union_pw_multi_aff_union_add.argtypes = [c_void_p, c_void_p]
130 isl.isl_union_pw_multi_aff_copy.restype = c_void_p
131 isl.isl_union_pw_multi_aff_copy.argtypes = [c_void_p]
132 isl.isl_union_pw_multi_aff_free.restype = c_void_p
133 isl.isl_union_pw_multi_aff_free.argtypes = [c_void_p]
134 isl.isl_union_pw_multi_aff_to_str.restype = POINTER(c_char)
135 isl.isl_union_pw_multi_aff_to_str.argtypes = [c_void_p]
137 class multi_union_pw_aff(object):
138 def __init__(self, *args, **keywords):
139 if "ptr" in keywords:
140 self.ctx = keywords["ctx"]
141 self.ptr = keywords["ptr"]
142 return
143 if len(args) == 1 and args[0].__class__ is union_pw_aff:
144 self.ctx = Context.getDefaultInstance()
145 self.ptr = isl.isl_multi_union_pw_aff_from_union_pw_aff(isl.isl_union_pw_aff_copy(args[0].ptr))
146 return
147 if len(args) == 1 and args[0].__class__ is multi_pw_aff:
148 self.ctx = Context.getDefaultInstance()
149 self.ptr = isl.isl_multi_union_pw_aff_from_multi_pw_aff(isl.isl_multi_pw_aff_copy(args[0].ptr))
150 return
151 if len(args) == 1 and type(args[0]) == str:
152 self.ctx = Context.getDefaultInstance()
153 self.ptr = isl.isl_multi_union_pw_aff_read_from_str(self.ctx, args[0].encode('ascii'))
154 return
155 raise Error
156 def __del__(self):
157 if hasattr(self, 'ptr'):
158 isl.isl_multi_union_pw_aff_free(self.ptr)
159 def __str__(arg0):
160 try:
161 if not arg0.__class__ is multi_union_pw_aff:
162 arg0 = multi_union_pw_aff(arg0)
163 except:
164 raise
165 ptr = isl.isl_multi_union_pw_aff_to_str(arg0.ptr)
166 res = cast(ptr, c_char_p).value.decode('ascii')
167 libc.free(ptr)
168 return res
169 def __repr__(self):
170 s = str(self)
171 if '"' in s:
172 return 'isl.multi_union_pw_aff("""%s""")' % s
173 else:
174 return 'isl.multi_union_pw_aff("%s")' % s
175 def add(arg0, arg1):
176 try:
177 if not arg0.__class__ is multi_union_pw_aff:
178 arg0 = multi_union_pw_aff(arg0)
179 except:
180 raise
181 try:
182 if not arg1.__class__ is multi_union_pw_aff:
183 arg1 = multi_union_pw_aff(arg1)
184 except:
185 raise
186 ctx = arg0.ctx
187 res = isl.isl_multi_union_pw_aff_add(isl.isl_multi_union_pw_aff_copy(arg0.ptr), isl.isl_multi_union_pw_aff_copy(arg1.ptr))
188 return multi_union_pw_aff(ctx=ctx, ptr=res)
189 def flat_range_product(arg0, arg1):
190 try:
191 if not arg0.__class__ is multi_union_pw_aff:
192 arg0 = multi_union_pw_aff(arg0)
193 except:
194 raise
195 try:
196 if not arg1.__class__ is multi_union_pw_aff:
197 arg1 = multi_union_pw_aff(arg1)
198 except:
199 raise
200 ctx = arg0.ctx
201 res = isl.isl_multi_union_pw_aff_flat_range_product(isl.isl_multi_union_pw_aff_copy(arg0.ptr), isl.isl_multi_union_pw_aff_copy(arg1.ptr))
202 return multi_union_pw_aff(ctx=ctx, ptr=res)
203 def pullback(arg0, arg1):
204 if arg1.__class__ is union_pw_multi_aff:
205 res = isl.isl_multi_union_pw_aff_pullback_union_pw_multi_aff(isl.isl_multi_union_pw_aff_copy(arg0.ptr), isl.isl_union_pw_multi_aff_copy(arg1.ptr))
206 return multi_union_pw_aff(ctx=arg0.ctx, ptr=res)
207 def range_product(arg0, arg1):
208 try:
209 if not arg0.__class__ is multi_union_pw_aff:
210 arg0 = multi_union_pw_aff(arg0)
211 except:
212 raise
213 try:
214 if not arg1.__class__ is multi_union_pw_aff:
215 arg1 = multi_union_pw_aff(arg1)
216 except:
217 raise
218 ctx = arg0.ctx
219 res = isl.isl_multi_union_pw_aff_range_product(isl.isl_multi_union_pw_aff_copy(arg0.ptr), isl.isl_multi_union_pw_aff_copy(arg1.ptr))
220 return multi_union_pw_aff(ctx=ctx, ptr=res)
221 def union_add(arg0, arg1):
222 try:
223 if not arg0.__class__ is multi_union_pw_aff:
224 arg0 = multi_union_pw_aff(arg0)
225 except:
226 raise
227 try:
228 if not arg1.__class__ is multi_union_pw_aff:
229 arg1 = multi_union_pw_aff(arg1)
230 except:
231 raise
232 ctx = arg0.ctx
233 res = isl.isl_multi_union_pw_aff_union_add(isl.isl_multi_union_pw_aff_copy(arg0.ptr), isl.isl_multi_union_pw_aff_copy(arg1.ptr))
234 return multi_union_pw_aff(ctx=ctx, ptr=res)
236 isl.isl_multi_union_pw_aff_from_union_pw_aff.restype = c_void_p
237 isl.isl_multi_union_pw_aff_from_union_pw_aff.argtypes = [c_void_p]
238 isl.isl_multi_union_pw_aff_from_multi_pw_aff.restype = c_void_p
239 isl.isl_multi_union_pw_aff_from_multi_pw_aff.argtypes = [c_void_p]
240 isl.isl_multi_union_pw_aff_read_from_str.restype = c_void_p
241 isl.isl_multi_union_pw_aff_read_from_str.argtypes = [Context, c_char_p]
242 isl.isl_multi_union_pw_aff_add.restype = c_void_p
243 isl.isl_multi_union_pw_aff_add.argtypes = [c_void_p, c_void_p]
244 isl.isl_multi_union_pw_aff_flat_range_product.restype = c_void_p
245 isl.isl_multi_union_pw_aff_flat_range_product.argtypes = [c_void_p, c_void_p]
246 isl.isl_multi_union_pw_aff_pullback_union_pw_multi_aff.restype = c_void_p
247 isl.isl_multi_union_pw_aff_pullback_union_pw_multi_aff.argtypes = [c_void_p, c_void_p]
248 isl.isl_multi_union_pw_aff_range_product.restype = c_void_p
249 isl.isl_multi_union_pw_aff_range_product.argtypes = [c_void_p, c_void_p]
250 isl.isl_multi_union_pw_aff_union_add.restype = c_void_p
251 isl.isl_multi_union_pw_aff_union_add.argtypes = [c_void_p, c_void_p]
252 isl.isl_multi_union_pw_aff_copy.restype = c_void_p
253 isl.isl_multi_union_pw_aff_copy.argtypes = [c_void_p]
254 isl.isl_multi_union_pw_aff_free.restype = c_void_p
255 isl.isl_multi_union_pw_aff_free.argtypes = [c_void_p]
256 isl.isl_multi_union_pw_aff_to_str.restype = POINTER(c_char)
257 isl.isl_multi_union_pw_aff_to_str.argtypes = [c_void_p]
259 class union_pw_aff(union_pw_multi_aff, multi_union_pw_aff):
260 def __init__(self, *args, **keywords):
261 if "ptr" in keywords:
262 self.ctx = keywords["ctx"]
263 self.ptr = keywords["ptr"]
264 return
265 if len(args) == 1 and args[0].__class__ is pw_aff:
266 self.ctx = Context.getDefaultInstance()
267 self.ptr = isl.isl_union_pw_aff_from_pw_aff(isl.isl_pw_aff_copy(args[0].ptr))
268 return
269 if len(args) == 1 and type(args[0]) == str:
270 self.ctx = Context.getDefaultInstance()
271 self.ptr = isl.isl_union_pw_aff_read_from_str(self.ctx, args[0].encode('ascii'))
272 return
273 raise Error
274 def __del__(self):
275 if hasattr(self, 'ptr'):
276 isl.isl_union_pw_aff_free(self.ptr)
277 def __str__(arg0):
278 try:
279 if not arg0.__class__ is union_pw_aff:
280 arg0 = union_pw_aff(arg0)
281 except:
282 raise
283 ptr = isl.isl_union_pw_aff_to_str(arg0.ptr)
284 res = cast(ptr, c_char_p).value.decode('ascii')
285 libc.free(ptr)
286 return res
287 def __repr__(self):
288 s = str(self)
289 if '"' in s:
290 return 'isl.union_pw_aff("""%s""")' % s
291 else:
292 return 'isl.union_pw_aff("%s")' % s
293 def add(arg0, arg1):
294 try:
295 if not arg0.__class__ is union_pw_aff:
296 arg0 = union_pw_aff(arg0)
297 except:
298 raise
299 try:
300 if not arg1.__class__ is union_pw_aff:
301 arg1 = union_pw_aff(arg1)
302 except:
303 return union_pw_multi_aff(arg0).add(arg1)
304 ctx = arg0.ctx
305 res = isl.isl_union_pw_aff_add(isl.isl_union_pw_aff_copy(arg0.ptr), isl.isl_union_pw_aff_copy(arg1.ptr))
306 return union_pw_aff(ctx=ctx, ptr=res)
307 def pullback(arg0, arg1):
308 if arg1.__class__ is union_pw_multi_aff:
309 res = isl.isl_union_pw_aff_pullback_union_pw_multi_aff(isl.isl_union_pw_aff_copy(arg0.ptr), isl.isl_union_pw_multi_aff_copy(arg1.ptr))
310 return union_pw_aff(ctx=arg0.ctx, ptr=res)
311 def union_add(arg0, arg1):
312 try:
313 if not arg0.__class__ is union_pw_aff:
314 arg0 = union_pw_aff(arg0)
315 except:
316 raise
317 try:
318 if not arg1.__class__ is union_pw_aff:
319 arg1 = union_pw_aff(arg1)
320 except:
321 return union_pw_multi_aff(arg0).union_add(arg1)
322 ctx = arg0.ctx
323 res = isl.isl_union_pw_aff_union_add(isl.isl_union_pw_aff_copy(arg0.ptr), isl.isl_union_pw_aff_copy(arg1.ptr))
324 return union_pw_aff(ctx=ctx, ptr=res)
326 isl.isl_union_pw_aff_from_pw_aff.restype = c_void_p
327 isl.isl_union_pw_aff_from_pw_aff.argtypes = [c_void_p]
328 isl.isl_union_pw_aff_read_from_str.restype = c_void_p
329 isl.isl_union_pw_aff_read_from_str.argtypes = [Context, c_char_p]
330 isl.isl_union_pw_aff_add.restype = c_void_p
331 isl.isl_union_pw_aff_add.argtypes = [c_void_p, c_void_p]
332 isl.isl_union_pw_aff_pullback_union_pw_multi_aff.restype = c_void_p
333 isl.isl_union_pw_aff_pullback_union_pw_multi_aff.argtypes = [c_void_p, c_void_p]
334 isl.isl_union_pw_aff_union_add.restype = c_void_p
335 isl.isl_union_pw_aff_union_add.argtypes = [c_void_p, c_void_p]
336 isl.isl_union_pw_aff_copy.restype = c_void_p
337 isl.isl_union_pw_aff_copy.argtypes = [c_void_p]
338 isl.isl_union_pw_aff_free.restype = c_void_p
339 isl.isl_union_pw_aff_free.argtypes = [c_void_p]
340 isl.isl_union_pw_aff_to_str.restype = POINTER(c_char)
341 isl.isl_union_pw_aff_to_str.argtypes = [c_void_p]
343 class multi_pw_aff(multi_union_pw_aff):
344 def __init__(self, *args, **keywords):
345 if "ptr" in keywords:
346 self.ctx = keywords["ctx"]
347 self.ptr = keywords["ptr"]
348 return
349 if len(args) == 1 and args[0].__class__ is multi_aff:
350 self.ctx = Context.getDefaultInstance()
351 self.ptr = isl.isl_multi_pw_aff_from_multi_aff(isl.isl_multi_aff_copy(args[0].ptr))
352 return
353 if len(args) == 1 and args[0].__class__ is pw_aff:
354 self.ctx = Context.getDefaultInstance()
355 self.ptr = isl.isl_multi_pw_aff_from_pw_aff(isl.isl_pw_aff_copy(args[0].ptr))
356 return
357 if len(args) == 1 and args[0].__class__ is pw_multi_aff:
358 self.ctx = Context.getDefaultInstance()
359 self.ptr = isl.isl_multi_pw_aff_from_pw_multi_aff(isl.isl_pw_multi_aff_copy(args[0].ptr))
360 return
361 if len(args) == 1 and type(args[0]) == str:
362 self.ctx = Context.getDefaultInstance()
363 self.ptr = isl.isl_multi_pw_aff_read_from_str(self.ctx, args[0].encode('ascii'))
364 return
365 raise Error
366 def __del__(self):
367 if hasattr(self, 'ptr'):
368 isl.isl_multi_pw_aff_free(self.ptr)
369 def __str__(arg0):
370 try:
371 if not arg0.__class__ is multi_pw_aff:
372 arg0 = multi_pw_aff(arg0)
373 except:
374 raise
375 ptr = isl.isl_multi_pw_aff_to_str(arg0.ptr)
376 res = cast(ptr, c_char_p).value.decode('ascii')
377 libc.free(ptr)
378 return res
379 def __repr__(self):
380 s = str(self)
381 if '"' in s:
382 return 'isl.multi_pw_aff("""%s""")' % s
383 else:
384 return 'isl.multi_pw_aff("%s")' % s
385 def add(arg0, arg1):
386 try:
387 if not arg0.__class__ is multi_pw_aff:
388 arg0 = multi_pw_aff(arg0)
389 except:
390 raise
391 try:
392 if not arg1.__class__ is multi_pw_aff:
393 arg1 = multi_pw_aff(arg1)
394 except:
395 return multi_union_pw_aff(arg0).add(arg1)
396 ctx = arg0.ctx
397 res = isl.isl_multi_pw_aff_add(isl.isl_multi_pw_aff_copy(arg0.ptr), isl.isl_multi_pw_aff_copy(arg1.ptr))
398 return multi_pw_aff(ctx=ctx, ptr=res)
399 def flat_range_product(arg0, arg1):
400 try:
401 if not arg0.__class__ is multi_pw_aff:
402 arg0 = multi_pw_aff(arg0)
403 except:
404 raise
405 try:
406 if not arg1.__class__ is multi_pw_aff:
407 arg1 = multi_pw_aff(arg1)
408 except:
409 return multi_union_pw_aff(arg0).flat_range_product(arg1)
410 ctx = arg0.ctx
411 res = isl.isl_multi_pw_aff_flat_range_product(isl.isl_multi_pw_aff_copy(arg0.ptr), isl.isl_multi_pw_aff_copy(arg1.ptr))
412 return multi_pw_aff(ctx=ctx, ptr=res)
413 def product(arg0, arg1):
414 try:
415 if not arg0.__class__ is multi_pw_aff:
416 arg0 = multi_pw_aff(arg0)
417 except:
418 raise
419 try:
420 if not arg1.__class__ is multi_pw_aff:
421 arg1 = multi_pw_aff(arg1)
422 except:
423 return multi_union_pw_aff(arg0).product(arg1)
424 ctx = arg0.ctx
425 res = isl.isl_multi_pw_aff_product(isl.isl_multi_pw_aff_copy(arg0.ptr), isl.isl_multi_pw_aff_copy(arg1.ptr))
426 return multi_pw_aff(ctx=ctx, ptr=res)
427 def pullback(arg0, arg1):
428 if arg1.__class__ is multi_aff:
429 res = isl.isl_multi_pw_aff_pullback_multi_aff(isl.isl_multi_pw_aff_copy(arg0.ptr), isl.isl_multi_aff_copy(arg1.ptr))
430 return multi_pw_aff(ctx=arg0.ctx, ptr=res)
431 if arg1.__class__ is pw_multi_aff:
432 res = isl.isl_multi_pw_aff_pullback_pw_multi_aff(isl.isl_multi_pw_aff_copy(arg0.ptr), isl.isl_pw_multi_aff_copy(arg1.ptr))
433 return multi_pw_aff(ctx=arg0.ctx, ptr=res)
434 if arg1.__class__ is multi_pw_aff:
435 res = isl.isl_multi_pw_aff_pullback_multi_pw_aff(isl.isl_multi_pw_aff_copy(arg0.ptr), isl.isl_multi_pw_aff_copy(arg1.ptr))
436 return multi_pw_aff(ctx=arg0.ctx, ptr=res)
437 def range_product(arg0, arg1):
438 try:
439 if not arg0.__class__ is multi_pw_aff:
440 arg0 = multi_pw_aff(arg0)
441 except:
442 raise
443 try:
444 if not arg1.__class__ is multi_pw_aff:
445 arg1 = multi_pw_aff(arg1)
446 except:
447 return multi_union_pw_aff(arg0).range_product(arg1)
448 ctx = arg0.ctx
449 res = isl.isl_multi_pw_aff_range_product(isl.isl_multi_pw_aff_copy(arg0.ptr), isl.isl_multi_pw_aff_copy(arg1.ptr))
450 return multi_pw_aff(ctx=ctx, ptr=res)
452 isl.isl_multi_pw_aff_from_multi_aff.restype = c_void_p
453 isl.isl_multi_pw_aff_from_multi_aff.argtypes = [c_void_p]
454 isl.isl_multi_pw_aff_from_pw_aff.restype = c_void_p
455 isl.isl_multi_pw_aff_from_pw_aff.argtypes = [c_void_p]
456 isl.isl_multi_pw_aff_from_pw_multi_aff.restype = c_void_p
457 isl.isl_multi_pw_aff_from_pw_multi_aff.argtypes = [c_void_p]
458 isl.isl_multi_pw_aff_read_from_str.restype = c_void_p
459 isl.isl_multi_pw_aff_read_from_str.argtypes = [Context, c_char_p]
460 isl.isl_multi_pw_aff_add.restype = c_void_p
461 isl.isl_multi_pw_aff_add.argtypes = [c_void_p, c_void_p]
462 isl.isl_multi_pw_aff_flat_range_product.restype = c_void_p
463 isl.isl_multi_pw_aff_flat_range_product.argtypes = [c_void_p, c_void_p]
464 isl.isl_multi_pw_aff_product.restype = c_void_p
465 isl.isl_multi_pw_aff_product.argtypes = [c_void_p, c_void_p]
466 isl.isl_multi_pw_aff_pullback_multi_aff.restype = c_void_p
467 isl.isl_multi_pw_aff_pullback_multi_aff.argtypes = [c_void_p, c_void_p]
468 isl.isl_multi_pw_aff_pullback_pw_multi_aff.restype = c_void_p
469 isl.isl_multi_pw_aff_pullback_pw_multi_aff.argtypes = [c_void_p, c_void_p]
470 isl.isl_multi_pw_aff_pullback_multi_pw_aff.restype = c_void_p
471 isl.isl_multi_pw_aff_pullback_multi_pw_aff.argtypes = [c_void_p, c_void_p]
472 isl.isl_multi_pw_aff_range_product.restype = c_void_p
473 isl.isl_multi_pw_aff_range_product.argtypes = [c_void_p, c_void_p]
474 isl.isl_multi_pw_aff_copy.restype = c_void_p
475 isl.isl_multi_pw_aff_copy.argtypes = [c_void_p]
476 isl.isl_multi_pw_aff_free.restype = c_void_p
477 isl.isl_multi_pw_aff_free.argtypes = [c_void_p]
478 isl.isl_multi_pw_aff_to_str.restype = POINTER(c_char)
479 isl.isl_multi_pw_aff_to_str.argtypes = [c_void_p]
481 class pw_multi_aff(union_pw_multi_aff, multi_pw_aff):
482 def __init__(self, *args, **keywords):
483 if "ptr" in keywords:
484 self.ctx = keywords["ctx"]
485 self.ptr = keywords["ptr"]
486 return
487 if len(args) == 1 and args[0].__class__ is multi_aff:
488 self.ctx = Context.getDefaultInstance()
489 self.ptr = isl.isl_pw_multi_aff_from_multi_aff(isl.isl_multi_aff_copy(args[0].ptr))
490 return
491 if len(args) == 1 and args[0].__class__ is pw_aff:
492 self.ctx = Context.getDefaultInstance()
493 self.ptr = isl.isl_pw_multi_aff_from_pw_aff(isl.isl_pw_aff_copy(args[0].ptr))
494 return
495 if len(args) == 1 and type(args[0]) == str:
496 self.ctx = Context.getDefaultInstance()
497 self.ptr = isl.isl_pw_multi_aff_read_from_str(self.ctx, args[0].encode('ascii'))
498 return
499 raise Error
500 def __del__(self):
501 if hasattr(self, 'ptr'):
502 isl.isl_pw_multi_aff_free(self.ptr)
503 def __str__(arg0):
504 try:
505 if not arg0.__class__ is pw_multi_aff:
506 arg0 = pw_multi_aff(arg0)
507 except:
508 raise
509 ptr = isl.isl_pw_multi_aff_to_str(arg0.ptr)
510 res = cast(ptr, c_char_p).value.decode('ascii')
511 libc.free(ptr)
512 return res
513 def __repr__(self):
514 s = str(self)
515 if '"' in s:
516 return 'isl.pw_multi_aff("""%s""")' % s
517 else:
518 return 'isl.pw_multi_aff("%s")' % s
519 def add(arg0, arg1):
520 try:
521 if not arg0.__class__ is pw_multi_aff:
522 arg0 = pw_multi_aff(arg0)
523 except:
524 raise
525 try:
526 if not arg1.__class__ is pw_multi_aff:
527 arg1 = pw_multi_aff(arg1)
528 except:
529 return union_pw_multi_aff(arg0).add(arg1)
530 ctx = arg0.ctx
531 res = isl.isl_pw_multi_aff_add(isl.isl_pw_multi_aff_copy(arg0.ptr), isl.isl_pw_multi_aff_copy(arg1.ptr))
532 return pw_multi_aff(ctx=ctx, ptr=res)
533 def flat_range_product(arg0, arg1):
534 try:
535 if not arg0.__class__ is pw_multi_aff:
536 arg0 = pw_multi_aff(arg0)
537 except:
538 raise
539 try:
540 if not arg1.__class__ is pw_multi_aff:
541 arg1 = pw_multi_aff(arg1)
542 except:
543 return union_pw_multi_aff(arg0).flat_range_product(arg1)
544 ctx = arg0.ctx
545 res = isl.isl_pw_multi_aff_flat_range_product(isl.isl_pw_multi_aff_copy(arg0.ptr), isl.isl_pw_multi_aff_copy(arg1.ptr))
546 return pw_multi_aff(ctx=ctx, ptr=res)
547 def product(arg0, arg1):
548 try:
549 if not arg0.__class__ is pw_multi_aff:
550 arg0 = pw_multi_aff(arg0)
551 except:
552 raise
553 try:
554 if not arg1.__class__ is pw_multi_aff:
555 arg1 = pw_multi_aff(arg1)
556 except:
557 return union_pw_multi_aff(arg0).product(arg1)
558 ctx = arg0.ctx
559 res = isl.isl_pw_multi_aff_product(isl.isl_pw_multi_aff_copy(arg0.ptr), isl.isl_pw_multi_aff_copy(arg1.ptr))
560 return pw_multi_aff(ctx=ctx, ptr=res)
561 def pullback(arg0, arg1):
562 if arg1.__class__ is multi_aff:
563 res = isl.isl_pw_multi_aff_pullback_multi_aff(isl.isl_pw_multi_aff_copy(arg0.ptr), isl.isl_multi_aff_copy(arg1.ptr))
564 return pw_multi_aff(ctx=arg0.ctx, ptr=res)
565 if arg1.__class__ is pw_multi_aff:
566 res = isl.isl_pw_multi_aff_pullback_pw_multi_aff(isl.isl_pw_multi_aff_copy(arg0.ptr), isl.isl_pw_multi_aff_copy(arg1.ptr))
567 return pw_multi_aff(ctx=arg0.ctx, ptr=res)
568 def range_product(arg0, arg1):
569 try:
570 if not arg0.__class__ is pw_multi_aff:
571 arg0 = pw_multi_aff(arg0)
572 except:
573 raise
574 try:
575 if not arg1.__class__ is pw_multi_aff:
576 arg1 = pw_multi_aff(arg1)
577 except:
578 return union_pw_multi_aff(arg0).range_product(arg1)
579 ctx = arg0.ctx
580 res = isl.isl_pw_multi_aff_range_product(isl.isl_pw_multi_aff_copy(arg0.ptr), isl.isl_pw_multi_aff_copy(arg1.ptr))
581 return pw_multi_aff(ctx=ctx, ptr=res)
582 def union_add(arg0, arg1):
583 try:
584 if not arg0.__class__ is pw_multi_aff:
585 arg0 = pw_multi_aff(arg0)
586 except:
587 raise
588 try:
589 if not arg1.__class__ is pw_multi_aff:
590 arg1 = pw_multi_aff(arg1)
591 except:
592 return union_pw_multi_aff(arg0).union_add(arg1)
593 ctx = arg0.ctx
594 res = isl.isl_pw_multi_aff_union_add(isl.isl_pw_multi_aff_copy(arg0.ptr), isl.isl_pw_multi_aff_copy(arg1.ptr))
595 return pw_multi_aff(ctx=ctx, ptr=res)
597 isl.isl_pw_multi_aff_from_multi_aff.restype = c_void_p
598 isl.isl_pw_multi_aff_from_multi_aff.argtypes = [c_void_p]
599 isl.isl_pw_multi_aff_from_pw_aff.restype = c_void_p
600 isl.isl_pw_multi_aff_from_pw_aff.argtypes = [c_void_p]
601 isl.isl_pw_multi_aff_read_from_str.restype = c_void_p
602 isl.isl_pw_multi_aff_read_from_str.argtypes = [Context, c_char_p]
603 isl.isl_pw_multi_aff_add.restype = c_void_p
604 isl.isl_pw_multi_aff_add.argtypes = [c_void_p, c_void_p]
605 isl.isl_pw_multi_aff_flat_range_product.restype = c_void_p
606 isl.isl_pw_multi_aff_flat_range_product.argtypes = [c_void_p, c_void_p]
607 isl.isl_pw_multi_aff_product.restype = c_void_p
608 isl.isl_pw_multi_aff_product.argtypes = [c_void_p, c_void_p]
609 isl.isl_pw_multi_aff_pullback_multi_aff.restype = c_void_p
610 isl.isl_pw_multi_aff_pullback_multi_aff.argtypes = [c_void_p, c_void_p]
611 isl.isl_pw_multi_aff_pullback_pw_multi_aff.restype = c_void_p
612 isl.isl_pw_multi_aff_pullback_pw_multi_aff.argtypes = [c_void_p, c_void_p]
613 isl.isl_pw_multi_aff_range_product.restype = c_void_p
614 isl.isl_pw_multi_aff_range_product.argtypes = [c_void_p, c_void_p]
615 isl.isl_pw_multi_aff_union_add.restype = c_void_p
616 isl.isl_pw_multi_aff_union_add.argtypes = [c_void_p, c_void_p]
617 isl.isl_pw_multi_aff_copy.restype = c_void_p
618 isl.isl_pw_multi_aff_copy.argtypes = [c_void_p]
619 isl.isl_pw_multi_aff_free.restype = c_void_p
620 isl.isl_pw_multi_aff_free.argtypes = [c_void_p]
621 isl.isl_pw_multi_aff_to_str.restype = POINTER(c_char)
622 isl.isl_pw_multi_aff_to_str.argtypes = [c_void_p]
624 class pw_aff(union_pw_aff, pw_multi_aff, multi_pw_aff):
625 def __init__(self, *args, **keywords):
626 if "ptr" in keywords:
627 self.ctx = keywords["ctx"]
628 self.ptr = keywords["ptr"]
629 return
630 if len(args) == 1 and args[0].__class__ is aff:
631 self.ctx = Context.getDefaultInstance()
632 self.ptr = isl.isl_pw_aff_from_aff(isl.isl_aff_copy(args[0].ptr))
633 return
634 if len(args) == 1 and type(args[0]) == str:
635 self.ctx = Context.getDefaultInstance()
636 self.ptr = isl.isl_pw_aff_read_from_str(self.ctx, args[0].encode('ascii'))
637 return
638 raise Error
639 def __del__(self):
640 if hasattr(self, 'ptr'):
641 isl.isl_pw_aff_free(self.ptr)
642 def __str__(arg0):
643 try:
644 if not arg0.__class__ is pw_aff:
645 arg0 = pw_aff(arg0)
646 except:
647 raise
648 ptr = isl.isl_pw_aff_to_str(arg0.ptr)
649 res = cast(ptr, c_char_p).value.decode('ascii')
650 libc.free(ptr)
651 return res
652 def __repr__(self):
653 s = str(self)
654 if '"' in s:
655 return 'isl.pw_aff("""%s""")' % s
656 else:
657 return 'isl.pw_aff("%s")' % s
658 def add(arg0, arg1):
659 try:
660 if not arg0.__class__ is pw_aff:
661 arg0 = pw_aff(arg0)
662 except:
663 raise
664 try:
665 if not arg1.__class__ is pw_aff:
666 arg1 = pw_aff(arg1)
667 except:
668 return union_pw_aff(arg0).add(arg1)
669 ctx = arg0.ctx
670 res = isl.isl_pw_aff_add(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_pw_aff_copy(arg1.ptr))
671 return pw_aff(ctx=ctx, ptr=res)
672 def ceil(arg0):
673 try:
674 if not arg0.__class__ is pw_aff:
675 arg0 = pw_aff(arg0)
676 except:
677 raise
678 ctx = arg0.ctx
679 res = isl.isl_pw_aff_ceil(isl.isl_pw_aff_copy(arg0.ptr))
680 return pw_aff(ctx=ctx, ptr=res)
681 def cond(arg0, arg1, arg2):
682 try:
683 if not arg0.__class__ is pw_aff:
684 arg0 = pw_aff(arg0)
685 except:
686 raise
687 try:
688 if not arg1.__class__ is pw_aff:
689 arg1 = pw_aff(arg1)
690 except:
691 return union_pw_aff(arg0).cond(arg1, arg2)
692 try:
693 if not arg2.__class__ is pw_aff:
694 arg2 = pw_aff(arg2)
695 except:
696 return union_pw_aff(arg0).cond(arg1, arg2)
697 ctx = arg0.ctx
698 res = isl.isl_pw_aff_cond(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_pw_aff_copy(arg1.ptr), isl.isl_pw_aff_copy(arg2.ptr))
699 return pw_aff(ctx=ctx, ptr=res)
700 def div(arg0, arg1):
701 try:
702 if not arg0.__class__ is pw_aff:
703 arg0 = pw_aff(arg0)
704 except:
705 raise
706 try:
707 if not arg1.__class__ is pw_aff:
708 arg1 = pw_aff(arg1)
709 except:
710 return union_pw_aff(arg0).div(arg1)
711 ctx = arg0.ctx
712 res = isl.isl_pw_aff_div(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_pw_aff_copy(arg1.ptr))
713 return pw_aff(ctx=ctx, ptr=res)
714 def eq_set(arg0, arg1):
715 try:
716 if not arg0.__class__ is pw_aff:
717 arg0 = pw_aff(arg0)
718 except:
719 raise
720 try:
721 if not arg1.__class__ is pw_aff:
722 arg1 = pw_aff(arg1)
723 except:
724 return union_pw_aff(arg0).eq_set(arg1)
725 ctx = arg0.ctx
726 res = isl.isl_pw_aff_eq_set(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_pw_aff_copy(arg1.ptr))
727 return set(ctx=ctx, ptr=res)
728 def floor(arg0):
729 try:
730 if not arg0.__class__ is pw_aff:
731 arg0 = pw_aff(arg0)
732 except:
733 raise
734 ctx = arg0.ctx
735 res = isl.isl_pw_aff_floor(isl.isl_pw_aff_copy(arg0.ptr))
736 return pw_aff(ctx=ctx, ptr=res)
737 def ge_set(arg0, arg1):
738 try:
739 if not arg0.__class__ is pw_aff:
740 arg0 = pw_aff(arg0)
741 except:
742 raise
743 try:
744 if not arg1.__class__ is pw_aff:
745 arg1 = pw_aff(arg1)
746 except:
747 return union_pw_aff(arg0).ge_set(arg1)
748 ctx = arg0.ctx
749 res = isl.isl_pw_aff_ge_set(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_pw_aff_copy(arg1.ptr))
750 return set(ctx=ctx, ptr=res)
751 def gt_set(arg0, arg1):
752 try:
753 if not arg0.__class__ is pw_aff:
754 arg0 = pw_aff(arg0)
755 except:
756 raise
757 try:
758 if not arg1.__class__ is pw_aff:
759 arg1 = pw_aff(arg1)
760 except:
761 return union_pw_aff(arg0).gt_set(arg1)
762 ctx = arg0.ctx
763 res = isl.isl_pw_aff_gt_set(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_pw_aff_copy(arg1.ptr))
764 return set(ctx=ctx, ptr=res)
765 def le_set(arg0, arg1):
766 try:
767 if not arg0.__class__ is pw_aff:
768 arg0 = pw_aff(arg0)
769 except:
770 raise
771 try:
772 if not arg1.__class__ is pw_aff:
773 arg1 = pw_aff(arg1)
774 except:
775 return union_pw_aff(arg0).le_set(arg1)
776 ctx = arg0.ctx
777 res = isl.isl_pw_aff_le_set(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_pw_aff_copy(arg1.ptr))
778 return set(ctx=ctx, ptr=res)
779 def lt_set(arg0, arg1):
780 try:
781 if not arg0.__class__ is pw_aff:
782 arg0 = pw_aff(arg0)
783 except:
784 raise
785 try:
786 if not arg1.__class__ is pw_aff:
787 arg1 = pw_aff(arg1)
788 except:
789 return union_pw_aff(arg0).lt_set(arg1)
790 ctx = arg0.ctx
791 res = isl.isl_pw_aff_lt_set(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_pw_aff_copy(arg1.ptr))
792 return set(ctx=ctx, ptr=res)
793 def max(arg0, arg1):
794 try:
795 if not arg0.__class__ is pw_aff:
796 arg0 = pw_aff(arg0)
797 except:
798 raise
799 try:
800 if not arg1.__class__ is pw_aff:
801 arg1 = pw_aff(arg1)
802 except:
803 return union_pw_aff(arg0).max(arg1)
804 ctx = arg0.ctx
805 res = isl.isl_pw_aff_max(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_pw_aff_copy(arg1.ptr))
806 return pw_aff(ctx=ctx, ptr=res)
807 def min(arg0, arg1):
808 try:
809 if not arg0.__class__ is pw_aff:
810 arg0 = pw_aff(arg0)
811 except:
812 raise
813 try:
814 if not arg1.__class__ is pw_aff:
815 arg1 = pw_aff(arg1)
816 except:
817 return union_pw_aff(arg0).min(arg1)
818 ctx = arg0.ctx
819 res = isl.isl_pw_aff_min(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_pw_aff_copy(arg1.ptr))
820 return pw_aff(ctx=ctx, ptr=res)
821 def mod(arg0, arg1):
822 if arg1.__class__ is val:
823 res = isl.isl_pw_aff_mod_val(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_val_copy(arg1.ptr))
824 return pw_aff(ctx=arg0.ctx, ptr=res)
825 def mul(arg0, arg1):
826 try:
827 if not arg0.__class__ is pw_aff:
828 arg0 = pw_aff(arg0)
829 except:
830 raise
831 try:
832 if not arg1.__class__ is pw_aff:
833 arg1 = pw_aff(arg1)
834 except:
835 return union_pw_aff(arg0).mul(arg1)
836 ctx = arg0.ctx
837 res = isl.isl_pw_aff_mul(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_pw_aff_copy(arg1.ptr))
838 return pw_aff(ctx=ctx, ptr=res)
839 def ne_set(arg0, arg1):
840 try:
841 if not arg0.__class__ is pw_aff:
842 arg0 = pw_aff(arg0)
843 except:
844 raise
845 try:
846 if not arg1.__class__ is pw_aff:
847 arg1 = pw_aff(arg1)
848 except:
849 return union_pw_aff(arg0).ne_set(arg1)
850 ctx = arg0.ctx
851 res = isl.isl_pw_aff_ne_set(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_pw_aff_copy(arg1.ptr))
852 return set(ctx=ctx, ptr=res)
853 def neg(arg0):
854 try:
855 if not arg0.__class__ is pw_aff:
856 arg0 = pw_aff(arg0)
857 except:
858 raise
859 ctx = arg0.ctx
860 res = isl.isl_pw_aff_neg(isl.isl_pw_aff_copy(arg0.ptr))
861 return pw_aff(ctx=ctx, ptr=res)
862 def pullback(arg0, arg1):
863 if arg1.__class__ is multi_aff:
864 res = isl.isl_pw_aff_pullback_multi_aff(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_multi_aff_copy(arg1.ptr))
865 return pw_aff(ctx=arg0.ctx, ptr=res)
866 if arg1.__class__ is pw_multi_aff:
867 res = isl.isl_pw_aff_pullback_pw_multi_aff(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_pw_multi_aff_copy(arg1.ptr))
868 return pw_aff(ctx=arg0.ctx, ptr=res)
869 if arg1.__class__ is multi_pw_aff:
870 res = isl.isl_pw_aff_pullback_multi_pw_aff(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_multi_pw_aff_copy(arg1.ptr))
871 return pw_aff(ctx=arg0.ctx, ptr=res)
872 def scale(arg0, arg1):
873 if arg1.__class__ is val:
874 res = isl.isl_pw_aff_scale_val(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_val_copy(arg1.ptr))
875 return pw_aff(ctx=arg0.ctx, ptr=res)
876 def scale_down(arg0, arg1):
877 if arg1.__class__ is val:
878 res = isl.isl_pw_aff_scale_down_val(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_val_copy(arg1.ptr))
879 return pw_aff(ctx=arg0.ctx, ptr=res)
880 def sub(arg0, arg1):
881 try:
882 if not arg0.__class__ is pw_aff:
883 arg0 = pw_aff(arg0)
884 except:
885 raise
886 try:
887 if not arg1.__class__ is pw_aff:
888 arg1 = pw_aff(arg1)
889 except:
890 return union_pw_aff(arg0).sub(arg1)
891 ctx = arg0.ctx
892 res = isl.isl_pw_aff_sub(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_pw_aff_copy(arg1.ptr))
893 return pw_aff(ctx=ctx, ptr=res)
894 def tdiv_q(arg0, arg1):
895 try:
896 if not arg0.__class__ is pw_aff:
897 arg0 = pw_aff(arg0)
898 except:
899 raise
900 try:
901 if not arg1.__class__ is pw_aff:
902 arg1 = pw_aff(arg1)
903 except:
904 return union_pw_aff(arg0).tdiv_q(arg1)
905 ctx = arg0.ctx
906 res = isl.isl_pw_aff_tdiv_q(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_pw_aff_copy(arg1.ptr))
907 return pw_aff(ctx=ctx, ptr=res)
908 def tdiv_r(arg0, arg1):
909 try:
910 if not arg0.__class__ is pw_aff:
911 arg0 = pw_aff(arg0)
912 except:
913 raise
914 try:
915 if not arg1.__class__ is pw_aff:
916 arg1 = pw_aff(arg1)
917 except:
918 return union_pw_aff(arg0).tdiv_r(arg1)
919 ctx = arg0.ctx
920 res = isl.isl_pw_aff_tdiv_r(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_pw_aff_copy(arg1.ptr))
921 return pw_aff(ctx=ctx, ptr=res)
922 def union_add(arg0, arg1):
923 try:
924 if not arg0.__class__ is pw_aff:
925 arg0 = pw_aff(arg0)
926 except:
927 raise
928 try:
929 if not arg1.__class__ is pw_aff:
930 arg1 = pw_aff(arg1)
931 except:
932 return union_pw_aff(arg0).union_add(arg1)
933 ctx = arg0.ctx
934 res = isl.isl_pw_aff_union_add(isl.isl_pw_aff_copy(arg0.ptr), isl.isl_pw_aff_copy(arg1.ptr))
935 return pw_aff(ctx=ctx, ptr=res)
937 isl.isl_pw_aff_from_aff.restype = c_void_p
938 isl.isl_pw_aff_from_aff.argtypes = [c_void_p]
939 isl.isl_pw_aff_read_from_str.restype = c_void_p
940 isl.isl_pw_aff_read_from_str.argtypes = [Context, c_char_p]
941 isl.isl_pw_aff_add.restype = c_void_p
942 isl.isl_pw_aff_add.argtypes = [c_void_p, c_void_p]
943 isl.isl_pw_aff_ceil.restype = c_void_p
944 isl.isl_pw_aff_ceil.argtypes = [c_void_p]
945 isl.isl_pw_aff_cond.restype = c_void_p
946 isl.isl_pw_aff_cond.argtypes = [c_void_p, c_void_p, c_void_p]
947 isl.isl_pw_aff_div.restype = c_void_p
948 isl.isl_pw_aff_div.argtypes = [c_void_p, c_void_p]
949 isl.isl_pw_aff_eq_set.restype = c_void_p
950 isl.isl_pw_aff_eq_set.argtypes = [c_void_p, c_void_p]
951 isl.isl_pw_aff_floor.restype = c_void_p
952 isl.isl_pw_aff_floor.argtypes = [c_void_p]
953 isl.isl_pw_aff_ge_set.restype = c_void_p
954 isl.isl_pw_aff_ge_set.argtypes = [c_void_p, c_void_p]
955 isl.isl_pw_aff_gt_set.restype = c_void_p
956 isl.isl_pw_aff_gt_set.argtypes = [c_void_p, c_void_p]
957 isl.isl_pw_aff_le_set.restype = c_void_p
958 isl.isl_pw_aff_le_set.argtypes = [c_void_p, c_void_p]
959 isl.isl_pw_aff_lt_set.restype = c_void_p
960 isl.isl_pw_aff_lt_set.argtypes = [c_void_p, c_void_p]
961 isl.isl_pw_aff_max.restype = c_void_p
962 isl.isl_pw_aff_max.argtypes = [c_void_p, c_void_p]
963 isl.isl_pw_aff_min.restype = c_void_p
964 isl.isl_pw_aff_min.argtypes = [c_void_p, c_void_p]
965 isl.isl_pw_aff_mod_val.restype = c_void_p
966 isl.isl_pw_aff_mod_val.argtypes = [c_void_p, c_void_p]
967 isl.isl_pw_aff_mul.restype = c_void_p
968 isl.isl_pw_aff_mul.argtypes = [c_void_p, c_void_p]
969 isl.isl_pw_aff_ne_set.restype = c_void_p
970 isl.isl_pw_aff_ne_set.argtypes = [c_void_p, c_void_p]
971 isl.isl_pw_aff_neg.restype = c_void_p
972 isl.isl_pw_aff_neg.argtypes = [c_void_p]
973 isl.isl_pw_aff_pullback_multi_aff.restype = c_void_p
974 isl.isl_pw_aff_pullback_multi_aff.argtypes = [c_void_p, c_void_p]
975 isl.isl_pw_aff_pullback_pw_multi_aff.restype = c_void_p
976 isl.isl_pw_aff_pullback_pw_multi_aff.argtypes = [c_void_p, c_void_p]
977 isl.isl_pw_aff_pullback_multi_pw_aff.restype = c_void_p
978 isl.isl_pw_aff_pullback_multi_pw_aff.argtypes = [c_void_p, c_void_p]
979 isl.isl_pw_aff_scale_val.restype = c_void_p
980 isl.isl_pw_aff_scale_val.argtypes = [c_void_p, c_void_p]
981 isl.isl_pw_aff_scale_down_val.restype = c_void_p
982 isl.isl_pw_aff_scale_down_val.argtypes = [c_void_p, c_void_p]
983 isl.isl_pw_aff_sub.restype = c_void_p
984 isl.isl_pw_aff_sub.argtypes = [c_void_p, c_void_p]
985 isl.isl_pw_aff_tdiv_q.restype = c_void_p
986 isl.isl_pw_aff_tdiv_q.argtypes = [c_void_p, c_void_p]
987 isl.isl_pw_aff_tdiv_r.restype = c_void_p
988 isl.isl_pw_aff_tdiv_r.argtypes = [c_void_p, c_void_p]
989 isl.isl_pw_aff_union_add.restype = c_void_p
990 isl.isl_pw_aff_union_add.argtypes = [c_void_p, c_void_p]
991 isl.isl_pw_aff_copy.restype = c_void_p
992 isl.isl_pw_aff_copy.argtypes = [c_void_p]
993 isl.isl_pw_aff_free.restype = c_void_p
994 isl.isl_pw_aff_free.argtypes = [c_void_p]
995 isl.isl_pw_aff_to_str.restype = POINTER(c_char)
996 isl.isl_pw_aff_to_str.argtypes = [c_void_p]
998 class multi_aff(pw_multi_aff, multi_pw_aff):
999 def __init__(self, *args, **keywords):
1000 if "ptr" in keywords:
1001 self.ctx = keywords["ctx"]
1002 self.ptr = keywords["ptr"]
1003 return
1004 if len(args) == 1 and args[0].__class__ is aff:
1005 self.ctx = Context.getDefaultInstance()
1006 self.ptr = isl.isl_multi_aff_from_aff(isl.isl_aff_copy(args[0].ptr))
1007 return
1008 if len(args) == 1 and type(args[0]) == str:
1009 self.ctx = Context.getDefaultInstance()
1010 self.ptr = isl.isl_multi_aff_read_from_str(self.ctx, args[0].encode('ascii'))
1011 return
1012 raise Error
1013 def __del__(self):
1014 if hasattr(self, 'ptr'):
1015 isl.isl_multi_aff_free(self.ptr)
1016 def __str__(arg0):
1017 try:
1018 if not arg0.__class__ is multi_aff:
1019 arg0 = multi_aff(arg0)
1020 except:
1021 raise
1022 ptr = isl.isl_multi_aff_to_str(arg0.ptr)
1023 res = cast(ptr, c_char_p).value.decode('ascii')
1024 libc.free(ptr)
1025 return res
1026 def __repr__(self):
1027 s = str(self)
1028 if '"' in s:
1029 return 'isl.multi_aff("""%s""")' % s
1030 else:
1031 return 'isl.multi_aff("%s")' % s
1032 def add(arg0, arg1):
1033 try:
1034 if not arg0.__class__ is multi_aff:
1035 arg0 = multi_aff(arg0)
1036 except:
1037 raise
1038 try:
1039 if not arg1.__class__ is multi_aff:
1040 arg1 = multi_aff(arg1)
1041 except:
1042 return pw_multi_aff(arg0).add(arg1)
1043 ctx = arg0.ctx
1044 res = isl.isl_multi_aff_add(isl.isl_multi_aff_copy(arg0.ptr), isl.isl_multi_aff_copy(arg1.ptr))
1045 return multi_aff(ctx=ctx, ptr=res)
1046 def flat_range_product(arg0, arg1):
1047 try:
1048 if not arg0.__class__ is multi_aff:
1049 arg0 = multi_aff(arg0)
1050 except:
1051 raise
1052 try:
1053 if not arg1.__class__ is multi_aff:
1054 arg1 = multi_aff(arg1)
1055 except:
1056 return pw_multi_aff(arg0).flat_range_product(arg1)
1057 ctx = arg0.ctx
1058 res = isl.isl_multi_aff_flat_range_product(isl.isl_multi_aff_copy(arg0.ptr), isl.isl_multi_aff_copy(arg1.ptr))
1059 return multi_aff(ctx=ctx, ptr=res)
1060 def product(arg0, arg1):
1061 try:
1062 if not arg0.__class__ is multi_aff:
1063 arg0 = multi_aff(arg0)
1064 except:
1065 raise
1066 try:
1067 if not arg1.__class__ is multi_aff:
1068 arg1 = multi_aff(arg1)
1069 except:
1070 return pw_multi_aff(arg0).product(arg1)
1071 ctx = arg0.ctx
1072 res = isl.isl_multi_aff_product(isl.isl_multi_aff_copy(arg0.ptr), isl.isl_multi_aff_copy(arg1.ptr))
1073 return multi_aff(ctx=ctx, ptr=res)
1074 def pullback(arg0, arg1):
1075 if arg1.__class__ is multi_aff:
1076 res = isl.isl_multi_aff_pullback_multi_aff(isl.isl_multi_aff_copy(arg0.ptr), isl.isl_multi_aff_copy(arg1.ptr))
1077 return multi_aff(ctx=arg0.ctx, ptr=res)
1078 def range_product(arg0, arg1):
1079 try:
1080 if not arg0.__class__ is multi_aff:
1081 arg0 = multi_aff(arg0)
1082 except:
1083 raise
1084 try:
1085 if not arg1.__class__ is multi_aff:
1086 arg1 = multi_aff(arg1)
1087 except:
1088 return pw_multi_aff(arg0).range_product(arg1)
1089 ctx = arg0.ctx
1090 res = isl.isl_multi_aff_range_product(isl.isl_multi_aff_copy(arg0.ptr), isl.isl_multi_aff_copy(arg1.ptr))
1091 return multi_aff(ctx=ctx, ptr=res)
1093 isl.isl_multi_aff_from_aff.restype = c_void_p
1094 isl.isl_multi_aff_from_aff.argtypes = [c_void_p]
1095 isl.isl_multi_aff_read_from_str.restype = c_void_p
1096 isl.isl_multi_aff_read_from_str.argtypes = [Context, c_char_p]
1097 isl.isl_multi_aff_add.restype = c_void_p
1098 isl.isl_multi_aff_add.argtypes = [c_void_p, c_void_p]
1099 isl.isl_multi_aff_flat_range_product.restype = c_void_p
1100 isl.isl_multi_aff_flat_range_product.argtypes = [c_void_p, c_void_p]
1101 isl.isl_multi_aff_product.restype = c_void_p
1102 isl.isl_multi_aff_product.argtypes = [c_void_p, c_void_p]
1103 isl.isl_multi_aff_pullback_multi_aff.restype = c_void_p
1104 isl.isl_multi_aff_pullback_multi_aff.argtypes = [c_void_p, c_void_p]
1105 isl.isl_multi_aff_range_product.restype = c_void_p
1106 isl.isl_multi_aff_range_product.argtypes = [c_void_p, c_void_p]
1107 isl.isl_multi_aff_copy.restype = c_void_p
1108 isl.isl_multi_aff_copy.argtypes = [c_void_p]
1109 isl.isl_multi_aff_free.restype = c_void_p
1110 isl.isl_multi_aff_free.argtypes = [c_void_p]
1111 isl.isl_multi_aff_to_str.restype = POINTER(c_char)
1112 isl.isl_multi_aff_to_str.argtypes = [c_void_p]
1114 class aff(pw_aff, multi_aff):
1115 def __init__(self, *args, **keywords):
1116 if "ptr" in keywords:
1117 self.ctx = keywords["ctx"]
1118 self.ptr = keywords["ptr"]
1119 return
1120 if len(args) == 1 and type(args[0]) == str:
1121 self.ctx = Context.getDefaultInstance()
1122 self.ptr = isl.isl_aff_read_from_str(self.ctx, args[0].encode('ascii'))
1123 return
1124 raise Error
1125 def __del__(self):
1126 if hasattr(self, 'ptr'):
1127 isl.isl_aff_free(self.ptr)
1128 def __str__(arg0):
1129 try:
1130 if not arg0.__class__ is aff:
1131 arg0 = aff(arg0)
1132 except:
1133 raise
1134 ptr = isl.isl_aff_to_str(arg0.ptr)
1135 res = cast(ptr, c_char_p).value.decode('ascii')
1136 libc.free(ptr)
1137 return res
1138 def __repr__(self):
1139 s = str(self)
1140 if '"' in s:
1141 return 'isl.aff("""%s""")' % s
1142 else:
1143 return 'isl.aff("%s")' % s
1144 def add(arg0, arg1):
1145 try:
1146 if not arg0.__class__ is aff:
1147 arg0 = aff(arg0)
1148 except:
1149 raise
1150 try:
1151 if not arg1.__class__ is aff:
1152 arg1 = aff(arg1)
1153 except:
1154 return pw_aff(arg0).add(arg1)
1155 ctx = arg0.ctx
1156 res = isl.isl_aff_add(isl.isl_aff_copy(arg0.ptr), isl.isl_aff_copy(arg1.ptr))
1157 return aff(ctx=ctx, ptr=res)
1158 def ceil(arg0):
1159 try:
1160 if not arg0.__class__ is aff:
1161 arg0 = aff(arg0)
1162 except:
1163 raise
1164 ctx = arg0.ctx
1165 res = isl.isl_aff_ceil(isl.isl_aff_copy(arg0.ptr))
1166 return aff(ctx=ctx, ptr=res)
1167 def div(arg0, arg1):
1168 try:
1169 if not arg0.__class__ is aff:
1170 arg0 = aff(arg0)
1171 except:
1172 raise
1173 try:
1174 if not arg1.__class__ is aff:
1175 arg1 = aff(arg1)
1176 except:
1177 return pw_aff(arg0).div(arg1)
1178 ctx = arg0.ctx
1179 res = isl.isl_aff_div(isl.isl_aff_copy(arg0.ptr), isl.isl_aff_copy(arg1.ptr))
1180 return aff(ctx=ctx, ptr=res)
1181 def eq_set(arg0, arg1):
1182 try:
1183 if not arg0.__class__ is aff:
1184 arg0 = aff(arg0)
1185 except:
1186 raise
1187 try:
1188 if not arg1.__class__ is aff:
1189 arg1 = aff(arg1)
1190 except:
1191 return pw_aff(arg0).eq_set(arg1)
1192 ctx = arg0.ctx
1193 res = isl.isl_aff_eq_set(isl.isl_aff_copy(arg0.ptr), isl.isl_aff_copy(arg1.ptr))
1194 return set(ctx=ctx, ptr=res)
1195 def floor(arg0):
1196 try:
1197 if not arg0.__class__ is aff:
1198 arg0 = aff(arg0)
1199 except:
1200 raise
1201 ctx = arg0.ctx
1202 res = isl.isl_aff_floor(isl.isl_aff_copy(arg0.ptr))
1203 return aff(ctx=ctx, ptr=res)
1204 def ge_set(arg0, arg1):
1205 try:
1206 if not arg0.__class__ is aff:
1207 arg0 = aff(arg0)
1208 except:
1209 raise
1210 try:
1211 if not arg1.__class__ is aff:
1212 arg1 = aff(arg1)
1213 except:
1214 return pw_aff(arg0).ge_set(arg1)
1215 ctx = arg0.ctx
1216 res = isl.isl_aff_ge_set(isl.isl_aff_copy(arg0.ptr), isl.isl_aff_copy(arg1.ptr))
1217 return set(ctx=ctx, ptr=res)
1218 def gt_set(arg0, arg1):
1219 try:
1220 if not arg0.__class__ is aff:
1221 arg0 = aff(arg0)
1222 except:
1223 raise
1224 try:
1225 if not arg1.__class__ is aff:
1226 arg1 = aff(arg1)
1227 except:
1228 return pw_aff(arg0).gt_set(arg1)
1229 ctx = arg0.ctx
1230 res = isl.isl_aff_gt_set(isl.isl_aff_copy(arg0.ptr), isl.isl_aff_copy(arg1.ptr))
1231 return set(ctx=ctx, ptr=res)
1232 def le_set(arg0, arg1):
1233 try:
1234 if not arg0.__class__ is aff:
1235 arg0 = aff(arg0)
1236 except:
1237 raise
1238 try:
1239 if not arg1.__class__ is aff:
1240 arg1 = aff(arg1)
1241 except:
1242 return pw_aff(arg0).le_set(arg1)
1243 ctx = arg0.ctx
1244 res = isl.isl_aff_le_set(isl.isl_aff_copy(arg0.ptr), isl.isl_aff_copy(arg1.ptr))
1245 return set(ctx=ctx, ptr=res)
1246 def lt_set(arg0, arg1):
1247 try:
1248 if not arg0.__class__ is aff:
1249 arg0 = aff(arg0)
1250 except:
1251 raise
1252 try:
1253 if not arg1.__class__ is aff:
1254 arg1 = aff(arg1)
1255 except:
1256 return pw_aff(arg0).lt_set(arg1)
1257 ctx = arg0.ctx
1258 res = isl.isl_aff_lt_set(isl.isl_aff_copy(arg0.ptr), isl.isl_aff_copy(arg1.ptr))
1259 return set(ctx=ctx, ptr=res)
1260 def mod(arg0, arg1):
1261 if arg1.__class__ is val:
1262 res = isl.isl_aff_mod_val(isl.isl_aff_copy(arg0.ptr), isl.isl_val_copy(arg1.ptr))
1263 return aff(ctx=arg0.ctx, ptr=res)
1264 def mul(arg0, arg1):
1265 try:
1266 if not arg0.__class__ is aff:
1267 arg0 = aff(arg0)
1268 except:
1269 raise
1270 try:
1271 if not arg1.__class__ is aff:
1272 arg1 = aff(arg1)
1273 except:
1274 return pw_aff(arg0).mul(arg1)
1275 ctx = arg0.ctx
1276 res = isl.isl_aff_mul(isl.isl_aff_copy(arg0.ptr), isl.isl_aff_copy(arg1.ptr))
1277 return aff(ctx=ctx, ptr=res)
1278 def ne_set(arg0, arg1):
1279 try:
1280 if not arg0.__class__ is aff:
1281 arg0 = aff(arg0)
1282 except:
1283 raise
1284 try:
1285 if not arg1.__class__ is aff:
1286 arg1 = aff(arg1)
1287 except:
1288 return pw_aff(arg0).ne_set(arg1)
1289 ctx = arg0.ctx
1290 res = isl.isl_aff_ne_set(isl.isl_aff_copy(arg0.ptr), isl.isl_aff_copy(arg1.ptr))
1291 return set(ctx=ctx, ptr=res)
1292 def neg(arg0):
1293 try:
1294 if not arg0.__class__ is aff:
1295 arg0 = aff(arg0)
1296 except:
1297 raise
1298 ctx = arg0.ctx
1299 res = isl.isl_aff_neg(isl.isl_aff_copy(arg0.ptr))
1300 return aff(ctx=ctx, ptr=res)
1301 def pullback(arg0, arg1):
1302 if arg1.__class__ is multi_aff:
1303 res = isl.isl_aff_pullback_multi_aff(isl.isl_aff_copy(arg0.ptr), isl.isl_multi_aff_copy(arg1.ptr))
1304 return aff(ctx=arg0.ctx, ptr=res)
1305 def scale(arg0, arg1):
1306 if arg1.__class__ is val:
1307 res = isl.isl_aff_scale_val(isl.isl_aff_copy(arg0.ptr), isl.isl_val_copy(arg1.ptr))
1308 return aff(ctx=arg0.ctx, ptr=res)
1309 def scale_down(arg0, arg1):
1310 if arg1.__class__ is val:
1311 res = isl.isl_aff_scale_down_val(isl.isl_aff_copy(arg0.ptr), isl.isl_val_copy(arg1.ptr))
1312 return aff(ctx=arg0.ctx, ptr=res)
1313 def sub(arg0, arg1):
1314 try:
1315 if not arg0.__class__ is aff:
1316 arg0 = aff(arg0)
1317 except:
1318 raise
1319 try:
1320 if not arg1.__class__ is aff:
1321 arg1 = aff(arg1)
1322 except:
1323 return pw_aff(arg0).sub(arg1)
1324 ctx = arg0.ctx
1325 res = isl.isl_aff_sub(isl.isl_aff_copy(arg0.ptr), isl.isl_aff_copy(arg1.ptr))
1326 return aff(ctx=ctx, ptr=res)
1328 isl.isl_aff_read_from_str.restype = c_void_p
1329 isl.isl_aff_read_from_str.argtypes = [Context, c_char_p]
1330 isl.isl_aff_add.restype = c_void_p
1331 isl.isl_aff_add.argtypes = [c_void_p, c_void_p]
1332 isl.isl_aff_ceil.restype = c_void_p
1333 isl.isl_aff_ceil.argtypes = [c_void_p]
1334 isl.isl_aff_div.restype = c_void_p
1335 isl.isl_aff_div.argtypes = [c_void_p, c_void_p]
1336 isl.isl_aff_eq_set.restype = c_void_p
1337 isl.isl_aff_eq_set.argtypes = [c_void_p, c_void_p]
1338 isl.isl_aff_floor.restype = c_void_p
1339 isl.isl_aff_floor.argtypes = [c_void_p]
1340 isl.isl_aff_ge_set.restype = c_void_p
1341 isl.isl_aff_ge_set.argtypes = [c_void_p, c_void_p]
1342 isl.isl_aff_gt_set.restype = c_void_p
1343 isl.isl_aff_gt_set.argtypes = [c_void_p, c_void_p]
1344 isl.isl_aff_le_set.restype = c_void_p
1345 isl.isl_aff_le_set.argtypes = [c_void_p, c_void_p]
1346 isl.isl_aff_lt_set.restype = c_void_p
1347 isl.isl_aff_lt_set.argtypes = [c_void_p, c_void_p]
1348 isl.isl_aff_mod_val.restype = c_void_p
1349 isl.isl_aff_mod_val.argtypes = [c_void_p, c_void_p]
1350 isl.isl_aff_mul.restype = c_void_p
1351 isl.isl_aff_mul.argtypes = [c_void_p, c_void_p]
1352 isl.isl_aff_ne_set.restype = c_void_p
1353 isl.isl_aff_ne_set.argtypes = [c_void_p, c_void_p]
1354 isl.isl_aff_neg.restype = c_void_p
1355 isl.isl_aff_neg.argtypes = [c_void_p]
1356 isl.isl_aff_pullback_multi_aff.restype = c_void_p
1357 isl.isl_aff_pullback_multi_aff.argtypes = [c_void_p, c_void_p]
1358 isl.isl_aff_scale_val.restype = c_void_p
1359 isl.isl_aff_scale_val.argtypes = [c_void_p, c_void_p]
1360 isl.isl_aff_scale_down_val.restype = c_void_p
1361 isl.isl_aff_scale_down_val.argtypes = [c_void_p, c_void_p]
1362 isl.isl_aff_sub.restype = c_void_p
1363 isl.isl_aff_sub.argtypes = [c_void_p, c_void_p]
1364 isl.isl_aff_copy.restype = c_void_p
1365 isl.isl_aff_copy.argtypes = [c_void_p]
1366 isl.isl_aff_free.restype = c_void_p
1367 isl.isl_aff_free.argtypes = [c_void_p]
1368 isl.isl_aff_to_str.restype = POINTER(c_char)
1369 isl.isl_aff_to_str.argtypes = [c_void_p]
1371 class ast_build(object):
1372 def __init__(self, *args, **keywords):
1373 if "ptr" in keywords:
1374 self.ctx = keywords["ctx"]
1375 self.ptr = keywords["ptr"]
1376 return
1377 if len(args) == 0:
1378 self.ctx = Context.getDefaultInstance()
1379 self.ptr = isl.isl_ast_build_alloc(self.ctx)
1380 return
1381 raise Error
1382 def __del__(self):
1383 if hasattr(self, 'ptr'):
1384 isl.isl_ast_build_free(self.ptr)
1385 def access_from(arg0, arg1):
1386 if arg1.__class__ is pw_multi_aff:
1387 res = isl.isl_ast_build_access_from_pw_multi_aff(arg0.ptr, isl.isl_pw_multi_aff_copy(arg1.ptr))
1388 return ast_expr(ctx=arg0.ctx, ptr=res)
1389 if arg1.__class__ is multi_pw_aff:
1390 res = isl.isl_ast_build_access_from_multi_pw_aff(arg0.ptr, isl.isl_multi_pw_aff_copy(arg1.ptr))
1391 return ast_expr(ctx=arg0.ctx, ptr=res)
1392 def call_from(arg0, arg1):
1393 if arg1.__class__ is pw_multi_aff:
1394 res = isl.isl_ast_build_call_from_pw_multi_aff(arg0.ptr, isl.isl_pw_multi_aff_copy(arg1.ptr))
1395 return ast_expr(ctx=arg0.ctx, ptr=res)
1396 if arg1.__class__ is multi_pw_aff:
1397 res = isl.isl_ast_build_call_from_multi_pw_aff(arg0.ptr, isl.isl_multi_pw_aff_copy(arg1.ptr))
1398 return ast_expr(ctx=arg0.ctx, ptr=res)
1399 def expr_from(arg0, arg1):
1400 if arg1.__class__ is set:
1401 res = isl.isl_ast_build_expr_from_set(arg0.ptr, isl.isl_set_copy(arg1.ptr))
1402 return ast_expr(ctx=arg0.ctx, ptr=res)
1403 if arg1.__class__ is pw_aff:
1404 res = isl.isl_ast_build_expr_from_pw_aff(arg0.ptr, isl.isl_pw_aff_copy(arg1.ptr))
1405 return ast_expr(ctx=arg0.ctx, ptr=res)
1406 @staticmethod
1407 def from_context(arg0):
1408 try:
1409 if not arg0.__class__ is set:
1410 arg0 = set(arg0)
1411 except:
1412 raise
1413 ctx = arg0.ctx
1414 res = isl.isl_ast_build_from_context(isl.isl_set_copy(arg0.ptr))
1415 return ast_build(ctx=ctx, ptr=res)
1416 def node_from_schedule_map(arg0, arg1):
1417 try:
1418 if not arg0.__class__ is ast_build:
1419 arg0 = ast_build(arg0)
1420 except:
1421 raise
1422 try:
1423 if not arg1.__class__ is union_map:
1424 arg1 = union_map(arg1)
1425 except:
1426 raise
1427 ctx = arg0.ctx
1428 res = isl.isl_ast_build_node_from_schedule_map(arg0.ptr, isl.isl_union_map_copy(arg1.ptr))
1429 return ast_node(ctx=ctx, ptr=res)
1431 isl.isl_ast_build_alloc.restype = c_void_p
1432 isl.isl_ast_build_alloc.argtypes = [Context]
1433 isl.isl_ast_build_access_from_pw_multi_aff.restype = c_void_p
1434 isl.isl_ast_build_access_from_pw_multi_aff.argtypes = [c_void_p, c_void_p]
1435 isl.isl_ast_build_access_from_multi_pw_aff.restype = c_void_p
1436 isl.isl_ast_build_access_from_multi_pw_aff.argtypes = [c_void_p, c_void_p]
1437 isl.isl_ast_build_call_from_pw_multi_aff.restype = c_void_p
1438 isl.isl_ast_build_call_from_pw_multi_aff.argtypes = [c_void_p, c_void_p]
1439 isl.isl_ast_build_call_from_multi_pw_aff.restype = c_void_p
1440 isl.isl_ast_build_call_from_multi_pw_aff.argtypes = [c_void_p, c_void_p]
1441 isl.isl_ast_build_expr_from_set.restype = c_void_p
1442 isl.isl_ast_build_expr_from_set.argtypes = [c_void_p, c_void_p]
1443 isl.isl_ast_build_expr_from_pw_aff.restype = c_void_p
1444 isl.isl_ast_build_expr_from_pw_aff.argtypes = [c_void_p, c_void_p]
1445 isl.isl_ast_build_from_context.restype = c_void_p
1446 isl.isl_ast_build_from_context.argtypes = [c_void_p]
1447 isl.isl_ast_build_node_from_schedule_map.restype = c_void_p
1448 isl.isl_ast_build_node_from_schedule_map.argtypes = [c_void_p, c_void_p]
1449 isl.isl_ast_build_copy.restype = c_void_p
1450 isl.isl_ast_build_copy.argtypes = [c_void_p]
1451 isl.isl_ast_build_free.restype = c_void_p
1452 isl.isl_ast_build_free.argtypes = [c_void_p]
1454 class ast_expr(object):
1455 def __init__(self, *args, **keywords):
1456 if "ptr" in keywords:
1457 self.ctx = keywords["ctx"]
1458 self.ptr = keywords["ptr"]
1459 return
1460 raise Error
1461 def __del__(self):
1462 if hasattr(self, 'ptr'):
1463 isl.isl_ast_expr_free(self.ptr)
1464 def __str__(arg0):
1465 try:
1466 if not arg0.__class__ is ast_expr:
1467 arg0 = ast_expr(arg0)
1468 except:
1469 raise
1470 ptr = isl.isl_ast_expr_to_str(arg0.ptr)
1471 res = cast(ptr, c_char_p).value.decode('ascii')
1472 libc.free(ptr)
1473 return res
1474 def __repr__(self):
1475 s = str(self)
1476 if '"' in s:
1477 return 'isl.ast_expr("""%s""")' % s
1478 else:
1479 return 'isl.ast_expr("%s")' % s
1480 def to_C_str(arg0):
1481 try:
1482 if not arg0.__class__ is ast_expr:
1483 arg0 = ast_expr(arg0)
1484 except:
1485 raise
1486 ctx = arg0.ctx
1487 res = isl.isl_ast_expr_to_C_str(arg0.ptr)
1488 if res == 0:
1489 raise
1490 string = cast(res, c_char_p).value.decode('ascii')
1491 libc.free(res)
1492 return string
1494 isl.isl_ast_expr_to_C_str.restype = POINTER(c_char)
1495 isl.isl_ast_expr_to_C_str.argtypes = [c_void_p]
1496 isl.isl_ast_expr_copy.restype = c_void_p
1497 isl.isl_ast_expr_copy.argtypes = [c_void_p]
1498 isl.isl_ast_expr_free.restype = c_void_p
1499 isl.isl_ast_expr_free.argtypes = [c_void_p]
1500 isl.isl_ast_expr_to_str.restype = POINTER(c_char)
1501 isl.isl_ast_expr_to_str.argtypes = [c_void_p]
1503 class ast_node(object):
1504 def __init__(self, *args, **keywords):
1505 if "ptr" in keywords:
1506 self.ctx = keywords["ctx"]
1507 self.ptr = keywords["ptr"]
1508 return
1509 raise Error
1510 def __del__(self):
1511 if hasattr(self, 'ptr'):
1512 isl.isl_ast_node_free(self.ptr)
1513 def __str__(arg0):
1514 try:
1515 if not arg0.__class__ is ast_node:
1516 arg0 = ast_node(arg0)
1517 except:
1518 raise
1519 ptr = isl.isl_ast_node_to_str(arg0.ptr)
1520 res = cast(ptr, c_char_p).value.decode('ascii')
1521 libc.free(ptr)
1522 return res
1523 def __repr__(self):
1524 s = str(self)
1525 if '"' in s:
1526 return 'isl.ast_node("""%s""")' % s
1527 else:
1528 return 'isl.ast_node("%s")' % s
1529 def to_C_str(arg0):
1530 try:
1531 if not arg0.__class__ is ast_node:
1532 arg0 = ast_node(arg0)
1533 except:
1534 raise
1535 ctx = arg0.ctx
1536 res = isl.isl_ast_node_to_C_str(arg0.ptr)
1537 if res == 0:
1538 raise
1539 string = cast(res, c_char_p).value.decode('ascii')
1540 libc.free(res)
1541 return string
1543 isl.isl_ast_node_to_C_str.restype = POINTER(c_char)
1544 isl.isl_ast_node_to_C_str.argtypes = [c_void_p]
1545 isl.isl_ast_node_copy.restype = c_void_p
1546 isl.isl_ast_node_copy.argtypes = [c_void_p]
1547 isl.isl_ast_node_free.restype = c_void_p
1548 isl.isl_ast_node_free.argtypes = [c_void_p]
1549 isl.isl_ast_node_to_str.restype = POINTER(c_char)
1550 isl.isl_ast_node_to_str.argtypes = [c_void_p]
1552 class union_map(object):
1553 def __init__(self, *args, **keywords):
1554 if "ptr" in keywords:
1555 self.ctx = keywords["ctx"]
1556 self.ptr = keywords["ptr"]
1557 return
1558 if len(args) == 1 and args[0].__class__ is basic_map:
1559 self.ctx = Context.getDefaultInstance()
1560 self.ptr = isl.isl_union_map_from_basic_map(isl.isl_basic_map_copy(args[0].ptr))
1561 return
1562 if len(args) == 1 and args[0].__class__ is map:
1563 self.ctx = Context.getDefaultInstance()
1564 self.ptr = isl.isl_union_map_from_map(isl.isl_map_copy(args[0].ptr))
1565 return
1566 if len(args) == 1 and type(args[0]) == str:
1567 self.ctx = Context.getDefaultInstance()
1568 self.ptr = isl.isl_union_map_read_from_str(self.ctx, args[0].encode('ascii'))
1569 return
1570 raise Error
1571 def __del__(self):
1572 if hasattr(self, 'ptr'):
1573 isl.isl_union_map_free(self.ptr)
1574 def __str__(arg0):
1575 try:
1576 if not arg0.__class__ is union_map:
1577 arg0 = union_map(arg0)
1578 except:
1579 raise
1580 ptr = isl.isl_union_map_to_str(arg0.ptr)
1581 res = cast(ptr, c_char_p).value.decode('ascii')
1582 libc.free(ptr)
1583 return res
1584 def __repr__(self):
1585 s = str(self)
1586 if '"' in s:
1587 return 'isl.union_map("""%s""")' % s
1588 else:
1589 return 'isl.union_map("%s")' % s
1590 def affine_hull(arg0):
1591 try:
1592 if not arg0.__class__ is union_map:
1593 arg0 = union_map(arg0)
1594 except:
1595 raise
1596 ctx = arg0.ctx
1597 res = isl.isl_union_map_affine_hull(isl.isl_union_map_copy(arg0.ptr))
1598 return union_map(ctx=ctx, ptr=res)
1599 def apply_domain(arg0, arg1):
1600 try:
1601 if not arg0.__class__ is union_map:
1602 arg0 = union_map(arg0)
1603 except:
1604 raise
1605 try:
1606 if not arg1.__class__ is union_map:
1607 arg1 = union_map(arg1)
1608 except:
1609 raise
1610 ctx = arg0.ctx
1611 res = isl.isl_union_map_apply_domain(isl.isl_union_map_copy(arg0.ptr), isl.isl_union_map_copy(arg1.ptr))
1612 return union_map(ctx=ctx, ptr=res)
1613 def apply_range(arg0, arg1):
1614 try:
1615 if not arg0.__class__ is union_map:
1616 arg0 = union_map(arg0)
1617 except:
1618 raise
1619 try:
1620 if not arg1.__class__ is union_map:
1621 arg1 = union_map(arg1)
1622 except:
1623 raise
1624 ctx = arg0.ctx
1625 res = isl.isl_union_map_apply_range(isl.isl_union_map_copy(arg0.ptr), isl.isl_union_map_copy(arg1.ptr))
1626 return union_map(ctx=ctx, ptr=res)
1627 def coalesce(arg0):
1628 try:
1629 if not arg0.__class__ is union_map:
1630 arg0 = union_map(arg0)
1631 except:
1632 raise
1633 ctx = arg0.ctx
1634 res = isl.isl_union_map_coalesce(isl.isl_union_map_copy(arg0.ptr))
1635 return union_map(ctx=ctx, ptr=res)
1636 def compute_divs(arg0):
1637 try:
1638 if not arg0.__class__ is union_map:
1639 arg0 = union_map(arg0)
1640 except:
1641 raise
1642 ctx = arg0.ctx
1643 res = isl.isl_union_map_compute_divs(isl.isl_union_map_copy(arg0.ptr))
1644 return union_map(ctx=ctx, ptr=res)
1645 def deltas(arg0):
1646 try:
1647 if not arg0.__class__ is union_map:
1648 arg0 = union_map(arg0)
1649 except:
1650 raise
1651 ctx = arg0.ctx
1652 res = isl.isl_union_map_deltas(isl.isl_union_map_copy(arg0.ptr))
1653 return union_set(ctx=ctx, ptr=res)
1654 def detect_equalities(arg0):
1655 try:
1656 if not arg0.__class__ is union_map:
1657 arg0 = union_map(arg0)
1658 except:
1659 raise
1660 ctx = arg0.ctx
1661 res = isl.isl_union_map_detect_equalities(isl.isl_union_map_copy(arg0.ptr))
1662 return union_map(ctx=ctx, ptr=res)
1663 def domain(arg0):
1664 try:
1665 if not arg0.__class__ is union_map:
1666 arg0 = union_map(arg0)
1667 except:
1668 raise
1669 ctx = arg0.ctx
1670 res = isl.isl_union_map_domain(isl.isl_union_map_copy(arg0.ptr))
1671 return union_set(ctx=ctx, ptr=res)
1672 def domain_factor_domain(arg0):
1673 try:
1674 if not arg0.__class__ is union_map:
1675 arg0 = union_map(arg0)
1676 except:
1677 raise
1678 ctx = arg0.ctx
1679 res = isl.isl_union_map_domain_factor_domain(isl.isl_union_map_copy(arg0.ptr))
1680 return union_map(ctx=ctx, ptr=res)
1681 def domain_factor_range(arg0):
1682 try:
1683 if not arg0.__class__ is union_map:
1684 arg0 = union_map(arg0)
1685 except:
1686 raise
1687 ctx = arg0.ctx
1688 res = isl.isl_union_map_domain_factor_range(isl.isl_union_map_copy(arg0.ptr))
1689 return union_map(ctx=ctx, ptr=res)
1690 def domain_map(arg0):
1691 try:
1692 if not arg0.__class__ is union_map:
1693 arg0 = union_map(arg0)
1694 except:
1695 raise
1696 ctx = arg0.ctx
1697 res = isl.isl_union_map_domain_map(isl.isl_union_map_copy(arg0.ptr))
1698 return union_map(ctx=ctx, ptr=res)
1699 def domain_map_union_pw_multi_aff(arg0):
1700 try:
1701 if not arg0.__class__ is union_map:
1702 arg0 = union_map(arg0)
1703 except:
1704 raise
1705 ctx = arg0.ctx
1706 res = isl.isl_union_map_domain_map_union_pw_multi_aff(isl.isl_union_map_copy(arg0.ptr))
1707 return union_pw_multi_aff(ctx=ctx, ptr=res)
1708 def domain_product(arg0, arg1):
1709 try:
1710 if not arg0.__class__ is union_map:
1711 arg0 = union_map(arg0)
1712 except:
1713 raise
1714 try:
1715 if not arg1.__class__ is union_map:
1716 arg1 = union_map(arg1)
1717 except:
1718 raise
1719 ctx = arg0.ctx
1720 res = isl.isl_union_map_domain_product(isl.isl_union_map_copy(arg0.ptr), isl.isl_union_map_copy(arg1.ptr))
1721 return union_map(ctx=ctx, ptr=res)
1722 def eq_at(arg0, arg1):
1723 if arg1.__class__ is multi_union_pw_aff:
1724 res = isl.isl_union_map_eq_at_multi_union_pw_aff(isl.isl_union_map_copy(arg0.ptr), isl.isl_multi_union_pw_aff_copy(arg1.ptr))
1725 return union_map(ctx=arg0.ctx, ptr=res)
1726 def factor_domain(arg0):
1727 try:
1728 if not arg0.__class__ is union_map:
1729 arg0 = union_map(arg0)
1730 except:
1731 raise
1732 ctx = arg0.ctx
1733 res = isl.isl_union_map_factor_domain(isl.isl_union_map_copy(arg0.ptr))
1734 return union_map(ctx=ctx, ptr=res)
1735 def factor_range(arg0):
1736 try:
1737 if not arg0.__class__ is union_map:
1738 arg0 = union_map(arg0)
1739 except:
1740 raise
1741 ctx = arg0.ctx
1742 res = isl.isl_union_map_factor_range(isl.isl_union_map_copy(arg0.ptr))
1743 return union_map(ctx=ctx, ptr=res)
1744 def fixed_power(arg0, arg1):
1745 if arg1.__class__ is val:
1746 res = isl.isl_union_map_fixed_power_val(isl.isl_union_map_copy(arg0.ptr), isl.isl_val_copy(arg1.ptr))
1747 return union_map(ctx=arg0.ctx, ptr=res)
1748 def foreach_map(arg0, arg1):
1749 try:
1750 if not arg0.__class__ is union_map:
1751 arg0 = union_map(arg0)
1752 except:
1753 raise
1754 exc_info = [None]
1755 fn = CFUNCTYPE(c_int, c_void_p, c_void_p)
1756 def cb_func(cb_arg0, cb_arg1):
1757 cb_arg0 = map(ctx=arg0.ctx, ptr=cb_arg0)
1758 try:
1759 arg1(cb_arg0)
1760 except:
1761 import sys
1762 exc_info[0] = sys.exc_info()
1763 return -1
1764 return 0
1765 cb = fn(cb_func)
1766 ctx = arg0.ctx
1767 res = isl.isl_union_map_foreach_map(arg0.ptr, cb, None)
1768 if exc_info[0] != None:
1769 raise (exc_info[0][0], exc_info[0][1], exc_info[0][2])
1770 return res
1771 @staticmethod
1772 def convert_from(arg0):
1773 if arg0.__class__ is union_pw_multi_aff:
1774 res = isl.isl_union_map_from_union_pw_multi_aff(isl.isl_union_pw_multi_aff_copy(arg0.ptr))
1775 return union_map(ctx=arg0.ctx, ptr=res)
1776 if arg0.__class__ is multi_union_pw_aff:
1777 res = isl.isl_union_map_from_multi_union_pw_aff(isl.isl_multi_union_pw_aff_copy(arg0.ptr))
1778 return union_map(ctx=arg0.ctx, ptr=res)
1779 @staticmethod
1780 def from_domain(arg0):
1781 try:
1782 if not arg0.__class__ is union_set:
1783 arg0 = union_set(arg0)
1784 except:
1785 raise
1786 ctx = arg0.ctx
1787 res = isl.isl_union_map_from_domain(isl.isl_union_set_copy(arg0.ptr))
1788 return union_map(ctx=ctx, ptr=res)
1789 @staticmethod
1790 def from_domain_and_range(arg0, arg1):
1791 try:
1792 if not arg0.__class__ is union_set:
1793 arg0 = union_set(arg0)
1794 except:
1795 raise
1796 try:
1797 if not arg1.__class__ is union_set:
1798 arg1 = union_set(arg1)
1799 except:
1800 raise
1801 ctx = arg0.ctx
1802 res = isl.isl_union_map_from_domain_and_range(isl.isl_union_set_copy(arg0.ptr), isl.isl_union_set_copy(arg1.ptr))
1803 return union_map(ctx=ctx, ptr=res)
1804 @staticmethod
1805 def from_range(arg0):
1806 try:
1807 if not arg0.__class__ is union_set:
1808 arg0 = union_set(arg0)
1809 except:
1810 raise
1811 ctx = arg0.ctx
1812 res = isl.isl_union_map_from_range(isl.isl_union_set_copy(arg0.ptr))
1813 return union_map(ctx=ctx, ptr=res)
1814 def gist(arg0, arg1):
1815 try:
1816 if not arg0.__class__ is union_map:
1817 arg0 = union_map(arg0)
1818 except:
1819 raise
1820 try:
1821 if not arg1.__class__ is union_map:
1822 arg1 = union_map(arg1)
1823 except:
1824 raise
1825 ctx = arg0.ctx
1826 res = isl.isl_union_map_gist(isl.isl_union_map_copy(arg0.ptr), isl.isl_union_map_copy(arg1.ptr))
1827 return union_map(ctx=ctx, ptr=res)
1828 def gist_domain(arg0, arg1):
1829 try:
1830 if not arg0.__class__ is union_map:
1831 arg0 = union_map(arg0)
1832 except:
1833 raise
1834 try:
1835 if not arg1.__class__ is union_set:
1836 arg1 = union_set(arg1)
1837 except:
1838 raise
1839 ctx = arg0.ctx
1840 res = isl.isl_union_map_gist_domain(isl.isl_union_map_copy(arg0.ptr), isl.isl_union_set_copy(arg1.ptr))
1841 return union_map(ctx=ctx, ptr=res)
1842 def gist_params(arg0, arg1):
1843 try:
1844 if not arg0.__class__ is union_map:
1845 arg0 = union_map(arg0)
1846 except:
1847 raise
1848 try:
1849 if not arg1.__class__ is set:
1850 arg1 = set(arg1)
1851 except:
1852 raise
1853 ctx = arg0.ctx
1854 res = isl.isl_union_map_gist_params(isl.isl_union_map_copy(arg0.ptr), isl.isl_set_copy(arg1.ptr))
1855 return union_map(ctx=ctx, ptr=res)
1856 def gist_range(arg0, arg1):
1857 try:
1858 if not arg0.__class__ is union_map:
1859 arg0 = union_map(arg0)
1860 except:
1861 raise
1862 try:
1863 if not arg1.__class__ is union_set:
1864 arg1 = union_set(arg1)
1865 except:
1866 raise
1867 ctx = arg0.ctx
1868 res = isl.isl_union_map_gist_range(isl.isl_union_map_copy(arg0.ptr), isl.isl_union_set_copy(arg1.ptr))
1869 return union_map(ctx=ctx, ptr=res)
1870 def intersect(arg0, arg1):
1871 try:
1872 if not arg0.__class__ is union_map:
1873 arg0 = union_map(arg0)
1874 except:
1875 raise
1876 try:
1877 if not arg1.__class__ is union_map:
1878 arg1 = union_map(arg1)
1879 except:
1880 raise
1881 ctx = arg0.ctx
1882 res = isl.isl_union_map_intersect(isl.isl_union_map_copy(arg0.ptr), isl.isl_union_map_copy(arg1.ptr))
1883 return union_map(ctx=ctx, ptr=res)
1884 def intersect_domain(arg0, arg1):
1885 try:
1886 if not arg0.__class__ is union_map:
1887 arg0 = union_map(arg0)
1888 except:
1889 raise
1890 try:
1891 if not arg1.__class__ is union_set:
1892 arg1 = union_set(arg1)
1893 except:
1894 raise
1895 ctx = arg0.ctx
1896 res = isl.isl_union_map_intersect_domain(isl.isl_union_map_copy(arg0.ptr), isl.isl_union_set_copy(arg1.ptr))
1897 return union_map(ctx=ctx, ptr=res)
1898 def intersect_params(arg0, arg1):
1899 try:
1900 if not arg0.__class__ is union_map:
1901 arg0 = union_map(arg0)
1902 except:
1903 raise
1904 try:
1905 if not arg1.__class__ is set:
1906 arg1 = set(arg1)
1907 except:
1908 raise
1909 ctx = arg0.ctx
1910 res = isl.isl_union_map_intersect_params(isl.isl_union_map_copy(arg0.ptr), isl.isl_set_copy(arg1.ptr))
1911 return union_map(ctx=ctx, ptr=res)
1912 def intersect_range(arg0, arg1):
1913 try:
1914 if not arg0.__class__ is union_map:
1915 arg0 = union_map(arg0)
1916 except:
1917 raise
1918 try:
1919 if not arg1.__class__ is union_set:
1920 arg1 = union_set(arg1)
1921 except:
1922 raise
1923 ctx = arg0.ctx
1924 res = isl.isl_union_map_intersect_range(isl.isl_union_map_copy(arg0.ptr), isl.isl_union_set_copy(arg1.ptr))
1925 return union_map(ctx=ctx, ptr=res)
1926 def is_bijective(arg0):
1927 try:
1928 if not arg0.__class__ is union_map:
1929 arg0 = union_map(arg0)
1930 except:
1931 raise
1932 ctx = arg0.ctx
1933 res = isl.isl_union_map_is_bijective(arg0.ptr)
1934 if res < 0:
1935 raise
1936 return bool(res)
1937 def is_empty(arg0):
1938 try:
1939 if not arg0.__class__ is union_map:
1940 arg0 = union_map(arg0)
1941 except:
1942 raise
1943 ctx = arg0.ctx
1944 res = isl.isl_union_map_is_empty(arg0.ptr)
1945 if res < 0:
1946 raise
1947 return bool(res)
1948 def is_equal(arg0, arg1):
1949 try:
1950 if not arg0.__class__ is union_map:
1951 arg0 = union_map(arg0)
1952 except:
1953 raise
1954 try:
1955 if not arg1.__class__ is union_map:
1956 arg1 = union_map(arg1)
1957 except:
1958 raise
1959 ctx = arg0.ctx
1960 res = isl.isl_union_map_is_equal(arg0.ptr, arg1.ptr)
1961 if res < 0:
1962 raise
1963 return bool(res)
1964 def is_injective(arg0):
1965 try:
1966 if not arg0.__class__ is union_map:
1967 arg0 = union_map(arg0)
1968 except:
1969 raise
1970 ctx = arg0.ctx
1971 res = isl.isl_union_map_is_injective(arg0.ptr)
1972 if res < 0:
1973 raise
1974 return bool(res)
1975 def is_single_valued(arg0):
1976 try:
1977 if not arg0.__class__ is union_map:
1978 arg0 = union_map(arg0)
1979 except:
1980 raise
1981 ctx = arg0.ctx
1982 res = isl.isl_union_map_is_single_valued(arg0.ptr)
1983 if res < 0:
1984 raise
1985 return bool(res)
1986 def is_strict_subset(arg0, arg1):
1987 try:
1988 if not arg0.__class__ is union_map:
1989 arg0 = union_map(arg0)
1990 except:
1991 raise
1992 try:
1993 if not arg1.__class__ is union_map:
1994 arg1 = union_map(arg1)
1995 except:
1996 raise
1997 ctx = arg0.ctx
1998 res = isl.isl_union_map_is_strict_subset(arg0.ptr, arg1.ptr)
1999 if res < 0:
2000 raise
2001 return bool(res)
2002 def is_subset(arg0, arg1):
2003 try:
2004 if not arg0.__class__ is union_map:
2005 arg0 = union_map(arg0)
2006 except:
2007 raise
2008 try:
2009 if not arg1.__class__ is union_map:
2010 arg1 = union_map(arg1)
2011 except:
2012 raise
2013 ctx = arg0.ctx
2014 res = isl.isl_union_map_is_subset(arg0.ptr, arg1.ptr)
2015 if res < 0:
2016 raise
2017 return bool(res)
2018 def lexmax(arg0):
2019 try:
2020 if not arg0.__class__ is union_map:
2021 arg0 = union_map(arg0)
2022 except:
2023 raise
2024 ctx = arg0.ctx
2025 res = isl.isl_union_map_lexmax(isl.isl_union_map_copy(arg0.ptr))
2026 return union_map(ctx=ctx, ptr=res)
2027 def lexmin(arg0):
2028 try:
2029 if not arg0.__class__ is union_map:
2030 arg0 = union_map(arg0)
2031 except:
2032 raise
2033 ctx = arg0.ctx
2034 res = isl.isl_union_map_lexmin(isl.isl_union_map_copy(arg0.ptr))
2035 return union_map(ctx=ctx, ptr=res)
2036 def polyhedral_hull(arg0):
2037 try:
2038 if not arg0.__class__ is union_map:
2039 arg0 = union_map(arg0)
2040 except:
2041 raise
2042 ctx = arg0.ctx
2043 res = isl.isl_union_map_polyhedral_hull(isl.isl_union_map_copy(arg0.ptr))
2044 return union_map(ctx=ctx, ptr=res)
2045 def product(arg0, arg1):
2046 try:
2047 if not arg0.__class__ is union_map:
2048 arg0 = union_map(arg0)
2049 except:
2050 raise
2051 try:
2052 if not arg1.__class__ is union_map:
2053 arg1 = union_map(arg1)
2054 except:
2055 raise
2056 ctx = arg0.ctx
2057 res = isl.isl_union_map_product(isl.isl_union_map_copy(arg0.ptr), isl.isl_union_map_copy(arg1.ptr))
2058 return union_map(ctx=ctx, ptr=res)
2059 def project_out_all_params(arg0):
2060 try:
2061 if not arg0.__class__ is union_map:
2062 arg0 = union_map(arg0)
2063 except:
2064 raise
2065 ctx = arg0.ctx
2066 res = isl.isl_union_map_project_out_all_params(isl.isl_union_map_copy(arg0.ptr))
2067 return union_map(ctx=ctx, ptr=res)
2068 def range(arg0):
2069 try:
2070 if not arg0.__class__ is union_map:
2071 arg0 = union_map(arg0)
2072 except:
2073 raise
2074 ctx = arg0.ctx
2075 res = isl.isl_union_map_range(isl.isl_union_map_copy(arg0.ptr))
2076 return union_set(ctx=ctx, ptr=res)
2077 def range_factor_domain(arg0):
2078 try:
2079 if not arg0.__class__ is union_map:
2080 arg0 = union_map(arg0)
2081 except:
2082 raise
2083 ctx = arg0.ctx
2084 res = isl.isl_union_map_range_factor_domain(isl.isl_union_map_copy(arg0.ptr))
2085 return union_map(ctx=ctx, ptr=res)
2086 def range_factor_range(arg0):
2087 try:
2088 if not arg0.__class__ is union_map:
2089 arg0 = union_map(arg0)
2090 except:
2091 raise
2092 ctx = arg0.ctx
2093 res = isl.isl_union_map_range_factor_range(isl.isl_union_map_copy(arg0.ptr))
2094 return union_map(ctx=ctx, ptr=res)
2095 def range_map(arg0):
2096 try:
2097 if not arg0.__class__ is union_map:
2098 arg0 = union_map(arg0)
2099 except:
2100 raise
2101 ctx = arg0.ctx
2102 res = isl.isl_union_map_range_map(isl.isl_union_map_copy(arg0.ptr))
2103 return union_map(ctx=ctx, ptr=res)
2104 def range_product(arg0, arg1):
2105 try:
2106 if not arg0.__class__ is union_map:
2107 arg0 = union_map(arg0)
2108 except:
2109 raise
2110 try:
2111 if not arg1.__class__ is union_map:
2112 arg1 = union_map(arg1)
2113 except:
2114 raise
2115 ctx = arg0.ctx
2116 res = isl.isl_union_map_range_product(isl.isl_union_map_copy(arg0.ptr), isl.isl_union_map_copy(arg1.ptr))
2117 return union_map(ctx=ctx, ptr=res)
2118 def reverse(arg0):
2119 try:
2120 if not arg0.__class__ is union_map:
2121 arg0 = union_map(arg0)
2122 except:
2123 raise
2124 ctx = arg0.ctx
2125 res = isl.isl_union_map_reverse(isl.isl_union_map_copy(arg0.ptr))
2126 return union_map(ctx=ctx, ptr=res)
2127 def subtract(arg0, arg1):
2128 try:
2129 if not arg0.__class__ is union_map:
2130 arg0 = union_map(arg0)
2131 except:
2132 raise
2133 try:
2134 if not arg1.__class__ is union_map:
2135 arg1 = union_map(arg1)
2136 except:
2137 raise
2138 ctx = arg0.ctx
2139 res = isl.isl_union_map_subtract(isl.isl_union_map_copy(arg0.ptr), isl.isl_union_map_copy(arg1.ptr))
2140 return union_map(ctx=ctx, ptr=res)
2141 def subtract_domain(arg0, arg1):
2142 try:
2143 if not arg0.__class__ is union_map:
2144 arg0 = union_map(arg0)
2145 except:
2146 raise
2147 try:
2148 if not arg1.__class__ is union_set:
2149 arg1 = union_set(arg1)
2150 except:
2151 raise
2152 ctx = arg0.ctx
2153 res = isl.isl_union_map_subtract_domain(isl.isl_union_map_copy(arg0.ptr), isl.isl_union_set_copy(arg1.ptr))
2154 return union_map(ctx=ctx, ptr=res)
2155 def subtract_range(arg0, arg1):
2156 try:
2157 if not arg0.__class__ is union_map:
2158 arg0 = union_map(arg0)
2159 except:
2160 raise
2161 try:
2162 if not arg1.__class__ is union_set:
2163 arg1 = union_set(arg1)
2164 except:
2165 raise
2166 ctx = arg0.ctx
2167 res = isl.isl_union_map_subtract_range(isl.isl_union_map_copy(arg0.ptr), isl.isl_union_set_copy(arg1.ptr))
2168 return union_map(ctx=ctx, ptr=res)
2169 def union(arg0, arg1):
2170 try:
2171 if not arg0.__class__ is union_map:
2172 arg0 = union_map(arg0)
2173 except:
2174 raise
2175 try:
2176 if not arg1.__class__ is union_map:
2177 arg1 = union_map(arg1)
2178 except:
2179 raise
2180 ctx = arg0.ctx
2181 res = isl.isl_union_map_union(isl.isl_union_map_copy(arg0.ptr), isl.isl_union_map_copy(arg1.ptr))
2182 return union_map(ctx=ctx, ptr=res)
2183 def wrap(arg0):
2184 try:
2185 if not arg0.__class__ is union_map:
2186 arg0 = union_map(arg0)
2187 except:
2188 raise
2189 ctx = arg0.ctx
2190 res = isl.isl_union_map_wrap(isl.isl_union_map_copy(arg0.ptr))
2191 return union_set(ctx=ctx, ptr=res)
2192 def zip(arg0):
2193 try:
2194 if not arg0.__class__ is union_map:
2195 arg0 = union_map(arg0)
2196 except:
2197 raise
2198 ctx = arg0.ctx
2199 res = isl.isl_union_map_zip(isl.isl_union_map_copy(arg0.ptr))
2200 return union_map(ctx=ctx, ptr=res)
2202 isl.isl_union_map_from_basic_map.restype = c_void_p
2203 isl.isl_union_map_from_basic_map.argtypes = [c_void_p]
2204 isl.isl_union_map_from_map.restype = c_void_p
2205 isl.isl_union_map_from_map.argtypes = [c_void_p]
2206 isl.isl_union_map_read_from_str.restype = c_void_p
2207 isl.isl_union_map_read_from_str.argtypes = [Context, c_char_p]
2208 isl.isl_union_map_affine_hull.restype = c_void_p
2209 isl.isl_union_map_affine_hull.argtypes = [c_void_p]
2210 isl.isl_union_map_apply_domain.restype = c_void_p
2211 isl.isl_union_map_apply_domain.argtypes = [c_void_p, c_void_p]
2212 isl.isl_union_map_apply_range.restype = c_void_p
2213 isl.isl_union_map_apply_range.argtypes = [c_void_p, c_void_p]
2214 isl.isl_union_map_coalesce.restype = c_void_p
2215 isl.isl_union_map_coalesce.argtypes = [c_void_p]
2216 isl.isl_union_map_compute_divs.restype = c_void_p
2217 isl.isl_union_map_compute_divs.argtypes = [c_void_p]
2218 isl.isl_union_map_deltas.restype = c_void_p
2219 isl.isl_union_map_deltas.argtypes = [c_void_p]
2220 isl.isl_union_map_detect_equalities.restype = c_void_p
2221 isl.isl_union_map_detect_equalities.argtypes = [c_void_p]
2222 isl.isl_union_map_domain.restype = c_void_p
2223 isl.isl_union_map_domain.argtypes = [c_void_p]
2224 isl.isl_union_map_domain_factor_domain.restype = c_void_p
2225 isl.isl_union_map_domain_factor_domain.argtypes = [c_void_p]
2226 isl.isl_union_map_domain_factor_range.restype = c_void_p
2227 isl.isl_union_map_domain_factor_range.argtypes = [c_void_p]
2228 isl.isl_union_map_domain_map.restype = c_void_p
2229 isl.isl_union_map_domain_map.argtypes = [c_void_p]
2230 isl.isl_union_map_domain_map_union_pw_multi_aff.restype = c_void_p
2231 isl.isl_union_map_domain_map_union_pw_multi_aff.argtypes = [c_void_p]
2232 isl.isl_union_map_domain_product.restype = c_void_p
2233 isl.isl_union_map_domain_product.argtypes = [c_void_p, c_void_p]
2234 isl.isl_union_map_eq_at_multi_union_pw_aff.restype = c_void_p
2235 isl.isl_union_map_eq_at_multi_union_pw_aff.argtypes = [c_void_p, c_void_p]
2236 isl.isl_union_map_factor_domain.restype = c_void_p
2237 isl.isl_union_map_factor_domain.argtypes = [c_void_p]
2238 isl.isl_union_map_factor_range.restype = c_void_p
2239 isl.isl_union_map_factor_range.argtypes = [c_void_p]
2240 isl.isl_union_map_fixed_power_val.restype = c_void_p
2241 isl.isl_union_map_fixed_power_val.argtypes = [c_void_p, c_void_p]
2242 isl.isl_union_map_foreach_map.argtypes = [c_void_p, c_void_p, c_void_p]
2243 isl.isl_union_map_from_union_pw_multi_aff.restype = c_void_p
2244 isl.isl_union_map_from_union_pw_multi_aff.argtypes = [c_void_p]
2245 isl.isl_union_map_from_multi_union_pw_aff.restype = c_void_p
2246 isl.isl_union_map_from_multi_union_pw_aff.argtypes = [c_void_p]
2247 isl.isl_union_map_from_domain.restype = c_void_p
2248 isl.isl_union_map_from_domain.argtypes = [c_void_p]
2249 isl.isl_union_map_from_domain_and_range.restype = c_void_p
2250 isl.isl_union_map_from_domain_and_range.argtypes = [c_void_p, c_void_p]
2251 isl.isl_union_map_from_range.restype = c_void_p
2252 isl.isl_union_map_from_range.argtypes = [c_void_p]
2253 isl.isl_union_map_gist.restype = c_void_p
2254 isl.isl_union_map_gist.argtypes = [c_void_p, c_void_p]
2255 isl.isl_union_map_gist_domain.restype = c_void_p
2256 isl.isl_union_map_gist_domain.argtypes = [c_void_p, c_void_p]
2257 isl.isl_union_map_gist_params.restype = c_void_p
2258 isl.isl_union_map_gist_params.argtypes = [c_void_p, c_void_p]
2259 isl.isl_union_map_gist_range.restype = c_void_p
2260 isl.isl_union_map_gist_range.argtypes = [c_void_p, c_void_p]
2261 isl.isl_union_map_intersect.restype = c_void_p
2262 isl.isl_union_map_intersect.argtypes = [c_void_p, c_void_p]
2263 isl.isl_union_map_intersect_domain.restype = c_void_p
2264 isl.isl_union_map_intersect_domain.argtypes = [c_void_p, c_void_p]
2265 isl.isl_union_map_intersect_params.restype = c_void_p
2266 isl.isl_union_map_intersect_params.argtypes = [c_void_p, c_void_p]
2267 isl.isl_union_map_intersect_range.restype = c_void_p
2268 isl.isl_union_map_intersect_range.argtypes = [c_void_p, c_void_p]
2269 isl.isl_union_map_is_bijective.restype = c_bool
2270 isl.isl_union_map_is_bijective.argtypes = [c_void_p]
2271 isl.isl_union_map_is_empty.restype = c_bool
2272 isl.isl_union_map_is_empty.argtypes = [c_void_p]
2273 isl.isl_union_map_is_equal.restype = c_bool
2274 isl.isl_union_map_is_equal.argtypes = [c_void_p, c_void_p]
2275 isl.isl_union_map_is_injective.restype = c_bool
2276 isl.isl_union_map_is_injective.argtypes = [c_void_p]
2277 isl.isl_union_map_is_single_valued.restype = c_bool
2278 isl.isl_union_map_is_single_valued.argtypes = [c_void_p]
2279 isl.isl_union_map_is_strict_subset.restype = c_bool
2280 isl.isl_union_map_is_strict_subset.argtypes = [c_void_p, c_void_p]
2281 isl.isl_union_map_is_subset.restype = c_bool
2282 isl.isl_union_map_is_subset.argtypes = [c_void_p, c_void_p]
2283 isl.isl_union_map_lexmax.restype = c_void_p
2284 isl.isl_union_map_lexmax.argtypes = [c_void_p]
2285 isl.isl_union_map_lexmin.restype = c_void_p
2286 isl.isl_union_map_lexmin.argtypes = [c_void_p]
2287 isl.isl_union_map_polyhedral_hull.restype = c_void_p
2288 isl.isl_union_map_polyhedral_hull.argtypes = [c_void_p]
2289 isl.isl_union_map_product.restype = c_void_p
2290 isl.isl_union_map_product.argtypes = [c_void_p, c_void_p]
2291 isl.isl_union_map_project_out_all_params.restype = c_void_p
2292 isl.isl_union_map_project_out_all_params.argtypes = [c_void_p]
2293 isl.isl_union_map_range.restype = c_void_p
2294 isl.isl_union_map_range.argtypes = [c_void_p]
2295 isl.isl_union_map_range_factor_domain.restype = c_void_p
2296 isl.isl_union_map_range_factor_domain.argtypes = [c_void_p]
2297 isl.isl_union_map_range_factor_range.restype = c_void_p
2298 isl.isl_union_map_range_factor_range.argtypes = [c_void_p]
2299 isl.isl_union_map_range_map.restype = c_void_p
2300 isl.isl_union_map_range_map.argtypes = [c_void_p]
2301 isl.isl_union_map_range_product.restype = c_void_p
2302 isl.isl_union_map_range_product.argtypes = [c_void_p, c_void_p]
2303 isl.isl_union_map_reverse.restype = c_void_p
2304 isl.isl_union_map_reverse.argtypes = [c_void_p]
2305 isl.isl_union_map_subtract.restype = c_void_p
2306 isl.isl_union_map_subtract.argtypes = [c_void_p, c_void_p]
2307 isl.isl_union_map_subtract_domain.restype = c_void_p
2308 isl.isl_union_map_subtract_domain.argtypes = [c_void_p, c_void_p]
2309 isl.isl_union_map_subtract_range.restype = c_void_p
2310 isl.isl_union_map_subtract_range.argtypes = [c_void_p, c_void_p]
2311 isl.isl_union_map_union.restype = c_void_p
2312 isl.isl_union_map_union.argtypes = [c_void_p, c_void_p]
2313 isl.isl_union_map_wrap.restype = c_void_p
2314 isl.isl_union_map_wrap.argtypes = [c_void_p]
2315 isl.isl_union_map_zip.restype = c_void_p
2316 isl.isl_union_map_zip.argtypes = [c_void_p]
2317 isl.isl_union_map_copy.restype = c_void_p
2318 isl.isl_union_map_copy.argtypes = [c_void_p]
2319 isl.isl_union_map_free.restype = c_void_p
2320 isl.isl_union_map_free.argtypes = [c_void_p]
2321 isl.isl_union_map_to_str.restype = POINTER(c_char)
2322 isl.isl_union_map_to_str.argtypes = [c_void_p]
2324 class map(union_map):
2325 def __init__(self, *args, **keywords):
2326 if "ptr" in keywords:
2327 self.ctx = keywords["ctx"]
2328 self.ptr = keywords["ptr"]
2329 return
2330 if len(args) == 1 and type(args[0]) == str:
2331 self.ctx = Context.getDefaultInstance()
2332 self.ptr = isl.isl_map_read_from_str(self.ctx, args[0].encode('ascii'))
2333 return
2334 if len(args) == 1 and args[0].__class__ is basic_map:
2335 self.ctx = Context.getDefaultInstance()
2336 self.ptr = isl.isl_map_from_basic_map(isl.isl_basic_map_copy(args[0].ptr))
2337 return
2338 raise Error
2339 def __del__(self):
2340 if hasattr(self, 'ptr'):
2341 isl.isl_map_free(self.ptr)
2342 def __str__(arg0):
2343 try:
2344 if not arg0.__class__ is map:
2345 arg0 = map(arg0)
2346 except:
2347 raise
2348 ptr = isl.isl_map_to_str(arg0.ptr)
2349 res = cast(ptr, c_char_p).value.decode('ascii')
2350 libc.free(ptr)
2351 return res
2352 def __repr__(self):
2353 s = str(self)
2354 if '"' in s:
2355 return 'isl.map("""%s""")' % s
2356 else:
2357 return 'isl.map("%s")' % s
2358 def affine_hull(arg0):
2359 try:
2360 if not arg0.__class__ is map:
2361 arg0 = map(arg0)
2362 except:
2363 raise
2364 ctx = arg0.ctx
2365 res = isl.isl_map_affine_hull(isl.isl_map_copy(arg0.ptr))
2366 return basic_map(ctx=ctx, ptr=res)
2367 def apply_domain(arg0, arg1):
2368 try:
2369 if not arg0.__class__ is map:
2370 arg0 = map(arg0)
2371 except:
2372 raise
2373 try:
2374 if not arg1.__class__ is map:
2375 arg1 = map(arg1)
2376 except:
2377 return union_map(arg0).apply_domain(arg1)
2378 ctx = arg0.ctx
2379 res = isl.isl_map_apply_domain(isl.isl_map_copy(arg0.ptr), isl.isl_map_copy(arg1.ptr))
2380 return map(ctx=ctx, ptr=res)
2381 def apply_range(arg0, arg1):
2382 try:
2383 if not arg0.__class__ is map:
2384 arg0 = map(arg0)
2385 except:
2386 raise
2387 try:
2388 if not arg1.__class__ is map:
2389 arg1 = map(arg1)
2390 except:
2391 return union_map(arg0).apply_range(arg1)
2392 ctx = arg0.ctx
2393 res = isl.isl_map_apply_range(isl.isl_map_copy(arg0.ptr), isl.isl_map_copy(arg1.ptr))
2394 return map(ctx=ctx, ptr=res)
2395 def coalesce(arg0):
2396 try:
2397 if not arg0.__class__ is map:
2398 arg0 = map(arg0)
2399 except:
2400 raise
2401 ctx = arg0.ctx
2402 res = isl.isl_map_coalesce(isl.isl_map_copy(arg0.ptr))
2403 return map(ctx=ctx, ptr=res)
2404 def complement(arg0):
2405 try:
2406 if not arg0.__class__ is map:
2407 arg0 = map(arg0)
2408 except:
2409 raise
2410 ctx = arg0.ctx
2411 res = isl.isl_map_complement(isl.isl_map_copy(arg0.ptr))
2412 return map(ctx=ctx, ptr=res)
2413 def deltas(arg0):
2414 try:
2415 if not arg0.__class__ is map:
2416 arg0 = map(arg0)
2417 except:
2418 raise
2419 ctx = arg0.ctx
2420 res = isl.isl_map_deltas(isl.isl_map_copy(arg0.ptr))
2421 return set(ctx=ctx, ptr=res)
2422 def detect_equalities(arg0):
2423 try:
2424 if not arg0.__class__ is map:
2425 arg0 = map(arg0)
2426 except:
2427 raise
2428 ctx = arg0.ctx
2429 res = isl.isl_map_detect_equalities(isl.isl_map_copy(arg0.ptr))
2430 return map(ctx=ctx, ptr=res)
2431 def flatten(arg0):
2432 try:
2433 if not arg0.__class__ is map:
2434 arg0 = map(arg0)
2435 except:
2436 raise
2437 ctx = arg0.ctx
2438 res = isl.isl_map_flatten(isl.isl_map_copy(arg0.ptr))
2439 return map(ctx=ctx, ptr=res)
2440 def flatten_domain(arg0):
2441 try:
2442 if not arg0.__class__ is map:
2443 arg0 = map(arg0)
2444 except:
2445 raise
2446 ctx = arg0.ctx
2447 res = isl.isl_map_flatten_domain(isl.isl_map_copy(arg0.ptr))
2448 return map(ctx=ctx, ptr=res)
2449 def flatten_range(arg0):
2450 try:
2451 if not arg0.__class__ is map:
2452 arg0 = map(arg0)
2453 except:
2454 raise
2455 ctx = arg0.ctx
2456 res = isl.isl_map_flatten_range(isl.isl_map_copy(arg0.ptr))
2457 return map(ctx=ctx, ptr=res)
2458 def foreach_basic_map(arg0, arg1):
2459 try:
2460 if not arg0.__class__ is map:
2461 arg0 = map(arg0)
2462 except:
2463 raise
2464 exc_info = [None]
2465 fn = CFUNCTYPE(c_int, c_void_p, c_void_p)
2466 def cb_func(cb_arg0, cb_arg1):
2467 cb_arg0 = basic_map(ctx=arg0.ctx, ptr=cb_arg0)
2468 try:
2469 arg1(cb_arg0)
2470 except:
2471 import sys
2472 exc_info[0] = sys.exc_info()
2473 return -1
2474 return 0
2475 cb = fn(cb_func)
2476 ctx = arg0.ctx
2477 res = isl.isl_map_foreach_basic_map(arg0.ptr, cb, None)
2478 if exc_info[0] != None:
2479 raise (exc_info[0][0], exc_info[0][1], exc_info[0][2])
2480 return res
2481 def gist(arg0, arg1):
2482 try:
2483 if not arg0.__class__ is map:
2484 arg0 = map(arg0)
2485 except:
2486 raise
2487 try:
2488 if not arg1.__class__ is map:
2489 arg1 = map(arg1)
2490 except:
2491 return union_map(arg0).gist(arg1)
2492 ctx = arg0.ctx
2493 res = isl.isl_map_gist(isl.isl_map_copy(arg0.ptr), isl.isl_map_copy(arg1.ptr))
2494 return map(ctx=ctx, ptr=res)
2495 def gist_domain(arg0, arg1):
2496 try:
2497 if not arg0.__class__ is map:
2498 arg0 = map(arg0)
2499 except:
2500 raise
2501 try:
2502 if not arg1.__class__ is set:
2503 arg1 = set(arg1)
2504 except:
2505 return union_map(arg0).gist_domain(arg1)
2506 ctx = arg0.ctx
2507 res = isl.isl_map_gist_domain(isl.isl_map_copy(arg0.ptr), isl.isl_set_copy(arg1.ptr))
2508 return map(ctx=ctx, ptr=res)
2509 def intersect(arg0, arg1):
2510 try:
2511 if not arg0.__class__ is map:
2512 arg0 = map(arg0)
2513 except:
2514 raise
2515 try:
2516 if not arg1.__class__ is map:
2517 arg1 = map(arg1)
2518 except:
2519 return union_map(arg0).intersect(arg1)
2520 ctx = arg0.ctx
2521 res = isl.isl_map_intersect(isl.isl_map_copy(arg0.ptr), isl.isl_map_copy(arg1.ptr))
2522 return map(ctx=ctx, ptr=res)
2523 def intersect_domain(arg0, arg1):
2524 try:
2525 if not arg0.__class__ is map:
2526 arg0 = map(arg0)
2527 except:
2528 raise
2529 try:
2530 if not arg1.__class__ is set:
2531 arg1 = set(arg1)
2532 except:
2533 return union_map(arg0).intersect_domain(arg1)
2534 ctx = arg0.ctx
2535 res = isl.isl_map_intersect_domain(isl.isl_map_copy(arg0.ptr), isl.isl_set_copy(arg1.ptr))
2536 return map(ctx=ctx, ptr=res)
2537 def intersect_params(arg0, arg1):
2538 try:
2539 if not arg0.__class__ is map:
2540 arg0 = map(arg0)
2541 except:
2542 raise
2543 try:
2544 if not arg1.__class__ is set:
2545 arg1 = set(arg1)
2546 except:
2547 return union_map(arg0).intersect_params(arg1)
2548 ctx = arg0.ctx
2549 res = isl.isl_map_intersect_params(isl.isl_map_copy(arg0.ptr), isl.isl_set_copy(arg1.ptr))
2550 return map(ctx=ctx, ptr=res)
2551 def intersect_range(arg0, arg1):
2552 try:
2553 if not arg0.__class__ is map:
2554 arg0 = map(arg0)
2555 except:
2556 raise
2557 try:
2558 if not arg1.__class__ is set:
2559 arg1 = set(arg1)
2560 except:
2561 return union_map(arg0).intersect_range(arg1)
2562 ctx = arg0.ctx
2563 res = isl.isl_map_intersect_range(isl.isl_map_copy(arg0.ptr), isl.isl_set_copy(arg1.ptr))
2564 return map(ctx=ctx, ptr=res)
2565 def is_bijective(arg0):
2566 try:
2567 if not arg0.__class__ is map:
2568 arg0 = map(arg0)
2569 except:
2570 raise
2571 ctx = arg0.ctx
2572 res = isl.isl_map_is_bijective(arg0.ptr)
2573 if res < 0:
2574 raise
2575 return bool(res)
2576 def is_disjoint(arg0, arg1):
2577 try:
2578 if not arg0.__class__ is map:
2579 arg0 = map(arg0)
2580 except:
2581 raise
2582 try:
2583 if not arg1.__class__ is map:
2584 arg1 = map(arg1)
2585 except:
2586 return union_map(arg0).is_disjoint(arg1)
2587 ctx = arg0.ctx
2588 res = isl.isl_map_is_disjoint(arg0.ptr, arg1.ptr)
2589 if res < 0:
2590 raise
2591 return bool(res)
2592 def is_empty(arg0):
2593 try:
2594 if not arg0.__class__ is map:
2595 arg0 = map(arg0)
2596 except:
2597 raise
2598 ctx = arg0.ctx
2599 res = isl.isl_map_is_empty(arg0.ptr)
2600 if res < 0:
2601 raise
2602 return bool(res)
2603 def is_equal(arg0, arg1):
2604 try:
2605 if not arg0.__class__ is map:
2606 arg0 = map(arg0)
2607 except:
2608 raise
2609 try:
2610 if not arg1.__class__ is map:
2611 arg1 = map(arg1)
2612 except:
2613 return union_map(arg0).is_equal(arg1)
2614 ctx = arg0.ctx
2615 res = isl.isl_map_is_equal(arg0.ptr, arg1.ptr)
2616 if res < 0:
2617 raise
2618 return bool(res)
2619 def is_injective(arg0):
2620 try:
2621 if not arg0.__class__ is map:
2622 arg0 = map(arg0)
2623 except:
2624 raise
2625 ctx = arg0.ctx
2626 res = isl.isl_map_is_injective(arg0.ptr)
2627 if res < 0:
2628 raise
2629 return bool(res)
2630 def is_single_valued(arg0):
2631 try:
2632 if not arg0.__class__ is map:
2633 arg0 = map(arg0)
2634 except:
2635 raise
2636 ctx = arg0.ctx
2637 res = isl.isl_map_is_single_valued(arg0.ptr)
2638 if res < 0:
2639 raise
2640 return bool(res)
2641 def is_strict_subset(arg0, arg1):
2642 try:
2643 if not arg0.__class__ is map:
2644 arg0 = map(arg0)
2645 except:
2646 raise
2647 try:
2648 if not arg1.__class__ is map:
2649 arg1 = map(arg1)
2650 except:
2651 return union_map(arg0).is_strict_subset(arg1)
2652 ctx = arg0.ctx
2653 res = isl.isl_map_is_strict_subset(arg0.ptr, arg1.ptr)
2654 if res < 0:
2655 raise
2656 return bool(res)
2657 def is_subset(arg0, arg1):
2658 try:
2659 if not arg0.__class__ is map:
2660 arg0 = map(arg0)
2661 except:
2662 raise
2663 try:
2664 if not arg1.__class__ is map:
2665 arg1 = map(arg1)
2666 except:
2667 return union_map(arg0).is_subset(arg1)
2668 ctx = arg0.ctx
2669 res = isl.isl_map_is_subset(arg0.ptr, arg1.ptr)
2670 if res < 0:
2671 raise
2672 return bool(res)
2673 def lexmax(arg0):
2674 try:
2675 if not arg0.__class__ is map:
2676 arg0 = map(arg0)
2677 except:
2678 raise
2679 ctx = arg0.ctx
2680 res = isl.isl_map_lexmax(isl.isl_map_copy(arg0.ptr))
2681 return map(ctx=ctx, ptr=res)
2682 def lexmin(arg0):
2683 try:
2684 if not arg0.__class__ is map:
2685 arg0 = map(arg0)
2686 except:
2687 raise
2688 ctx = arg0.ctx
2689 res = isl.isl_map_lexmin(isl.isl_map_copy(arg0.ptr))
2690 return map(ctx=ctx, ptr=res)
2691 def polyhedral_hull(arg0):
2692 try:
2693 if not arg0.__class__ is map:
2694 arg0 = map(arg0)
2695 except:
2696 raise
2697 ctx = arg0.ctx
2698 res = isl.isl_map_polyhedral_hull(isl.isl_map_copy(arg0.ptr))
2699 return basic_map(ctx=ctx, ptr=res)
2700 def reverse(arg0):
2701 try:
2702 if not arg0.__class__ is map:
2703 arg0 = map(arg0)
2704 except:
2705 raise
2706 ctx = arg0.ctx
2707 res = isl.isl_map_reverse(isl.isl_map_copy(arg0.ptr))
2708 return map(ctx=ctx, ptr=res)
2709 def sample(arg0):
2710 try:
2711 if not arg0.__class__ is map:
2712 arg0 = map(arg0)
2713 except:
2714 raise
2715 ctx = arg0.ctx
2716 res = isl.isl_map_sample(isl.isl_map_copy(arg0.ptr))
2717 return basic_map(ctx=ctx, ptr=res)
2718 def subtract(arg0, arg1):
2719 try:
2720 if not arg0.__class__ is map:
2721 arg0 = map(arg0)
2722 except:
2723 raise
2724 try:
2725 if not arg1.__class__ is map:
2726 arg1 = map(arg1)
2727 except:
2728 return union_map(arg0).subtract(arg1)
2729 ctx = arg0.ctx
2730 res = isl.isl_map_subtract(isl.isl_map_copy(arg0.ptr), isl.isl_map_copy(arg1.ptr))
2731 return map(ctx=ctx, ptr=res)
2732 def union(arg0, arg1):
2733 try:
2734 if not arg0.__class__ is map:
2735 arg0 = map(arg0)
2736 except:
2737 raise
2738 try:
2739 if not arg1.__class__ is map:
2740 arg1 = map(arg1)
2741 except:
2742 return union_map(arg0).union(arg1)
2743 ctx = arg0.ctx
2744 res = isl.isl_map_union(isl.isl_map_copy(arg0.ptr), isl.isl_map_copy(arg1.ptr))
2745 return map(ctx=ctx, ptr=res)
2746 def unshifted_simple_hull(arg0):
2747 try:
2748 if not arg0.__class__ is map:
2749 arg0 = map(arg0)
2750 except:
2751 raise
2752 ctx = arg0.ctx
2753 res = isl.isl_map_unshifted_simple_hull(isl.isl_map_copy(arg0.ptr))
2754 return basic_map(ctx=ctx, ptr=res)
2756 isl.isl_map_read_from_str.restype = c_void_p
2757 isl.isl_map_read_from_str.argtypes = [Context, c_char_p]
2758 isl.isl_map_from_basic_map.restype = c_void_p
2759 isl.isl_map_from_basic_map.argtypes = [c_void_p]
2760 isl.isl_map_affine_hull.restype = c_void_p
2761 isl.isl_map_affine_hull.argtypes = [c_void_p]
2762 isl.isl_map_apply_domain.restype = c_void_p
2763 isl.isl_map_apply_domain.argtypes = [c_void_p, c_void_p]
2764 isl.isl_map_apply_range.restype = c_void_p
2765 isl.isl_map_apply_range.argtypes = [c_void_p, c_void_p]
2766 isl.isl_map_coalesce.restype = c_void_p
2767 isl.isl_map_coalesce.argtypes = [c_void_p]
2768 isl.isl_map_complement.restype = c_void_p
2769 isl.isl_map_complement.argtypes = [c_void_p]
2770 isl.isl_map_deltas.restype = c_void_p
2771 isl.isl_map_deltas.argtypes = [c_void_p]
2772 isl.isl_map_detect_equalities.restype = c_void_p
2773 isl.isl_map_detect_equalities.argtypes = [c_void_p]
2774 isl.isl_map_flatten.restype = c_void_p
2775 isl.isl_map_flatten.argtypes = [c_void_p]
2776 isl.isl_map_flatten_domain.restype = c_void_p
2777 isl.isl_map_flatten_domain.argtypes = [c_void_p]
2778 isl.isl_map_flatten_range.restype = c_void_p
2779 isl.isl_map_flatten_range.argtypes = [c_void_p]
2780 isl.isl_map_foreach_basic_map.argtypes = [c_void_p, c_void_p, c_void_p]
2781 isl.isl_map_gist.restype = c_void_p
2782 isl.isl_map_gist.argtypes = [c_void_p, c_void_p]
2783 isl.isl_map_gist_domain.restype = c_void_p
2784 isl.isl_map_gist_domain.argtypes = [c_void_p, c_void_p]
2785 isl.isl_map_intersect.restype = c_void_p
2786 isl.isl_map_intersect.argtypes = [c_void_p, c_void_p]
2787 isl.isl_map_intersect_domain.restype = c_void_p
2788 isl.isl_map_intersect_domain.argtypes = [c_void_p, c_void_p]
2789 isl.isl_map_intersect_params.restype = c_void_p
2790 isl.isl_map_intersect_params.argtypes = [c_void_p, c_void_p]
2791 isl.isl_map_intersect_range.restype = c_void_p
2792 isl.isl_map_intersect_range.argtypes = [c_void_p, c_void_p]
2793 isl.isl_map_is_bijective.restype = c_bool
2794 isl.isl_map_is_bijective.argtypes = [c_void_p]
2795 isl.isl_map_is_disjoint.restype = c_bool
2796 isl.isl_map_is_disjoint.argtypes = [c_void_p, c_void_p]
2797 isl.isl_map_is_empty.restype = c_bool
2798 isl.isl_map_is_empty.argtypes = [c_void_p]
2799 isl.isl_map_is_equal.restype = c_bool
2800 isl.isl_map_is_equal.argtypes = [c_void_p, c_void_p]
2801 isl.isl_map_is_injective.restype = c_bool
2802 isl.isl_map_is_injective.argtypes = [c_void_p]
2803 isl.isl_map_is_single_valued.restype = c_bool
2804 isl.isl_map_is_single_valued.argtypes = [c_void_p]
2805 isl.isl_map_is_strict_subset.restype = c_bool
2806 isl.isl_map_is_strict_subset.argtypes = [c_void_p, c_void_p]
2807 isl.isl_map_is_subset.restype = c_bool
2808 isl.isl_map_is_subset.argtypes = [c_void_p, c_void_p]
2809 isl.isl_map_lexmax.restype = c_void_p
2810 isl.isl_map_lexmax.argtypes = [c_void_p]
2811 isl.isl_map_lexmin.restype = c_void_p
2812 isl.isl_map_lexmin.argtypes = [c_void_p]
2813 isl.isl_map_polyhedral_hull.restype = c_void_p
2814 isl.isl_map_polyhedral_hull.argtypes = [c_void_p]
2815 isl.isl_map_reverse.restype = c_void_p
2816 isl.isl_map_reverse.argtypes = [c_void_p]
2817 isl.isl_map_sample.restype = c_void_p
2818 isl.isl_map_sample.argtypes = [c_void_p]
2819 isl.isl_map_subtract.restype = c_void_p
2820 isl.isl_map_subtract.argtypes = [c_void_p, c_void_p]
2821 isl.isl_map_union.restype = c_void_p
2822 isl.isl_map_union.argtypes = [c_void_p, c_void_p]
2823 isl.isl_map_unshifted_simple_hull.restype = c_void_p
2824 isl.isl_map_unshifted_simple_hull.argtypes = [c_void_p]
2825 isl.isl_map_copy.restype = c_void_p
2826 isl.isl_map_copy.argtypes = [c_void_p]
2827 isl.isl_map_free.restype = c_void_p
2828 isl.isl_map_free.argtypes = [c_void_p]
2829 isl.isl_map_to_str.restype = POINTER(c_char)
2830 isl.isl_map_to_str.argtypes = [c_void_p]
2832 class basic_map(map):
2833 def __init__(self, *args, **keywords):
2834 if "ptr" in keywords:
2835 self.ctx = keywords["ctx"]
2836 self.ptr = keywords["ptr"]
2837 return
2838 if len(args) == 1 and type(args[0]) == str:
2839 self.ctx = Context.getDefaultInstance()
2840 self.ptr = isl.isl_basic_map_read_from_str(self.ctx, args[0].encode('ascii'))
2841 return
2842 raise Error
2843 def __del__(self):
2844 if hasattr(self, 'ptr'):
2845 isl.isl_basic_map_free(self.ptr)
2846 def __str__(arg0):
2847 try:
2848 if not arg0.__class__ is basic_map:
2849 arg0 = basic_map(arg0)
2850 except:
2851 raise
2852 ptr = isl.isl_basic_map_to_str(arg0.ptr)
2853 res = cast(ptr, c_char_p).value.decode('ascii')
2854 libc.free(ptr)
2855 return res
2856 def __repr__(self):
2857 s = str(self)
2858 if '"' in s:
2859 return 'isl.basic_map("""%s""")' % s
2860 else:
2861 return 'isl.basic_map("%s")' % s
2862 def affine_hull(arg0):
2863 try:
2864 if not arg0.__class__ is basic_map:
2865 arg0 = basic_map(arg0)
2866 except:
2867 raise
2868 ctx = arg0.ctx
2869 res = isl.isl_basic_map_affine_hull(isl.isl_basic_map_copy(arg0.ptr))
2870 return basic_map(ctx=ctx, ptr=res)
2871 def apply_domain(arg0, arg1):
2872 try:
2873 if not arg0.__class__ is basic_map:
2874 arg0 = basic_map(arg0)
2875 except:
2876 raise
2877 try:
2878 if not arg1.__class__ is basic_map:
2879 arg1 = basic_map(arg1)
2880 except:
2881 return map(arg0).apply_domain(arg1)
2882 ctx = arg0.ctx
2883 res = isl.isl_basic_map_apply_domain(isl.isl_basic_map_copy(arg0.ptr), isl.isl_basic_map_copy(arg1.ptr))
2884 return basic_map(ctx=ctx, ptr=res)
2885 def apply_range(arg0, arg1):
2886 try:
2887 if not arg0.__class__ is basic_map:
2888 arg0 = basic_map(arg0)
2889 except:
2890 raise
2891 try:
2892 if not arg1.__class__ is basic_map:
2893 arg1 = basic_map(arg1)
2894 except:
2895 return map(arg0).apply_range(arg1)
2896 ctx = arg0.ctx
2897 res = isl.isl_basic_map_apply_range(isl.isl_basic_map_copy(arg0.ptr), isl.isl_basic_map_copy(arg1.ptr))
2898 return basic_map(ctx=ctx, ptr=res)
2899 def deltas(arg0):
2900 try:
2901 if not arg0.__class__ is basic_map:
2902 arg0 = basic_map(arg0)
2903 except:
2904 raise
2905 ctx = arg0.ctx
2906 res = isl.isl_basic_map_deltas(isl.isl_basic_map_copy(arg0.ptr))
2907 return basic_set(ctx=ctx, ptr=res)
2908 def detect_equalities(arg0):
2909 try:
2910 if not arg0.__class__ is basic_map:
2911 arg0 = basic_map(arg0)
2912 except:
2913 raise
2914 ctx = arg0.ctx
2915 res = isl.isl_basic_map_detect_equalities(isl.isl_basic_map_copy(arg0.ptr))
2916 return basic_map(ctx=ctx, ptr=res)
2917 def flatten(arg0):
2918 try:
2919 if not arg0.__class__ is basic_map:
2920 arg0 = basic_map(arg0)
2921 except:
2922 raise
2923 ctx = arg0.ctx
2924 res = isl.isl_basic_map_flatten(isl.isl_basic_map_copy(arg0.ptr))
2925 return basic_map(ctx=ctx, ptr=res)
2926 def flatten_domain(arg0):
2927 try:
2928 if not arg0.__class__ is basic_map:
2929 arg0 = basic_map(arg0)
2930 except:
2931 raise
2932 ctx = arg0.ctx
2933 res = isl.isl_basic_map_flatten_domain(isl.isl_basic_map_copy(arg0.ptr))
2934 return basic_map(ctx=ctx, ptr=res)
2935 def flatten_range(arg0):
2936 try:
2937 if not arg0.__class__ is basic_map:
2938 arg0 = basic_map(arg0)
2939 except:
2940 raise
2941 ctx = arg0.ctx
2942 res = isl.isl_basic_map_flatten_range(isl.isl_basic_map_copy(arg0.ptr))
2943 return basic_map(ctx=ctx, ptr=res)
2944 def gist(arg0, arg1):
2945 try:
2946 if not arg0.__class__ is basic_map:
2947 arg0 = basic_map(arg0)
2948 except:
2949 raise
2950 try:
2951 if not arg1.__class__ is basic_map:
2952 arg1 = basic_map(arg1)
2953 except:
2954 return map(arg0).gist(arg1)
2955 ctx = arg0.ctx
2956 res = isl.isl_basic_map_gist(isl.isl_basic_map_copy(arg0.ptr), isl.isl_basic_map_copy(arg1.ptr))
2957 return basic_map(ctx=ctx, ptr=res)
2958 def intersect(arg0, arg1):
2959 try:
2960 if not arg0.__class__ is basic_map:
2961 arg0 = basic_map(arg0)
2962 except:
2963 raise
2964 try:
2965 if not arg1.__class__ is basic_map:
2966 arg1 = basic_map(arg1)
2967 except:
2968 return map(arg0).intersect(arg1)
2969 ctx = arg0.ctx
2970 res = isl.isl_basic_map_intersect(isl.isl_basic_map_copy(arg0.ptr), isl.isl_basic_map_copy(arg1.ptr))
2971 return basic_map(ctx=ctx, ptr=res)
2972 def intersect_domain(arg0, arg1):
2973 try:
2974 if not arg0.__class__ is basic_map:
2975 arg0 = basic_map(arg0)
2976 except:
2977 raise
2978 try:
2979 if not arg1.__class__ is basic_set:
2980 arg1 = basic_set(arg1)
2981 except:
2982 return map(arg0).intersect_domain(arg1)
2983 ctx = arg0.ctx
2984 res = isl.isl_basic_map_intersect_domain(isl.isl_basic_map_copy(arg0.ptr), isl.isl_basic_set_copy(arg1.ptr))
2985 return basic_map(ctx=ctx, ptr=res)
2986 def intersect_range(arg0, arg1):
2987 try:
2988 if not arg0.__class__ is basic_map:
2989 arg0 = basic_map(arg0)
2990 except:
2991 raise
2992 try:
2993 if not arg1.__class__ is basic_set:
2994 arg1 = basic_set(arg1)
2995 except:
2996 return map(arg0).intersect_range(arg1)
2997 ctx = arg0.ctx
2998 res = isl.isl_basic_map_intersect_range(isl.isl_basic_map_copy(arg0.ptr), isl.isl_basic_set_copy(arg1.ptr))
2999 return basic_map(ctx=ctx, ptr=res)
3000 def is_empty(arg0):
3001 try:
3002 if not arg0.__class__ is basic_map:
3003 arg0 = basic_map(arg0)
3004 except:
3005 raise
3006 ctx = arg0.ctx
3007 res = isl.isl_basic_map_is_empty(arg0.ptr)
3008 if res < 0:
3009 raise
3010 return bool(res)
3011 def is_equal(arg0, arg1):
3012 try:
3013 if not arg0.__class__ is basic_map:
3014 arg0 = basic_map(arg0)
3015 except:
3016 raise
3017 try:
3018 if not arg1.__class__ is basic_map:
3019 arg1 = basic_map(arg1)
3020 except:
3021 return map(arg0).is_equal(arg1)
3022 ctx = arg0.ctx
3023 res = isl.isl_basic_map_is_equal(arg0.ptr, arg1.ptr)
3024 if res < 0:
3025 raise
3026 return bool(res)
3027 def is_subset(arg0, arg1):
3028 try:
3029 if not arg0.__class__ is basic_map:
3030 arg0 = basic_map(arg0)
3031 except:
3032 raise
3033 try:
3034 if not arg1.__class__ is basic_map:
3035 arg1 = basic_map(arg1)
3036 except:
3037 return map(arg0).is_subset(arg1)
3038 ctx = arg0.ctx
3039 res = isl.isl_basic_map_is_subset(arg0.ptr, arg1.ptr)
3040 if res < 0:
3041 raise
3042 return bool(res)
3043 def lexmax(arg0):
3044 try:
3045 if not arg0.__class__ is basic_map:
3046 arg0 = basic_map(arg0)
3047 except:
3048 raise
3049 ctx = arg0.ctx
3050 res = isl.isl_basic_map_lexmax(isl.isl_basic_map_copy(arg0.ptr))
3051 return map(ctx=ctx, ptr=res)
3052 def lexmin(arg0):
3053 try:
3054 if not arg0.__class__ is basic_map:
3055 arg0 = basic_map(arg0)
3056 except:
3057 raise
3058 ctx = arg0.ctx
3059 res = isl.isl_basic_map_lexmin(isl.isl_basic_map_copy(arg0.ptr))
3060 return map(ctx=ctx, ptr=res)
3061 def reverse(arg0):
3062 try:
3063 if not arg0.__class__ is basic_map:
3064 arg0 = basic_map(arg0)
3065 except:
3066 raise
3067 ctx = arg0.ctx
3068 res = isl.isl_basic_map_reverse(isl.isl_basic_map_copy(arg0.ptr))
3069 return basic_map(ctx=ctx, ptr=res)
3070 def sample(arg0):
3071 try:
3072 if not arg0.__class__ is basic_map:
3073 arg0 = basic_map(arg0)
3074 except:
3075 raise
3076 ctx = arg0.ctx
3077 res = isl.isl_basic_map_sample(isl.isl_basic_map_copy(arg0.ptr))
3078 return basic_map(ctx=ctx, ptr=res)
3079 def union(arg0, arg1):
3080 try:
3081 if not arg0.__class__ is basic_map:
3082 arg0 = basic_map(arg0)
3083 except:
3084 raise
3085 try:
3086 if not arg1.__class__ is basic_map:
3087 arg1 = basic_map(arg1)
3088 except:
3089 return map(arg0).union(arg1)
3090 ctx = arg0.ctx
3091 res = isl.isl_basic_map_union(isl.isl_basic_map_copy(arg0.ptr), isl.isl_basic_map_copy(arg1.ptr))
3092 return map(ctx=ctx, ptr=res)
3094 isl.isl_basic_map_read_from_str.restype = c_void_p
3095 isl.isl_basic_map_read_from_str.argtypes = [Context, c_char_p]
3096 isl.isl_basic_map_affine_hull.restype = c_void_p
3097 isl.isl_basic_map_affine_hull.argtypes = [c_void_p]
3098 isl.isl_basic_map_apply_domain.restype = c_void_p
3099 isl.isl_basic_map_apply_domain.argtypes = [c_void_p, c_void_p]
3100 isl.isl_basic_map_apply_range.restype = c_void_p
3101 isl.isl_basic_map_apply_range.argtypes = [c_void_p, c_void_p]
3102 isl.isl_basic_map_deltas.restype = c_void_p
3103 isl.isl_basic_map_deltas.argtypes = [c_void_p]
3104 isl.isl_basic_map_detect_equalities.restype = c_void_p
3105 isl.isl_basic_map_detect_equalities.argtypes = [c_void_p]
3106 isl.isl_basic_map_flatten.restype = c_void_p
3107 isl.isl_basic_map_flatten.argtypes = [c_void_p]
3108 isl.isl_basic_map_flatten_domain.restype = c_void_p
3109 isl.isl_basic_map_flatten_domain.argtypes = [c_void_p]
3110 isl.isl_basic_map_flatten_range.restype = c_void_p
3111 isl.isl_basic_map_flatten_range.argtypes = [c_void_p]
3112 isl.isl_basic_map_gist.restype = c_void_p
3113 isl.isl_basic_map_gist.argtypes = [c_void_p, c_void_p]
3114 isl.isl_basic_map_intersect.restype = c_void_p
3115 isl.isl_basic_map_intersect.argtypes = [c_void_p, c_void_p]
3116 isl.isl_basic_map_intersect_domain.restype = c_void_p
3117 isl.isl_basic_map_intersect_domain.argtypes = [c_void_p, c_void_p]
3118 isl.isl_basic_map_intersect_range.restype = c_void_p
3119 isl.isl_basic_map_intersect_range.argtypes = [c_void_p, c_void_p]
3120 isl.isl_basic_map_is_empty.restype = c_bool
3121 isl.isl_basic_map_is_empty.argtypes = [c_void_p]
3122 isl.isl_basic_map_is_equal.restype = c_bool
3123 isl.isl_basic_map_is_equal.argtypes = [c_void_p, c_void_p]
3124 isl.isl_basic_map_is_subset.restype = c_bool
3125 isl.isl_basic_map_is_subset.argtypes = [c_void_p, c_void_p]
3126 isl.isl_basic_map_lexmax.restype = c_void_p
3127 isl.isl_basic_map_lexmax.argtypes = [c_void_p]
3128 isl.isl_basic_map_lexmin.restype = c_void_p
3129 isl.isl_basic_map_lexmin.argtypes = [c_void_p]
3130 isl.isl_basic_map_reverse.restype = c_void_p
3131 isl.isl_basic_map_reverse.argtypes = [c_void_p]
3132 isl.isl_basic_map_sample.restype = c_void_p
3133 isl.isl_basic_map_sample.argtypes = [c_void_p]
3134 isl.isl_basic_map_union.restype = c_void_p
3135 isl.isl_basic_map_union.argtypes = [c_void_p, c_void_p]
3136 isl.isl_basic_map_copy.restype = c_void_p
3137 isl.isl_basic_map_copy.argtypes = [c_void_p]
3138 isl.isl_basic_map_free.restype = c_void_p
3139 isl.isl_basic_map_free.argtypes = [c_void_p]
3140 isl.isl_basic_map_to_str.restype = POINTER(c_char)
3141 isl.isl_basic_map_to_str.argtypes = [c_void_p]
3143 class union_set(object):
3144 def __init__(self, *args, **keywords):
3145 if "ptr" in keywords:
3146 self.ctx = keywords["ctx"]
3147 self.ptr = keywords["ptr"]
3148 return
3149 if len(args) == 1 and args[0].__class__ is basic_set:
3150 self.ctx = Context.getDefaultInstance()
3151 self.ptr = isl.isl_union_set_from_basic_set(isl.isl_basic_set_copy(args[0].ptr))
3152 return
3153 if len(args) == 1 and args[0].__class__ is set:
3154 self.ctx = Context.getDefaultInstance()
3155 self.ptr = isl.isl_union_set_from_set(isl.isl_set_copy(args[0].ptr))
3156 return
3157 if len(args) == 1 and args[0].__class__ is point:
3158 self.ctx = Context.getDefaultInstance()
3159 self.ptr = isl.isl_union_set_from_point(isl.isl_point_copy(args[0].ptr))
3160 return
3161 if len(args) == 1 and type(args[0]) == str:
3162 self.ctx = Context.getDefaultInstance()
3163 self.ptr = isl.isl_union_set_read_from_str(self.ctx, args[0].encode('ascii'))
3164 return
3165 raise Error
3166 def __del__(self):
3167 if hasattr(self, 'ptr'):
3168 isl.isl_union_set_free(self.ptr)
3169 def __str__(arg0):
3170 try:
3171 if not arg0.__class__ is union_set:
3172 arg0 = union_set(arg0)
3173 except:
3174 raise
3175 ptr = isl.isl_union_set_to_str(arg0.ptr)
3176 res = cast(ptr, c_char_p).value.decode('ascii')
3177 libc.free(ptr)
3178 return res
3179 def __repr__(self):
3180 s = str(self)
3181 if '"' in s:
3182 return 'isl.union_set("""%s""")' % s
3183 else:
3184 return 'isl.union_set("%s")' % s
3185 def affine_hull(arg0):
3186 try:
3187 if not arg0.__class__ is union_set:
3188 arg0 = union_set(arg0)
3189 except:
3190 raise
3191 ctx = arg0.ctx
3192 res = isl.isl_union_set_affine_hull(isl.isl_union_set_copy(arg0.ptr))
3193 return union_set(ctx=ctx, ptr=res)
3194 def apply(arg0, arg1):
3195 try:
3196 if not arg0.__class__ is union_set:
3197 arg0 = union_set(arg0)
3198 except:
3199 raise
3200 try:
3201 if not arg1.__class__ is union_map:
3202 arg1 = union_map(arg1)
3203 except:
3204 raise
3205 ctx = arg0.ctx
3206 res = isl.isl_union_set_apply(isl.isl_union_set_copy(arg0.ptr), isl.isl_union_map_copy(arg1.ptr))
3207 return union_set(ctx=ctx, ptr=res)
3208 def coalesce(arg0):
3209 try:
3210 if not arg0.__class__ is union_set:
3211 arg0 = union_set(arg0)
3212 except:
3213 raise
3214 ctx = arg0.ctx
3215 res = isl.isl_union_set_coalesce(isl.isl_union_set_copy(arg0.ptr))
3216 return union_set(ctx=ctx, ptr=res)
3217 def compute_divs(arg0):
3218 try:
3219 if not arg0.__class__ is union_set:
3220 arg0 = union_set(arg0)
3221 except:
3222 raise
3223 ctx = arg0.ctx
3224 res = isl.isl_union_set_compute_divs(isl.isl_union_set_copy(arg0.ptr))
3225 return union_set(ctx=ctx, ptr=res)
3226 def detect_equalities(arg0):
3227 try:
3228 if not arg0.__class__ is union_set:
3229 arg0 = union_set(arg0)
3230 except:
3231 raise
3232 ctx = arg0.ctx
3233 res = isl.isl_union_set_detect_equalities(isl.isl_union_set_copy(arg0.ptr))
3234 return union_set(ctx=ctx, ptr=res)
3235 def foreach_point(arg0, arg1):
3236 try:
3237 if not arg0.__class__ is union_set:
3238 arg0 = union_set(arg0)
3239 except:
3240 raise
3241 exc_info = [None]
3242 fn = CFUNCTYPE(c_int, c_void_p, c_void_p)
3243 def cb_func(cb_arg0, cb_arg1):
3244 cb_arg0 = point(ctx=arg0.ctx, ptr=cb_arg0)
3245 try:
3246 arg1(cb_arg0)
3247 except:
3248 import sys
3249 exc_info[0] = sys.exc_info()
3250 return -1
3251 return 0
3252 cb = fn(cb_func)
3253 ctx = arg0.ctx
3254 res = isl.isl_union_set_foreach_point(arg0.ptr, cb, None)
3255 if exc_info[0] != None:
3256 raise (exc_info[0][0], exc_info[0][1], exc_info[0][2])
3257 return res
3258 def foreach_set(arg0, arg1):
3259 try:
3260 if not arg0.__class__ is union_set:
3261 arg0 = union_set(arg0)
3262 except:
3263 raise
3264 exc_info = [None]
3265 fn = CFUNCTYPE(c_int, c_void_p, c_void_p)
3266 def cb_func(cb_arg0, cb_arg1):
3267 cb_arg0 = set(ctx=arg0.ctx, ptr=cb_arg0)
3268 try:
3269 arg1(cb_arg0)
3270 except:
3271 import sys
3272 exc_info[0] = sys.exc_info()
3273 return -1
3274 return 0
3275 cb = fn(cb_func)
3276 ctx = arg0.ctx
3277 res = isl.isl_union_set_foreach_set(arg0.ptr, cb, None)
3278 if exc_info[0] != None:
3279 raise (exc_info[0][0], exc_info[0][1], exc_info[0][2])
3280 return res
3281 def gist(arg0, arg1):
3282 try:
3283 if not arg0.__class__ is union_set:
3284 arg0 = union_set(arg0)
3285 except:
3286 raise
3287 try:
3288 if not arg1.__class__ is union_set:
3289 arg1 = union_set(arg1)
3290 except:
3291 raise
3292 ctx = arg0.ctx
3293 res = isl.isl_union_set_gist(isl.isl_union_set_copy(arg0.ptr), isl.isl_union_set_copy(arg1.ptr))
3294 return union_set(ctx=ctx, ptr=res)
3295 def gist_params(arg0, arg1):
3296 try:
3297 if not arg0.__class__ is union_set:
3298 arg0 = union_set(arg0)
3299 except:
3300 raise
3301 try:
3302 if not arg1.__class__ is set:
3303 arg1 = set(arg1)
3304 except:
3305 raise
3306 ctx = arg0.ctx
3307 res = isl.isl_union_set_gist_params(isl.isl_union_set_copy(arg0.ptr), isl.isl_set_copy(arg1.ptr))
3308 return union_set(ctx=ctx, ptr=res)
3309 def identity(arg0):
3310 try:
3311 if not arg0.__class__ is union_set:
3312 arg0 = union_set(arg0)
3313 except:
3314 raise
3315 ctx = arg0.ctx
3316 res = isl.isl_union_set_identity(isl.isl_union_set_copy(arg0.ptr))
3317 return union_map(ctx=ctx, ptr=res)
3318 def intersect(arg0, arg1):
3319 try:
3320 if not arg0.__class__ is union_set:
3321 arg0 = union_set(arg0)
3322 except:
3323 raise
3324 try:
3325 if not arg1.__class__ is union_set:
3326 arg1 = union_set(arg1)
3327 except:
3328 raise
3329 ctx = arg0.ctx
3330 res = isl.isl_union_set_intersect(isl.isl_union_set_copy(arg0.ptr), isl.isl_union_set_copy(arg1.ptr))
3331 return union_set(ctx=ctx, ptr=res)
3332 def intersect_params(arg0, arg1):
3333 try:
3334 if not arg0.__class__ is union_set:
3335 arg0 = union_set(arg0)
3336 except:
3337 raise
3338 try:
3339 if not arg1.__class__ is set:
3340 arg1 = set(arg1)
3341 except:
3342 raise
3343 ctx = arg0.ctx
3344 res = isl.isl_union_set_intersect_params(isl.isl_union_set_copy(arg0.ptr), isl.isl_set_copy(arg1.ptr))
3345 return union_set(ctx=ctx, ptr=res)
3346 def is_empty(arg0):
3347 try:
3348 if not arg0.__class__ is union_set:
3349 arg0 = union_set(arg0)
3350 except:
3351 raise
3352 ctx = arg0.ctx
3353 res = isl.isl_union_set_is_empty(arg0.ptr)
3354 if res < 0:
3355 raise
3356 return bool(res)
3357 def is_equal(arg0, arg1):
3358 try:
3359 if not arg0.__class__ is union_set:
3360 arg0 = union_set(arg0)
3361 except:
3362 raise
3363 try:
3364 if not arg1.__class__ is union_set:
3365 arg1 = union_set(arg1)
3366 except:
3367 raise
3368 ctx = arg0.ctx
3369 res = isl.isl_union_set_is_equal(arg0.ptr, arg1.ptr)
3370 if res < 0:
3371 raise
3372 return bool(res)
3373 def is_strict_subset(arg0, arg1):
3374 try:
3375 if not arg0.__class__ is union_set:
3376 arg0 = union_set(arg0)
3377 except:
3378 raise
3379 try:
3380 if not arg1.__class__ is union_set:
3381 arg1 = union_set(arg1)
3382 except:
3383 raise
3384 ctx = arg0.ctx
3385 res = isl.isl_union_set_is_strict_subset(arg0.ptr, arg1.ptr)
3386 if res < 0:
3387 raise
3388 return bool(res)
3389 def is_subset(arg0, arg1):
3390 try:
3391 if not arg0.__class__ is union_set:
3392 arg0 = union_set(arg0)
3393 except:
3394 raise
3395 try:
3396 if not arg1.__class__ is union_set:
3397 arg1 = union_set(arg1)
3398 except:
3399 raise
3400 ctx = arg0.ctx
3401 res = isl.isl_union_set_is_subset(arg0.ptr, arg1.ptr)
3402 if res < 0:
3403 raise
3404 return bool(res)
3405 def lexmax(arg0):
3406 try:
3407 if not arg0.__class__ is union_set:
3408 arg0 = union_set(arg0)
3409 except:
3410 raise
3411 ctx = arg0.ctx
3412 res = isl.isl_union_set_lexmax(isl.isl_union_set_copy(arg0.ptr))
3413 return union_set(ctx=ctx, ptr=res)
3414 def lexmin(arg0):
3415 try:
3416 if not arg0.__class__ is union_set:
3417 arg0 = union_set(arg0)
3418 except:
3419 raise
3420 ctx = arg0.ctx
3421 res = isl.isl_union_set_lexmin(isl.isl_union_set_copy(arg0.ptr))
3422 return union_set(ctx=ctx, ptr=res)
3423 def polyhedral_hull(arg0):
3424 try:
3425 if not arg0.__class__ is union_set:
3426 arg0 = union_set(arg0)
3427 except:
3428 raise
3429 ctx = arg0.ctx
3430 res = isl.isl_union_set_polyhedral_hull(isl.isl_union_set_copy(arg0.ptr))
3431 return union_set(ctx=ctx, ptr=res)
3432 def preimage(arg0, arg1):
3433 if arg1.__class__ is multi_aff:
3434 res = isl.isl_union_set_preimage_multi_aff(isl.isl_union_set_copy(arg0.ptr), isl.isl_multi_aff_copy(arg1.ptr))
3435 return union_set(ctx=arg0.ctx, ptr=res)
3436 if arg1.__class__ is pw_multi_aff:
3437 res = isl.isl_union_set_preimage_pw_multi_aff(isl.isl_union_set_copy(arg0.ptr), isl.isl_pw_multi_aff_copy(arg1.ptr))
3438 return union_set(ctx=arg0.ctx, ptr=res)
3439 if arg1.__class__ is union_pw_multi_aff:
3440 res = isl.isl_union_set_preimage_union_pw_multi_aff(isl.isl_union_set_copy(arg0.ptr), isl.isl_union_pw_multi_aff_copy(arg1.ptr))
3441 return union_set(ctx=arg0.ctx, ptr=res)
3442 def sample_point(arg0):
3443 try:
3444 if not arg0.__class__ is union_set:
3445 arg0 = union_set(arg0)
3446 except:
3447 raise
3448 ctx = arg0.ctx
3449 res = isl.isl_union_set_sample_point(isl.isl_union_set_copy(arg0.ptr))
3450 return point(ctx=ctx, ptr=res)
3451 def subtract(arg0, arg1):
3452 try:
3453 if not arg0.__class__ is union_set:
3454 arg0 = union_set(arg0)
3455 except:
3456 raise
3457 try:
3458 if not arg1.__class__ is union_set:
3459 arg1 = union_set(arg1)
3460 except:
3461 raise
3462 ctx = arg0.ctx
3463 res = isl.isl_union_set_subtract(isl.isl_union_set_copy(arg0.ptr), isl.isl_union_set_copy(arg1.ptr))
3464 return union_set(ctx=ctx, ptr=res)
3465 def union(arg0, arg1):
3466 try:
3467 if not arg0.__class__ is union_set:
3468 arg0 = union_set(arg0)
3469 except:
3470 raise
3471 try:
3472 if not arg1.__class__ is union_set:
3473 arg1 = union_set(arg1)
3474 except:
3475 raise
3476 ctx = arg0.ctx
3477 res = isl.isl_union_set_union(isl.isl_union_set_copy(arg0.ptr), isl.isl_union_set_copy(arg1.ptr))
3478 return union_set(ctx=ctx, ptr=res)
3479 def unwrap(arg0):
3480 try:
3481 if not arg0.__class__ is union_set:
3482 arg0 = union_set(arg0)
3483 except:
3484 raise
3485 ctx = arg0.ctx
3486 res = isl.isl_union_set_unwrap(isl.isl_union_set_copy(arg0.ptr))
3487 return union_map(ctx=ctx, ptr=res)
3489 isl.isl_union_set_from_basic_set.restype = c_void_p
3490 isl.isl_union_set_from_basic_set.argtypes = [c_void_p]
3491 isl.isl_union_set_from_set.restype = c_void_p
3492 isl.isl_union_set_from_set.argtypes = [c_void_p]
3493 isl.isl_union_set_from_point.restype = c_void_p
3494 isl.isl_union_set_from_point.argtypes = [c_void_p]
3495 isl.isl_union_set_read_from_str.restype = c_void_p
3496 isl.isl_union_set_read_from_str.argtypes = [Context, c_char_p]
3497 isl.isl_union_set_affine_hull.restype = c_void_p
3498 isl.isl_union_set_affine_hull.argtypes = [c_void_p]
3499 isl.isl_union_set_apply.restype = c_void_p
3500 isl.isl_union_set_apply.argtypes = [c_void_p, c_void_p]
3501 isl.isl_union_set_coalesce.restype = c_void_p
3502 isl.isl_union_set_coalesce.argtypes = [c_void_p]
3503 isl.isl_union_set_compute_divs.restype = c_void_p
3504 isl.isl_union_set_compute_divs.argtypes = [c_void_p]
3505 isl.isl_union_set_detect_equalities.restype = c_void_p
3506 isl.isl_union_set_detect_equalities.argtypes = [c_void_p]
3507 isl.isl_union_set_foreach_point.argtypes = [c_void_p, c_void_p, c_void_p]
3508 isl.isl_union_set_foreach_set.argtypes = [c_void_p, c_void_p, c_void_p]
3509 isl.isl_union_set_gist.restype = c_void_p
3510 isl.isl_union_set_gist.argtypes = [c_void_p, c_void_p]
3511 isl.isl_union_set_gist_params.restype = c_void_p
3512 isl.isl_union_set_gist_params.argtypes = [c_void_p, c_void_p]
3513 isl.isl_union_set_identity.restype = c_void_p
3514 isl.isl_union_set_identity.argtypes = [c_void_p]
3515 isl.isl_union_set_intersect.restype = c_void_p
3516 isl.isl_union_set_intersect.argtypes = [c_void_p, c_void_p]
3517 isl.isl_union_set_intersect_params.restype = c_void_p
3518 isl.isl_union_set_intersect_params.argtypes = [c_void_p, c_void_p]
3519 isl.isl_union_set_is_empty.restype = c_bool
3520 isl.isl_union_set_is_empty.argtypes = [c_void_p]
3521 isl.isl_union_set_is_equal.restype = c_bool
3522 isl.isl_union_set_is_equal.argtypes = [c_void_p, c_void_p]
3523 isl.isl_union_set_is_strict_subset.restype = c_bool
3524 isl.isl_union_set_is_strict_subset.argtypes = [c_void_p, c_void_p]
3525 isl.isl_union_set_is_subset.restype = c_bool
3526 isl.isl_union_set_is_subset.argtypes = [c_void_p, c_void_p]
3527 isl.isl_union_set_lexmax.restype = c_void_p
3528 isl.isl_union_set_lexmax.argtypes = [c_void_p]
3529 isl.isl_union_set_lexmin.restype = c_void_p
3530 isl.isl_union_set_lexmin.argtypes = [c_void_p]
3531 isl.isl_union_set_polyhedral_hull.restype = c_void_p
3532 isl.isl_union_set_polyhedral_hull.argtypes = [c_void_p]
3533 isl.isl_union_set_preimage_multi_aff.restype = c_void_p
3534 isl.isl_union_set_preimage_multi_aff.argtypes = [c_void_p, c_void_p]
3535 isl.isl_union_set_preimage_pw_multi_aff.restype = c_void_p
3536 isl.isl_union_set_preimage_pw_multi_aff.argtypes = [c_void_p, c_void_p]
3537 isl.isl_union_set_preimage_union_pw_multi_aff.restype = c_void_p
3538 isl.isl_union_set_preimage_union_pw_multi_aff.argtypes = [c_void_p, c_void_p]
3539 isl.isl_union_set_sample_point.restype = c_void_p
3540 isl.isl_union_set_sample_point.argtypes = [c_void_p]
3541 isl.isl_union_set_subtract.restype = c_void_p
3542 isl.isl_union_set_subtract.argtypes = [c_void_p, c_void_p]
3543 isl.isl_union_set_union.restype = c_void_p
3544 isl.isl_union_set_union.argtypes = [c_void_p, c_void_p]
3545 isl.isl_union_set_unwrap.restype = c_void_p
3546 isl.isl_union_set_unwrap.argtypes = [c_void_p]
3547 isl.isl_union_set_copy.restype = c_void_p
3548 isl.isl_union_set_copy.argtypes = [c_void_p]
3549 isl.isl_union_set_free.restype = c_void_p
3550 isl.isl_union_set_free.argtypes = [c_void_p]
3551 isl.isl_union_set_to_str.restype = POINTER(c_char)
3552 isl.isl_union_set_to_str.argtypes = [c_void_p]
3554 class set(union_set):
3555 def __init__(self, *args, **keywords):
3556 if "ptr" in keywords:
3557 self.ctx = keywords["ctx"]
3558 self.ptr = keywords["ptr"]
3559 return
3560 if len(args) == 1 and type(args[0]) == str:
3561 self.ctx = Context.getDefaultInstance()
3562 self.ptr = isl.isl_set_read_from_str(self.ctx, args[0].encode('ascii'))
3563 return
3564 if len(args) == 1 and args[0].__class__ is basic_set:
3565 self.ctx = Context.getDefaultInstance()
3566 self.ptr = isl.isl_set_from_basic_set(isl.isl_basic_set_copy(args[0].ptr))
3567 return
3568 if len(args) == 1 and args[0].__class__ is point:
3569 self.ctx = Context.getDefaultInstance()
3570 self.ptr = isl.isl_set_from_point(isl.isl_point_copy(args[0].ptr))
3571 return
3572 raise Error
3573 def __del__(self):
3574 if hasattr(self, 'ptr'):
3575 isl.isl_set_free(self.ptr)
3576 def __str__(arg0):
3577 try:
3578 if not arg0.__class__ is set:
3579 arg0 = set(arg0)
3580 except:
3581 raise
3582 ptr = isl.isl_set_to_str(arg0.ptr)
3583 res = cast(ptr, c_char_p).value.decode('ascii')
3584 libc.free(ptr)
3585 return res
3586 def __repr__(self):
3587 s = str(self)
3588 if '"' in s:
3589 return 'isl.set("""%s""")' % s
3590 else:
3591 return 'isl.set("%s")' % s
3592 def affine_hull(arg0):
3593 try:
3594 if not arg0.__class__ is set:
3595 arg0 = set(arg0)
3596 except:
3597 raise
3598 ctx = arg0.ctx
3599 res = isl.isl_set_affine_hull(isl.isl_set_copy(arg0.ptr))
3600 return basic_set(ctx=ctx, ptr=res)
3601 def apply(arg0, arg1):
3602 try:
3603 if not arg0.__class__ is set:
3604 arg0 = set(arg0)
3605 except:
3606 raise
3607 try:
3608 if not arg1.__class__ is map:
3609 arg1 = map(arg1)
3610 except:
3611 return union_set(arg0).apply(arg1)
3612 ctx = arg0.ctx
3613 res = isl.isl_set_apply(isl.isl_set_copy(arg0.ptr), isl.isl_map_copy(arg1.ptr))
3614 return set(ctx=ctx, ptr=res)
3615 def coalesce(arg0):
3616 try:
3617 if not arg0.__class__ is set:
3618 arg0 = set(arg0)
3619 except:
3620 raise
3621 ctx = arg0.ctx
3622 res = isl.isl_set_coalesce(isl.isl_set_copy(arg0.ptr))
3623 return set(ctx=ctx, ptr=res)
3624 def complement(arg0):
3625 try:
3626 if not arg0.__class__ is set:
3627 arg0 = set(arg0)
3628 except:
3629 raise
3630 ctx = arg0.ctx
3631 res = isl.isl_set_complement(isl.isl_set_copy(arg0.ptr))
3632 return set(ctx=ctx, ptr=res)
3633 def detect_equalities(arg0):
3634 try:
3635 if not arg0.__class__ is set:
3636 arg0 = set(arg0)
3637 except:
3638 raise
3639 ctx = arg0.ctx
3640 res = isl.isl_set_detect_equalities(isl.isl_set_copy(arg0.ptr))
3641 return set(ctx=ctx, ptr=res)
3642 def flatten(arg0):
3643 try:
3644 if not arg0.__class__ is set:
3645 arg0 = set(arg0)
3646 except:
3647 raise
3648 ctx = arg0.ctx
3649 res = isl.isl_set_flatten(isl.isl_set_copy(arg0.ptr))
3650 return set(ctx=ctx, ptr=res)
3651 def foreach_basic_set(arg0, arg1):
3652 try:
3653 if not arg0.__class__ is set:
3654 arg0 = set(arg0)
3655 except:
3656 raise
3657 exc_info = [None]
3658 fn = CFUNCTYPE(c_int, c_void_p, c_void_p)
3659 def cb_func(cb_arg0, cb_arg1):
3660 cb_arg0 = basic_set(ctx=arg0.ctx, ptr=cb_arg0)
3661 try:
3662 arg1(cb_arg0)
3663 except:
3664 import sys
3665 exc_info[0] = sys.exc_info()
3666 return -1
3667 return 0
3668 cb = fn(cb_func)
3669 ctx = arg0.ctx
3670 res = isl.isl_set_foreach_basic_set(arg0.ptr, cb, None)
3671 if exc_info[0] != None:
3672 raise (exc_info[0][0], exc_info[0][1], exc_info[0][2])
3673 return res
3674 def get_stride(arg0, arg1):
3675 try:
3676 if not arg0.__class__ is set:
3677 arg0 = set(arg0)
3678 except:
3679 raise
3680 ctx = arg0.ctx
3681 res = isl.isl_set_get_stride(arg0.ptr, arg1)
3682 return val(ctx=ctx, ptr=res)
3683 def gist(arg0, arg1):
3684 try:
3685 if not arg0.__class__ is set:
3686 arg0 = set(arg0)
3687 except:
3688 raise
3689 try:
3690 if not arg1.__class__ is set:
3691 arg1 = set(arg1)
3692 except:
3693 return union_set(arg0).gist(arg1)
3694 ctx = arg0.ctx
3695 res = isl.isl_set_gist(isl.isl_set_copy(arg0.ptr), isl.isl_set_copy(arg1.ptr))
3696 return set(ctx=ctx, ptr=res)
3697 def identity(arg0):
3698 try:
3699 if not arg0.__class__ is set:
3700 arg0 = set(arg0)
3701 except:
3702 raise
3703 ctx = arg0.ctx
3704 res = isl.isl_set_identity(isl.isl_set_copy(arg0.ptr))
3705 return map(ctx=ctx, ptr=res)
3706 def intersect(arg0, arg1):
3707 try:
3708 if not arg0.__class__ is set:
3709 arg0 = set(arg0)
3710 except:
3711 raise
3712 try:
3713 if not arg1.__class__ is set:
3714 arg1 = set(arg1)
3715 except:
3716 return union_set(arg0).intersect(arg1)
3717 ctx = arg0.ctx
3718 res = isl.isl_set_intersect(isl.isl_set_copy(arg0.ptr), isl.isl_set_copy(arg1.ptr))
3719 return set(ctx=ctx, ptr=res)
3720 def intersect_params(arg0, arg1):
3721 try:
3722 if not arg0.__class__ is set:
3723 arg0 = set(arg0)
3724 except:
3725 raise
3726 try:
3727 if not arg1.__class__ is set:
3728 arg1 = set(arg1)
3729 except:
3730 return union_set(arg0).intersect_params(arg1)
3731 ctx = arg0.ctx
3732 res = isl.isl_set_intersect_params(isl.isl_set_copy(arg0.ptr), isl.isl_set_copy(arg1.ptr))
3733 return set(ctx=ctx, ptr=res)
3734 def is_disjoint(arg0, arg1):
3735 try:
3736 if not arg0.__class__ is set:
3737 arg0 = set(arg0)
3738 except:
3739 raise
3740 try:
3741 if not arg1.__class__ is set:
3742 arg1 = set(arg1)
3743 except:
3744 return union_set(arg0).is_disjoint(arg1)
3745 ctx = arg0.ctx
3746 res = isl.isl_set_is_disjoint(arg0.ptr, arg1.ptr)
3747 if res < 0:
3748 raise
3749 return bool(res)
3750 def is_empty(arg0):
3751 try:
3752 if not arg0.__class__ is set:
3753 arg0 = set(arg0)
3754 except:
3755 raise
3756 ctx = arg0.ctx
3757 res = isl.isl_set_is_empty(arg0.ptr)
3758 if res < 0:
3759 raise
3760 return bool(res)
3761 def is_equal(arg0, arg1):
3762 try:
3763 if not arg0.__class__ is set:
3764 arg0 = set(arg0)
3765 except:
3766 raise
3767 try:
3768 if not arg1.__class__ is set:
3769 arg1 = set(arg1)
3770 except:
3771 return union_set(arg0).is_equal(arg1)
3772 ctx = arg0.ctx
3773 res = isl.isl_set_is_equal(arg0.ptr, arg1.ptr)
3774 if res < 0:
3775 raise
3776 return bool(res)
3777 def is_strict_subset(arg0, arg1):
3778 try:
3779 if not arg0.__class__ is set:
3780 arg0 = set(arg0)
3781 except:
3782 raise
3783 try:
3784 if not arg1.__class__ is set:
3785 arg1 = set(arg1)
3786 except:
3787 return union_set(arg0).is_strict_subset(arg1)
3788 ctx = arg0.ctx
3789 res = isl.isl_set_is_strict_subset(arg0.ptr, arg1.ptr)
3790 if res < 0:
3791 raise
3792 return bool(res)
3793 def is_subset(arg0, arg1):
3794 try:
3795 if not arg0.__class__ is set:
3796 arg0 = set(arg0)
3797 except:
3798 raise
3799 try:
3800 if not arg1.__class__ is set:
3801 arg1 = set(arg1)
3802 except:
3803 return union_set(arg0).is_subset(arg1)
3804 ctx = arg0.ctx
3805 res = isl.isl_set_is_subset(arg0.ptr, arg1.ptr)
3806 if res < 0:
3807 raise
3808 return bool(res)
3809 def is_wrapping(arg0):
3810 try:
3811 if not arg0.__class__ is set:
3812 arg0 = set(arg0)
3813 except:
3814 raise
3815 ctx = arg0.ctx
3816 res = isl.isl_set_is_wrapping(arg0.ptr)
3817 if res < 0:
3818 raise
3819 return bool(res)
3820 def lexmax(arg0):
3821 try:
3822 if not arg0.__class__ is set:
3823 arg0 = set(arg0)
3824 except:
3825 raise
3826 ctx = arg0.ctx
3827 res = isl.isl_set_lexmax(isl.isl_set_copy(arg0.ptr))
3828 return set(ctx=ctx, ptr=res)
3829 def lexmin(arg0):
3830 try:
3831 if not arg0.__class__ is set:
3832 arg0 = set(arg0)
3833 except:
3834 raise
3835 ctx = arg0.ctx
3836 res = isl.isl_set_lexmin(isl.isl_set_copy(arg0.ptr))
3837 return set(ctx=ctx, ptr=res)
3838 def max_val(arg0, arg1):
3839 try:
3840 if not arg0.__class__ is set:
3841 arg0 = set(arg0)
3842 except:
3843 raise
3844 try:
3845 if not arg1.__class__ is aff:
3846 arg1 = aff(arg1)
3847 except:
3848 return union_set(arg0).max_val(arg1)
3849 ctx = arg0.ctx
3850 res = isl.isl_set_max_val(arg0.ptr, arg1.ptr)
3851 return val(ctx=ctx, ptr=res)
3852 def min_val(arg0, arg1):
3853 try:
3854 if not arg0.__class__ is set:
3855 arg0 = set(arg0)
3856 except:
3857 raise
3858 try:
3859 if not arg1.__class__ is aff:
3860 arg1 = aff(arg1)
3861 except:
3862 return union_set(arg0).min_val(arg1)
3863 ctx = arg0.ctx
3864 res = isl.isl_set_min_val(arg0.ptr, arg1.ptr)
3865 return val(ctx=ctx, ptr=res)
3866 def polyhedral_hull(arg0):
3867 try:
3868 if not arg0.__class__ is set:
3869 arg0 = set(arg0)
3870 except:
3871 raise
3872 ctx = arg0.ctx
3873 res = isl.isl_set_polyhedral_hull(isl.isl_set_copy(arg0.ptr))
3874 return basic_set(ctx=ctx, ptr=res)
3875 def sample(arg0):
3876 try:
3877 if not arg0.__class__ is set:
3878 arg0 = set(arg0)
3879 except:
3880 raise
3881 ctx = arg0.ctx
3882 res = isl.isl_set_sample(isl.isl_set_copy(arg0.ptr))
3883 return basic_set(ctx=ctx, ptr=res)
3884 def sample_point(arg0):
3885 try:
3886 if not arg0.__class__ is set:
3887 arg0 = set(arg0)
3888 except:
3889 raise
3890 ctx = arg0.ctx
3891 res = isl.isl_set_sample_point(isl.isl_set_copy(arg0.ptr))
3892 return point(ctx=ctx, ptr=res)
3893 def subtract(arg0, arg1):
3894 try:
3895 if not arg0.__class__ is set:
3896 arg0 = set(arg0)
3897 except:
3898 raise
3899 try:
3900 if not arg1.__class__ is set:
3901 arg1 = set(arg1)
3902 except:
3903 return union_set(arg0).subtract(arg1)
3904 ctx = arg0.ctx
3905 res = isl.isl_set_subtract(isl.isl_set_copy(arg0.ptr), isl.isl_set_copy(arg1.ptr))
3906 return set(ctx=ctx, ptr=res)
3907 def union(arg0, arg1):
3908 try:
3909 if not arg0.__class__ is set:
3910 arg0 = set(arg0)
3911 except:
3912 raise
3913 try:
3914 if not arg1.__class__ is set:
3915 arg1 = set(arg1)
3916 except:
3917 return union_set(arg0).union(arg1)
3918 ctx = arg0.ctx
3919 res = isl.isl_set_union(isl.isl_set_copy(arg0.ptr), isl.isl_set_copy(arg1.ptr))
3920 return set(ctx=ctx, ptr=res)
3921 def unshifted_simple_hull(arg0):
3922 try:
3923 if not arg0.__class__ is set:
3924 arg0 = set(arg0)
3925 except:
3926 raise
3927 ctx = arg0.ctx
3928 res = isl.isl_set_unshifted_simple_hull(isl.isl_set_copy(arg0.ptr))
3929 return basic_set(ctx=ctx, ptr=res)
3931 isl.isl_set_read_from_str.restype = c_void_p
3932 isl.isl_set_read_from_str.argtypes = [Context, c_char_p]
3933 isl.isl_set_from_basic_set.restype = c_void_p
3934 isl.isl_set_from_basic_set.argtypes = [c_void_p]
3935 isl.isl_set_from_point.restype = c_void_p
3936 isl.isl_set_from_point.argtypes = [c_void_p]
3937 isl.isl_set_affine_hull.restype = c_void_p
3938 isl.isl_set_affine_hull.argtypes = [c_void_p]
3939 isl.isl_set_apply.restype = c_void_p
3940 isl.isl_set_apply.argtypes = [c_void_p, c_void_p]
3941 isl.isl_set_coalesce.restype = c_void_p
3942 isl.isl_set_coalesce.argtypes = [c_void_p]
3943 isl.isl_set_complement.restype = c_void_p
3944 isl.isl_set_complement.argtypes = [c_void_p]
3945 isl.isl_set_detect_equalities.restype = c_void_p
3946 isl.isl_set_detect_equalities.argtypes = [c_void_p]
3947 isl.isl_set_flatten.restype = c_void_p
3948 isl.isl_set_flatten.argtypes = [c_void_p]
3949 isl.isl_set_foreach_basic_set.argtypes = [c_void_p, c_void_p, c_void_p]
3950 isl.isl_set_get_stride.restype = c_void_p
3951 isl.isl_set_get_stride.argtypes = [c_void_p, c_int]
3952 isl.isl_set_gist.restype = c_void_p
3953 isl.isl_set_gist.argtypes = [c_void_p, c_void_p]
3954 isl.isl_set_identity.restype = c_void_p
3955 isl.isl_set_identity.argtypes = [c_void_p]
3956 isl.isl_set_intersect.restype = c_void_p
3957 isl.isl_set_intersect.argtypes = [c_void_p, c_void_p]
3958 isl.isl_set_intersect_params.restype = c_void_p
3959 isl.isl_set_intersect_params.argtypes = [c_void_p, c_void_p]
3960 isl.isl_set_is_disjoint.restype = c_bool
3961 isl.isl_set_is_disjoint.argtypes = [c_void_p, c_void_p]
3962 isl.isl_set_is_empty.restype = c_bool
3963 isl.isl_set_is_empty.argtypes = [c_void_p]
3964 isl.isl_set_is_equal.restype = c_bool
3965 isl.isl_set_is_equal.argtypes = [c_void_p, c_void_p]
3966 isl.isl_set_is_strict_subset.restype = c_bool
3967 isl.isl_set_is_strict_subset.argtypes = [c_void_p, c_void_p]
3968 isl.isl_set_is_subset.restype = c_bool
3969 isl.isl_set_is_subset.argtypes = [c_void_p, c_void_p]
3970 isl.isl_set_is_wrapping.restype = c_bool
3971 isl.isl_set_is_wrapping.argtypes = [c_void_p]
3972 isl.isl_set_lexmax.restype = c_void_p
3973 isl.isl_set_lexmax.argtypes = [c_void_p]
3974 isl.isl_set_lexmin.restype = c_void_p
3975 isl.isl_set_lexmin.argtypes = [c_void_p]
3976 isl.isl_set_max_val.restype = c_void_p
3977 isl.isl_set_max_val.argtypes = [c_void_p, c_void_p]
3978 isl.isl_set_min_val.restype = c_void_p
3979 isl.isl_set_min_val.argtypes = [c_void_p, c_void_p]
3980 isl.isl_set_polyhedral_hull.restype = c_void_p
3981 isl.isl_set_polyhedral_hull.argtypes = [c_void_p]
3982 isl.isl_set_sample.restype = c_void_p
3983 isl.isl_set_sample.argtypes = [c_void_p]
3984 isl.isl_set_sample_point.restype = c_void_p
3985 isl.isl_set_sample_point.argtypes = [c_void_p]
3986 isl.isl_set_subtract.restype = c_void_p
3987 isl.isl_set_subtract.argtypes = [c_void_p, c_void_p]
3988 isl.isl_set_union.restype = c_void_p
3989 isl.isl_set_union.argtypes = [c_void_p, c_void_p]
3990 isl.isl_set_unshifted_simple_hull.restype = c_void_p
3991 isl.isl_set_unshifted_simple_hull.argtypes = [c_void_p]
3992 isl.isl_set_copy.restype = c_void_p
3993 isl.isl_set_copy.argtypes = [c_void_p]
3994 isl.isl_set_free.restype = c_void_p
3995 isl.isl_set_free.argtypes = [c_void_p]
3996 isl.isl_set_to_str.restype = POINTER(c_char)
3997 isl.isl_set_to_str.argtypes = [c_void_p]
3999 class basic_set(set):
4000 def __init__(self, *args, **keywords):
4001 if "ptr" in keywords:
4002 self.ctx = keywords["ctx"]
4003 self.ptr = keywords["ptr"]
4004 return
4005 if len(args) == 1 and type(args[0]) == str:
4006 self.ctx = Context.getDefaultInstance()
4007 self.ptr = isl.isl_basic_set_read_from_str(self.ctx, args[0].encode('ascii'))
4008 return
4009 if len(args) == 1 and args[0].__class__ is point:
4010 self.ctx = Context.getDefaultInstance()
4011 self.ptr = isl.isl_basic_set_from_point(isl.isl_point_copy(args[0].ptr))
4012 return
4013 raise Error
4014 def __del__(self):
4015 if hasattr(self, 'ptr'):
4016 isl.isl_basic_set_free(self.ptr)
4017 def __str__(arg0):
4018 try:
4019 if not arg0.__class__ is basic_set:
4020 arg0 = basic_set(arg0)
4021 except:
4022 raise
4023 ptr = isl.isl_basic_set_to_str(arg0.ptr)
4024 res = cast(ptr, c_char_p).value.decode('ascii')
4025 libc.free(ptr)
4026 return res
4027 def __repr__(self):
4028 s = str(self)
4029 if '"' in s:
4030 return 'isl.basic_set("""%s""")' % s
4031 else:
4032 return 'isl.basic_set("%s")' % s
4033 def affine_hull(arg0):
4034 try:
4035 if not arg0.__class__ is basic_set:
4036 arg0 = basic_set(arg0)
4037 except:
4038 raise
4039 ctx = arg0.ctx
4040 res = isl.isl_basic_set_affine_hull(isl.isl_basic_set_copy(arg0.ptr))
4041 return basic_set(ctx=ctx, ptr=res)
4042 def apply(arg0, arg1):
4043 try:
4044 if not arg0.__class__ is basic_set:
4045 arg0 = basic_set(arg0)
4046 except:
4047 raise
4048 try:
4049 if not arg1.__class__ is basic_map:
4050 arg1 = basic_map(arg1)
4051 except:
4052 return set(arg0).apply(arg1)
4053 ctx = arg0.ctx
4054 res = isl.isl_basic_set_apply(isl.isl_basic_set_copy(arg0.ptr), isl.isl_basic_map_copy(arg1.ptr))
4055 return basic_set(ctx=ctx, ptr=res)
4056 def detect_equalities(arg0):
4057 try:
4058 if not arg0.__class__ is basic_set:
4059 arg0 = basic_set(arg0)
4060 except:
4061 raise
4062 ctx = arg0.ctx
4063 res = isl.isl_basic_set_detect_equalities(isl.isl_basic_set_copy(arg0.ptr))
4064 return basic_set(ctx=ctx, ptr=res)
4065 def dim_max_val(arg0, arg1):
4066 try:
4067 if not arg0.__class__ is basic_set:
4068 arg0 = basic_set(arg0)
4069 except:
4070 raise
4071 ctx = arg0.ctx
4072 res = isl.isl_basic_set_dim_max_val(isl.isl_basic_set_copy(arg0.ptr), arg1)
4073 return val(ctx=ctx, ptr=res)
4074 def flatten(arg0):
4075 try:
4076 if not arg0.__class__ is basic_set:
4077 arg0 = basic_set(arg0)
4078 except:
4079 raise
4080 ctx = arg0.ctx
4081 res = isl.isl_basic_set_flatten(isl.isl_basic_set_copy(arg0.ptr))
4082 return basic_set(ctx=ctx, ptr=res)
4083 def gist(arg0, arg1):
4084 try:
4085 if not arg0.__class__ is basic_set:
4086 arg0 = basic_set(arg0)
4087 except:
4088 raise
4089 try:
4090 if not arg1.__class__ is basic_set:
4091 arg1 = basic_set(arg1)
4092 except:
4093 return set(arg0).gist(arg1)
4094 ctx = arg0.ctx
4095 res = isl.isl_basic_set_gist(isl.isl_basic_set_copy(arg0.ptr), isl.isl_basic_set_copy(arg1.ptr))
4096 return basic_set(ctx=ctx, ptr=res)
4097 def intersect(arg0, arg1):
4098 try:
4099 if not arg0.__class__ is basic_set:
4100 arg0 = basic_set(arg0)
4101 except:
4102 raise
4103 try:
4104 if not arg1.__class__ is basic_set:
4105 arg1 = basic_set(arg1)
4106 except:
4107 return set(arg0).intersect(arg1)
4108 ctx = arg0.ctx
4109 res = isl.isl_basic_set_intersect(isl.isl_basic_set_copy(arg0.ptr), isl.isl_basic_set_copy(arg1.ptr))
4110 return basic_set(ctx=ctx, ptr=res)
4111 def intersect_params(arg0, arg1):
4112 try:
4113 if not arg0.__class__ is basic_set:
4114 arg0 = basic_set(arg0)
4115 except:
4116 raise
4117 try:
4118 if not arg1.__class__ is basic_set:
4119 arg1 = basic_set(arg1)
4120 except:
4121 return set(arg0).intersect_params(arg1)
4122 ctx = arg0.ctx
4123 res = isl.isl_basic_set_intersect_params(isl.isl_basic_set_copy(arg0.ptr), isl.isl_basic_set_copy(arg1.ptr))
4124 return basic_set(ctx=ctx, ptr=res)
4125 def is_empty(arg0):
4126 try:
4127 if not arg0.__class__ is basic_set:
4128 arg0 = basic_set(arg0)
4129 except:
4130 raise
4131 ctx = arg0.ctx
4132 res = isl.isl_basic_set_is_empty(arg0.ptr)
4133 if res < 0:
4134 raise
4135 return bool(res)
4136 def is_equal(arg0, arg1):
4137 try:
4138 if not arg0.__class__ is basic_set:
4139 arg0 = basic_set(arg0)
4140 except:
4141 raise
4142 try:
4143 if not arg1.__class__ is basic_set:
4144 arg1 = basic_set(arg1)
4145 except:
4146 return set(arg0).is_equal(arg1)
4147 ctx = arg0.ctx
4148 res = isl.isl_basic_set_is_equal(arg0.ptr, arg1.ptr)
4149 if res < 0:
4150 raise
4151 return bool(res)
4152 def is_subset(arg0, arg1):
4153 try:
4154 if not arg0.__class__ is basic_set:
4155 arg0 = basic_set(arg0)
4156 except:
4157 raise
4158 try:
4159 if not arg1.__class__ is basic_set:
4160 arg1 = basic_set(arg1)
4161 except:
4162 return set(arg0).is_subset(arg1)
4163 ctx = arg0.ctx
4164 res = isl.isl_basic_set_is_subset(arg0.ptr, arg1.ptr)
4165 if res < 0:
4166 raise
4167 return bool(res)
4168 def is_wrapping(arg0):
4169 try:
4170 if not arg0.__class__ is basic_set:
4171 arg0 = basic_set(arg0)
4172 except:
4173 raise
4174 ctx = arg0.ctx
4175 res = isl.isl_basic_set_is_wrapping(arg0.ptr)
4176 if res < 0:
4177 raise
4178 return bool(res)
4179 def lexmax(arg0):
4180 try:
4181 if not arg0.__class__ is basic_set:
4182 arg0 = basic_set(arg0)
4183 except:
4184 raise
4185 ctx = arg0.ctx
4186 res = isl.isl_basic_set_lexmax(isl.isl_basic_set_copy(arg0.ptr))
4187 return set(ctx=ctx, ptr=res)
4188 def lexmin(arg0):
4189 try:
4190 if not arg0.__class__ is basic_set:
4191 arg0 = basic_set(arg0)
4192 except:
4193 raise
4194 ctx = arg0.ctx
4195 res = isl.isl_basic_set_lexmin(isl.isl_basic_set_copy(arg0.ptr))
4196 return set(ctx=ctx, ptr=res)
4197 def sample(arg0):
4198 try:
4199 if not arg0.__class__ is basic_set:
4200 arg0 = basic_set(arg0)
4201 except:
4202 raise
4203 ctx = arg0.ctx
4204 res = isl.isl_basic_set_sample(isl.isl_basic_set_copy(arg0.ptr))
4205 return basic_set(ctx=ctx, ptr=res)
4206 def sample_point(arg0):
4207 try:
4208 if not arg0.__class__ is basic_set:
4209 arg0 = basic_set(arg0)
4210 except:
4211 raise
4212 ctx = arg0.ctx
4213 res = isl.isl_basic_set_sample_point(isl.isl_basic_set_copy(arg0.ptr))
4214 return point(ctx=ctx, ptr=res)
4215 def union(arg0, arg1):
4216 try:
4217 if not arg0.__class__ is basic_set:
4218 arg0 = basic_set(arg0)
4219 except:
4220 raise
4221 try:
4222 if not arg1.__class__ is basic_set:
4223 arg1 = basic_set(arg1)
4224 except:
4225 return set(arg0).union(arg1)
4226 ctx = arg0.ctx
4227 res = isl.isl_basic_set_union(isl.isl_basic_set_copy(arg0.ptr), isl.isl_basic_set_copy(arg1.ptr))
4228 return set(ctx=ctx, ptr=res)
4230 isl.isl_basic_set_read_from_str.restype = c_void_p
4231 isl.isl_basic_set_read_from_str.argtypes = [Context, c_char_p]
4232 isl.isl_basic_set_from_point.restype = c_void_p
4233 isl.isl_basic_set_from_point.argtypes = [c_void_p]
4234 isl.isl_basic_set_affine_hull.restype = c_void_p
4235 isl.isl_basic_set_affine_hull.argtypes = [c_void_p]
4236 isl.isl_basic_set_apply.restype = c_void_p
4237 isl.isl_basic_set_apply.argtypes = [c_void_p, c_void_p]
4238 isl.isl_basic_set_detect_equalities.restype = c_void_p
4239 isl.isl_basic_set_detect_equalities.argtypes = [c_void_p]
4240 isl.isl_basic_set_dim_max_val.restype = c_void_p
4241 isl.isl_basic_set_dim_max_val.argtypes = [c_void_p, c_int]
4242 isl.isl_basic_set_flatten.restype = c_void_p
4243 isl.isl_basic_set_flatten.argtypes = [c_void_p]
4244 isl.isl_basic_set_gist.restype = c_void_p
4245 isl.isl_basic_set_gist.argtypes = [c_void_p, c_void_p]
4246 isl.isl_basic_set_intersect.restype = c_void_p
4247 isl.isl_basic_set_intersect.argtypes = [c_void_p, c_void_p]
4248 isl.isl_basic_set_intersect_params.restype = c_void_p
4249 isl.isl_basic_set_intersect_params.argtypes = [c_void_p, c_void_p]
4250 isl.isl_basic_set_is_empty.restype = c_bool
4251 isl.isl_basic_set_is_empty.argtypes = [c_void_p]
4252 isl.isl_basic_set_is_equal.restype = c_bool
4253 isl.isl_basic_set_is_equal.argtypes = [c_void_p, c_void_p]
4254 isl.isl_basic_set_is_subset.restype = c_bool
4255 isl.isl_basic_set_is_subset.argtypes = [c_void_p, c_void_p]
4256 isl.isl_basic_set_is_wrapping.restype = c_bool
4257 isl.isl_basic_set_is_wrapping.argtypes = [c_void_p]
4258 isl.isl_basic_set_lexmax.restype = c_void_p
4259 isl.isl_basic_set_lexmax.argtypes = [c_void_p]
4260 isl.isl_basic_set_lexmin.restype = c_void_p
4261 isl.isl_basic_set_lexmin.argtypes = [c_void_p]
4262 isl.isl_basic_set_sample.restype = c_void_p
4263 isl.isl_basic_set_sample.argtypes = [c_void_p]
4264 isl.isl_basic_set_sample_point.restype = c_void_p
4265 isl.isl_basic_set_sample_point.argtypes = [c_void_p]
4266 isl.isl_basic_set_union.restype = c_void_p
4267 isl.isl_basic_set_union.argtypes = [c_void_p, c_void_p]
4268 isl.isl_basic_set_copy.restype = c_void_p
4269 isl.isl_basic_set_copy.argtypes = [c_void_p]
4270 isl.isl_basic_set_free.restype = c_void_p
4271 isl.isl_basic_set_free.argtypes = [c_void_p]
4272 isl.isl_basic_set_to_str.restype = POINTER(c_char)
4273 isl.isl_basic_set_to_str.argtypes = [c_void_p]
4275 class multi_val(object):
4276 def __init__(self, *args, **keywords):
4277 if "ptr" in keywords:
4278 self.ctx = keywords["ctx"]
4279 self.ptr = keywords["ptr"]
4280 return
4281 raise Error
4282 def __del__(self):
4283 if hasattr(self, 'ptr'):
4284 isl.isl_multi_val_free(self.ptr)
4285 def __str__(arg0):
4286 try:
4287 if not arg0.__class__ is multi_val:
4288 arg0 = multi_val(arg0)
4289 except:
4290 raise
4291 ptr = isl.isl_multi_val_to_str(arg0.ptr)
4292 res = cast(ptr, c_char_p).value.decode('ascii')
4293 libc.free(ptr)
4294 return res
4295 def __repr__(self):
4296 s = str(self)
4297 if '"' in s:
4298 return 'isl.multi_val("""%s""")' % s
4299 else:
4300 return 'isl.multi_val("%s")' % s
4301 def add(arg0, arg1):
4302 try:
4303 if not arg0.__class__ is multi_val:
4304 arg0 = multi_val(arg0)
4305 except:
4306 raise
4307 try:
4308 if not arg1.__class__ is multi_val:
4309 arg1 = multi_val(arg1)
4310 except:
4311 raise
4312 ctx = arg0.ctx
4313 res = isl.isl_multi_val_add(isl.isl_multi_val_copy(arg0.ptr), isl.isl_multi_val_copy(arg1.ptr))
4314 return multi_val(ctx=ctx, ptr=res)
4315 def flat_range_product(arg0, arg1):
4316 try:
4317 if not arg0.__class__ is multi_val:
4318 arg0 = multi_val(arg0)
4319 except:
4320 raise
4321 try:
4322 if not arg1.__class__ is multi_val:
4323 arg1 = multi_val(arg1)
4324 except:
4325 raise
4326 ctx = arg0.ctx
4327 res = isl.isl_multi_val_flat_range_product(isl.isl_multi_val_copy(arg0.ptr), isl.isl_multi_val_copy(arg1.ptr))
4328 return multi_val(ctx=ctx, ptr=res)
4329 def product(arg0, arg1):
4330 try:
4331 if not arg0.__class__ is multi_val:
4332 arg0 = multi_val(arg0)
4333 except:
4334 raise
4335 try:
4336 if not arg1.__class__ is multi_val:
4337 arg1 = multi_val(arg1)
4338 except:
4339 raise
4340 ctx = arg0.ctx
4341 res = isl.isl_multi_val_product(isl.isl_multi_val_copy(arg0.ptr), isl.isl_multi_val_copy(arg1.ptr))
4342 return multi_val(ctx=ctx, ptr=res)
4343 def range_product(arg0, arg1):
4344 try:
4345 if not arg0.__class__ is multi_val:
4346 arg0 = multi_val(arg0)
4347 except:
4348 raise
4349 try:
4350 if not arg1.__class__ is multi_val:
4351 arg1 = multi_val(arg1)
4352 except:
4353 raise
4354 ctx = arg0.ctx
4355 res = isl.isl_multi_val_range_product(isl.isl_multi_val_copy(arg0.ptr), isl.isl_multi_val_copy(arg1.ptr))
4356 return multi_val(ctx=ctx, ptr=res)
4358 isl.isl_multi_val_add.restype = c_void_p
4359 isl.isl_multi_val_add.argtypes = [c_void_p, c_void_p]
4360 isl.isl_multi_val_flat_range_product.restype = c_void_p
4361 isl.isl_multi_val_flat_range_product.argtypes = [c_void_p, c_void_p]
4362 isl.isl_multi_val_product.restype = c_void_p
4363 isl.isl_multi_val_product.argtypes = [c_void_p, c_void_p]
4364 isl.isl_multi_val_range_product.restype = c_void_p
4365 isl.isl_multi_val_range_product.argtypes = [c_void_p, c_void_p]
4366 isl.isl_multi_val_copy.restype = c_void_p
4367 isl.isl_multi_val_copy.argtypes = [c_void_p]
4368 isl.isl_multi_val_free.restype = c_void_p
4369 isl.isl_multi_val_free.argtypes = [c_void_p]
4370 isl.isl_multi_val_to_str.restype = POINTER(c_char)
4371 isl.isl_multi_val_to_str.argtypes = [c_void_p]
4373 class point(basic_set):
4374 def __init__(self, *args, **keywords):
4375 if "ptr" in keywords:
4376 self.ctx = keywords["ctx"]
4377 self.ptr = keywords["ptr"]
4378 return
4379 raise Error
4380 def __del__(self):
4381 if hasattr(self, 'ptr'):
4382 isl.isl_point_free(self.ptr)
4383 def __str__(arg0):
4384 try:
4385 if not arg0.__class__ is point:
4386 arg0 = point(arg0)
4387 except:
4388 raise
4389 ptr = isl.isl_point_to_str(arg0.ptr)
4390 res = cast(ptr, c_char_p).value.decode('ascii')
4391 libc.free(ptr)
4392 return res
4393 def __repr__(self):
4394 s = str(self)
4395 if '"' in s:
4396 return 'isl.point("""%s""")' % s
4397 else:
4398 return 'isl.point("%s")' % s
4400 isl.isl_point_copy.restype = c_void_p
4401 isl.isl_point_copy.argtypes = [c_void_p]
4402 isl.isl_point_free.restype = c_void_p
4403 isl.isl_point_free.argtypes = [c_void_p]
4404 isl.isl_point_to_str.restype = POINTER(c_char)
4405 isl.isl_point_to_str.argtypes = [c_void_p]
4407 class schedule(object):
4408 def __init__(self, *args, **keywords):
4409 if "ptr" in keywords:
4410 self.ctx = keywords["ctx"]
4411 self.ptr = keywords["ptr"]
4412 return
4413 if len(args) == 1 and type(args[0]) == str:
4414 self.ctx = Context.getDefaultInstance()
4415 self.ptr = isl.isl_schedule_read_from_str(self.ctx, args[0].encode('ascii'))
4416 return
4417 raise Error
4418 def __del__(self):
4419 if hasattr(self, 'ptr'):
4420 isl.isl_schedule_free(self.ptr)
4421 def __str__(arg0):
4422 try:
4423 if not arg0.__class__ is schedule:
4424 arg0 = schedule(arg0)
4425 except:
4426 raise
4427 ptr = isl.isl_schedule_to_str(arg0.ptr)
4428 res = cast(ptr, c_char_p).value.decode('ascii')
4429 libc.free(ptr)
4430 return res
4431 def __repr__(self):
4432 s = str(self)
4433 if '"' in s:
4434 return 'isl.schedule("""%s""")' % s
4435 else:
4436 return 'isl.schedule("%s")' % s
4437 def get_map(arg0):
4438 try:
4439 if not arg0.__class__ is schedule:
4440 arg0 = schedule(arg0)
4441 except:
4442 raise
4443 ctx = arg0.ctx
4444 res = isl.isl_schedule_get_map(arg0.ptr)
4445 return union_map(ctx=ctx, ptr=res)
4446 def get_root(arg0):
4447 try:
4448 if not arg0.__class__ is schedule:
4449 arg0 = schedule(arg0)
4450 except:
4451 raise
4452 ctx = arg0.ctx
4453 res = isl.isl_schedule_get_root(arg0.ptr)
4454 return schedule_node(ctx=ctx, ptr=res)
4455 def pullback(arg0, arg1):
4456 if arg1.__class__ is union_pw_multi_aff:
4457 res = isl.isl_schedule_pullback_union_pw_multi_aff(isl.isl_schedule_copy(arg0.ptr), isl.isl_union_pw_multi_aff_copy(arg1.ptr))
4458 return schedule(ctx=arg0.ctx, ptr=res)
4460 isl.isl_schedule_read_from_str.restype = c_void_p
4461 isl.isl_schedule_read_from_str.argtypes = [Context, c_char_p]
4462 isl.isl_schedule_get_map.restype = c_void_p
4463 isl.isl_schedule_get_map.argtypes = [c_void_p]
4464 isl.isl_schedule_get_root.restype = c_void_p
4465 isl.isl_schedule_get_root.argtypes = [c_void_p]
4466 isl.isl_schedule_pullback_union_pw_multi_aff.restype = c_void_p
4467 isl.isl_schedule_pullback_union_pw_multi_aff.argtypes = [c_void_p, c_void_p]
4468 isl.isl_schedule_copy.restype = c_void_p
4469 isl.isl_schedule_copy.argtypes = [c_void_p]
4470 isl.isl_schedule_free.restype = c_void_p
4471 isl.isl_schedule_free.argtypes = [c_void_p]
4472 isl.isl_schedule_to_str.restype = POINTER(c_char)
4473 isl.isl_schedule_to_str.argtypes = [c_void_p]
4475 class schedule_constraints(object):
4476 def __init__(self, *args, **keywords):
4477 if "ptr" in keywords:
4478 self.ctx = keywords["ctx"]
4479 self.ptr = keywords["ptr"]
4480 return
4481 if len(args) == 1 and type(args[0]) == str:
4482 self.ctx = Context.getDefaultInstance()
4483 self.ptr = isl.isl_schedule_constraints_read_from_str(self.ctx, args[0].encode('ascii'))
4484 return
4485 raise Error
4486 def __del__(self):
4487 if hasattr(self, 'ptr'):
4488 isl.isl_schedule_constraints_free(self.ptr)
4489 def __str__(arg0):
4490 try:
4491 if not arg0.__class__ is schedule_constraints:
4492 arg0 = schedule_constraints(arg0)
4493 except:
4494 raise
4495 ptr = isl.isl_schedule_constraints_to_str(arg0.ptr)
4496 res = cast(ptr, c_char_p).value.decode('ascii')
4497 libc.free(ptr)
4498 return res
4499 def __repr__(self):
4500 s = str(self)
4501 if '"' in s:
4502 return 'isl.schedule_constraints("""%s""")' % s
4503 else:
4504 return 'isl.schedule_constraints("%s")' % s
4505 def compute_schedule(arg0):
4506 try:
4507 if not arg0.__class__ is schedule_constraints:
4508 arg0 = schedule_constraints(arg0)
4509 except:
4510 raise
4511 ctx = arg0.ctx
4512 res = isl.isl_schedule_constraints_compute_schedule(isl.isl_schedule_constraints_copy(arg0.ptr))
4513 return schedule(ctx=ctx, ptr=res)
4514 def get_coincidence(arg0):
4515 try:
4516 if not arg0.__class__ is schedule_constraints:
4517 arg0 = schedule_constraints(arg0)
4518 except:
4519 raise
4520 ctx = arg0.ctx
4521 res = isl.isl_schedule_constraints_get_coincidence(arg0.ptr)
4522 return union_map(ctx=ctx, ptr=res)
4523 def get_conditional_validity(arg0):
4524 try:
4525 if not arg0.__class__ is schedule_constraints:
4526 arg0 = schedule_constraints(arg0)
4527 except:
4528 raise
4529 ctx = arg0.ctx
4530 res = isl.isl_schedule_constraints_get_conditional_validity(arg0.ptr)
4531 return union_map(ctx=ctx, ptr=res)
4532 def get_conditional_validity_condition(arg0):
4533 try:
4534 if not arg0.__class__ is schedule_constraints:
4535 arg0 = schedule_constraints(arg0)
4536 except:
4537 raise
4538 ctx = arg0.ctx
4539 res = isl.isl_schedule_constraints_get_conditional_validity_condition(arg0.ptr)
4540 return union_map(ctx=ctx, ptr=res)
4541 def get_context(arg0):
4542 try:
4543 if not arg0.__class__ is schedule_constraints:
4544 arg0 = schedule_constraints(arg0)
4545 except:
4546 raise
4547 ctx = arg0.ctx
4548 res = isl.isl_schedule_constraints_get_context(arg0.ptr)
4549 return set(ctx=ctx, ptr=res)
4550 def get_domain(arg0):
4551 try:
4552 if not arg0.__class__ is schedule_constraints:
4553 arg0 = schedule_constraints(arg0)
4554 except:
4555 raise
4556 ctx = arg0.ctx
4557 res = isl.isl_schedule_constraints_get_domain(arg0.ptr)
4558 return union_set(ctx=ctx, ptr=res)
4559 def get_proximity(arg0):
4560 try:
4561 if not arg0.__class__ is schedule_constraints:
4562 arg0 = schedule_constraints(arg0)
4563 except:
4564 raise
4565 ctx = arg0.ctx
4566 res = isl.isl_schedule_constraints_get_proximity(arg0.ptr)
4567 return union_map(ctx=ctx, ptr=res)
4568 def get_validity(arg0):
4569 try:
4570 if not arg0.__class__ is schedule_constraints:
4571 arg0 = schedule_constraints(arg0)
4572 except:
4573 raise
4574 ctx = arg0.ctx
4575 res = isl.isl_schedule_constraints_get_validity(arg0.ptr)
4576 return union_map(ctx=ctx, ptr=res)
4577 @staticmethod
4578 def on_domain(arg0):
4579 try:
4580 if not arg0.__class__ is union_set:
4581 arg0 = union_set(arg0)
4582 except:
4583 raise
4584 ctx = arg0.ctx
4585 res = isl.isl_schedule_constraints_on_domain(isl.isl_union_set_copy(arg0.ptr))
4586 return schedule_constraints(ctx=ctx, ptr=res)
4587 def set_coincidence(arg0, arg1):
4588 try:
4589 if not arg0.__class__ is schedule_constraints:
4590 arg0 = schedule_constraints(arg0)
4591 except:
4592 raise
4593 try:
4594 if not arg1.__class__ is union_map:
4595 arg1 = union_map(arg1)
4596 except:
4597 raise
4598 ctx = arg0.ctx
4599 res = isl.isl_schedule_constraints_set_coincidence(isl.isl_schedule_constraints_copy(arg0.ptr), isl.isl_union_map_copy(arg1.ptr))
4600 return schedule_constraints(ctx=ctx, ptr=res)
4601 def set_conditional_validity(arg0, arg1, arg2):
4602 try:
4603 if not arg0.__class__ is schedule_constraints:
4604 arg0 = schedule_constraints(arg0)
4605 except:
4606 raise
4607 try:
4608 if not arg1.__class__ is union_map:
4609 arg1 = union_map(arg1)
4610 except:
4611 raise
4612 try:
4613 if not arg2.__class__ is union_map:
4614 arg2 = union_map(arg2)
4615 except:
4616 raise
4617 ctx = arg0.ctx
4618 res = isl.isl_schedule_constraints_set_conditional_validity(isl.isl_schedule_constraints_copy(arg0.ptr), isl.isl_union_map_copy(arg1.ptr), isl.isl_union_map_copy(arg2.ptr))
4619 return schedule_constraints(ctx=ctx, ptr=res)
4620 def set_context(arg0, arg1):
4621 try:
4622 if not arg0.__class__ is schedule_constraints:
4623 arg0 = schedule_constraints(arg0)
4624 except:
4625 raise
4626 try:
4627 if not arg1.__class__ is set:
4628 arg1 = set(arg1)
4629 except:
4630 raise
4631 ctx = arg0.ctx
4632 res = isl.isl_schedule_constraints_set_context(isl.isl_schedule_constraints_copy(arg0.ptr), isl.isl_set_copy(arg1.ptr))
4633 return schedule_constraints(ctx=ctx, ptr=res)
4634 def set_proximity(arg0, arg1):
4635 try:
4636 if not arg0.__class__ is schedule_constraints:
4637 arg0 = schedule_constraints(arg0)
4638 except:
4639 raise
4640 try:
4641 if not arg1.__class__ is union_map:
4642 arg1 = union_map(arg1)
4643 except:
4644 raise
4645 ctx = arg0.ctx
4646 res = isl.isl_schedule_constraints_set_proximity(isl.isl_schedule_constraints_copy(arg0.ptr), isl.isl_union_map_copy(arg1.ptr))
4647 return schedule_constraints(ctx=ctx, ptr=res)
4648 def set_validity(arg0, arg1):
4649 try:
4650 if not arg0.__class__ is schedule_constraints:
4651 arg0 = schedule_constraints(arg0)
4652 except:
4653 raise
4654 try:
4655 if not arg1.__class__ is union_map:
4656 arg1 = union_map(arg1)
4657 except:
4658 raise
4659 ctx = arg0.ctx
4660 res = isl.isl_schedule_constraints_set_validity(isl.isl_schedule_constraints_copy(arg0.ptr), isl.isl_union_map_copy(arg1.ptr))
4661 return schedule_constraints(ctx=ctx, ptr=res)
4663 isl.isl_schedule_constraints_read_from_str.restype = c_void_p
4664 isl.isl_schedule_constraints_read_from_str.argtypes = [Context, c_char_p]
4665 isl.isl_schedule_constraints_compute_schedule.restype = c_void_p
4666 isl.isl_schedule_constraints_compute_schedule.argtypes = [c_void_p]
4667 isl.isl_schedule_constraints_get_coincidence.restype = c_void_p
4668 isl.isl_schedule_constraints_get_coincidence.argtypes = [c_void_p]
4669 isl.isl_schedule_constraints_get_conditional_validity.restype = c_void_p
4670 isl.isl_schedule_constraints_get_conditional_validity.argtypes = [c_void_p]
4671 isl.isl_schedule_constraints_get_conditional_validity_condition.restype = c_void_p
4672 isl.isl_schedule_constraints_get_conditional_validity_condition.argtypes = [c_void_p]
4673 isl.isl_schedule_constraints_get_context.restype = c_void_p
4674 isl.isl_schedule_constraints_get_context.argtypes = [c_void_p]
4675 isl.isl_schedule_constraints_get_domain.restype = c_void_p
4676 isl.isl_schedule_constraints_get_domain.argtypes = [c_void_p]
4677 isl.isl_schedule_constraints_get_proximity.restype = c_void_p
4678 isl.isl_schedule_constraints_get_proximity.argtypes = [c_void_p]
4679 isl.isl_schedule_constraints_get_validity.restype = c_void_p
4680 isl.isl_schedule_constraints_get_validity.argtypes = [c_void_p]
4681 isl.isl_schedule_constraints_on_domain.restype = c_void_p
4682 isl.isl_schedule_constraints_on_domain.argtypes = [c_void_p]
4683 isl.isl_schedule_constraints_set_coincidence.restype = c_void_p
4684 isl.isl_schedule_constraints_set_coincidence.argtypes = [c_void_p, c_void_p]
4685 isl.isl_schedule_constraints_set_conditional_validity.restype = c_void_p
4686 isl.isl_schedule_constraints_set_conditional_validity.argtypes = [c_void_p, c_void_p, c_void_p]
4687 isl.isl_schedule_constraints_set_context.restype = c_void_p
4688 isl.isl_schedule_constraints_set_context.argtypes = [c_void_p, c_void_p]
4689 isl.isl_schedule_constraints_set_proximity.restype = c_void_p
4690 isl.isl_schedule_constraints_set_proximity.argtypes = [c_void_p, c_void_p]
4691 isl.isl_schedule_constraints_set_validity.restype = c_void_p
4692 isl.isl_schedule_constraints_set_validity.argtypes = [c_void_p, c_void_p]
4693 isl.isl_schedule_constraints_copy.restype = c_void_p
4694 isl.isl_schedule_constraints_copy.argtypes = [c_void_p]
4695 isl.isl_schedule_constraints_free.restype = c_void_p
4696 isl.isl_schedule_constraints_free.argtypes = [c_void_p]
4697 isl.isl_schedule_constraints_to_str.restype = POINTER(c_char)
4698 isl.isl_schedule_constraints_to_str.argtypes = [c_void_p]
4700 class schedule_node(object):
4701 def __init__(self, *args, **keywords):
4702 if "ptr" in keywords:
4703 self.ctx = keywords["ctx"]
4704 self.ptr = keywords["ptr"]
4705 return
4706 raise Error
4707 def __del__(self):
4708 if hasattr(self, 'ptr'):
4709 isl.isl_schedule_node_free(self.ptr)
4710 def __str__(arg0):
4711 try:
4712 if not arg0.__class__ is schedule_node:
4713 arg0 = schedule_node(arg0)
4714 except:
4715 raise
4716 ptr = isl.isl_schedule_node_to_str(arg0.ptr)
4717 res = cast(ptr, c_char_p).value.decode('ascii')
4718 libc.free(ptr)
4719 return res
4720 def __repr__(self):
4721 s = str(self)
4722 if '"' in s:
4723 return 'isl.schedule_node("""%s""")' % s
4724 else:
4725 return 'isl.schedule_node("%s")' % s
4726 def band_member_get_coincident(arg0, arg1):
4727 try:
4728 if not arg0.__class__ is schedule_node:
4729 arg0 = schedule_node(arg0)
4730 except:
4731 raise
4732 ctx = arg0.ctx
4733 res = isl.isl_schedule_node_band_member_get_coincident(arg0.ptr, arg1)
4734 if res < 0:
4735 raise
4736 return bool(res)
4737 def band_member_set_coincident(arg0, arg1, arg2):
4738 try:
4739 if not arg0.__class__ is schedule_node:
4740 arg0 = schedule_node(arg0)
4741 except:
4742 raise
4743 ctx = arg0.ctx
4744 res = isl.isl_schedule_node_band_member_set_coincident(isl.isl_schedule_node_copy(arg0.ptr), arg1, arg2)
4745 return schedule_node(ctx=ctx, ptr=res)
4746 def child(arg0, arg1):
4747 try:
4748 if not arg0.__class__ is schedule_node:
4749 arg0 = schedule_node(arg0)
4750 except:
4751 raise
4752 ctx = arg0.ctx
4753 res = isl.isl_schedule_node_child(isl.isl_schedule_node_copy(arg0.ptr), arg1)
4754 return schedule_node(ctx=ctx, ptr=res)
4755 def get_prefix_schedule_multi_union_pw_aff(arg0):
4756 try:
4757 if not arg0.__class__ is schedule_node:
4758 arg0 = schedule_node(arg0)
4759 except:
4760 raise
4761 ctx = arg0.ctx
4762 res = isl.isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(arg0.ptr)
4763 return multi_union_pw_aff(ctx=ctx, ptr=res)
4764 def get_prefix_schedule_union_map(arg0):
4765 try:
4766 if not arg0.__class__ is schedule_node:
4767 arg0 = schedule_node(arg0)
4768 except:
4769 raise
4770 ctx = arg0.ctx
4771 res = isl.isl_schedule_node_get_prefix_schedule_union_map(arg0.ptr)
4772 return union_map(ctx=ctx, ptr=res)
4773 def get_prefix_schedule_union_pw_multi_aff(arg0):
4774 try:
4775 if not arg0.__class__ is schedule_node:
4776 arg0 = schedule_node(arg0)
4777 except:
4778 raise
4779 ctx = arg0.ctx
4780 res = isl.isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(arg0.ptr)
4781 return union_pw_multi_aff(ctx=ctx, ptr=res)
4782 def get_schedule(arg0):
4783 try:
4784 if not arg0.__class__ is schedule_node:
4785 arg0 = schedule_node(arg0)
4786 except:
4787 raise
4788 ctx = arg0.ctx
4789 res = isl.isl_schedule_node_get_schedule(arg0.ptr)
4790 return schedule(ctx=ctx, ptr=res)
4791 def parent(arg0):
4792 try:
4793 if not arg0.__class__ is schedule_node:
4794 arg0 = schedule_node(arg0)
4795 except:
4796 raise
4797 ctx = arg0.ctx
4798 res = isl.isl_schedule_node_parent(isl.isl_schedule_node_copy(arg0.ptr))
4799 return schedule_node(ctx=ctx, ptr=res)
4801 isl.isl_schedule_node_band_member_get_coincident.restype = c_bool
4802 isl.isl_schedule_node_band_member_get_coincident.argtypes = [c_void_p, c_int]
4803 isl.isl_schedule_node_band_member_set_coincident.restype = c_void_p
4804 isl.isl_schedule_node_band_member_set_coincident.argtypes = [c_void_p, c_int, c_int]
4805 isl.isl_schedule_node_child.restype = c_void_p
4806 isl.isl_schedule_node_child.argtypes = [c_void_p, c_int]
4807 isl.isl_schedule_node_get_prefix_schedule_multi_union_pw_aff.restype = c_void_p
4808 isl.isl_schedule_node_get_prefix_schedule_multi_union_pw_aff.argtypes = [c_void_p]
4809 isl.isl_schedule_node_get_prefix_schedule_union_map.restype = c_void_p
4810 isl.isl_schedule_node_get_prefix_schedule_union_map.argtypes = [c_void_p]
4811 isl.isl_schedule_node_get_prefix_schedule_union_pw_multi_aff.restype = c_void_p
4812 isl.isl_schedule_node_get_prefix_schedule_union_pw_multi_aff.argtypes = [c_void_p]
4813 isl.isl_schedule_node_get_schedule.restype = c_void_p
4814 isl.isl_schedule_node_get_schedule.argtypes = [c_void_p]
4815 isl.isl_schedule_node_parent.restype = c_void_p
4816 isl.isl_schedule_node_parent.argtypes = [c_void_p]
4817 isl.isl_schedule_node_copy.restype = c_void_p
4818 isl.isl_schedule_node_copy.argtypes = [c_void_p]
4819 isl.isl_schedule_node_free.restype = c_void_p
4820 isl.isl_schedule_node_free.argtypes = [c_void_p]
4821 isl.isl_schedule_node_to_str.restype = POINTER(c_char)
4822 isl.isl_schedule_node_to_str.argtypes = [c_void_p]
4824 class union_access_info(object):
4825 def __init__(self, *args, **keywords):
4826 if "ptr" in keywords:
4827 self.ctx = keywords["ctx"]
4828 self.ptr = keywords["ptr"]
4829 return
4830 if len(args) == 1 and args[0].__class__ is union_map:
4831 self.ctx = Context.getDefaultInstance()
4832 self.ptr = isl.isl_union_access_info_from_sink(isl.isl_union_map_copy(args[0].ptr))
4833 return
4834 raise Error
4835 def __del__(self):
4836 if hasattr(self, 'ptr'):
4837 isl.isl_union_access_info_free(self.ptr)
4838 def __str__(arg0):
4839 try:
4840 if not arg0.__class__ is union_access_info:
4841 arg0 = union_access_info(arg0)
4842 except:
4843 raise
4844 ptr = isl.isl_union_access_info_to_str(arg0.ptr)
4845 res = cast(ptr, c_char_p).value.decode('ascii')
4846 libc.free(ptr)
4847 return res
4848 def __repr__(self):
4849 s = str(self)
4850 if '"' in s:
4851 return 'isl.union_access_info("""%s""")' % s
4852 else:
4853 return 'isl.union_access_info("%s")' % s
4854 def compute_flow(arg0):
4855 try:
4856 if not arg0.__class__ is union_access_info:
4857 arg0 = union_access_info(arg0)
4858 except:
4859 raise
4860 ctx = arg0.ctx
4861 res = isl.isl_union_access_info_compute_flow(isl.isl_union_access_info_copy(arg0.ptr))
4862 return union_flow(ctx=ctx, ptr=res)
4863 def set_kill(arg0, arg1):
4864 try:
4865 if not arg0.__class__ is union_access_info:
4866 arg0 = union_access_info(arg0)
4867 except:
4868 raise
4869 try:
4870 if not arg1.__class__ is union_map:
4871 arg1 = union_map(arg1)
4872 except:
4873 raise
4874 ctx = arg0.ctx
4875 res = isl.isl_union_access_info_set_kill(isl.isl_union_access_info_copy(arg0.ptr), isl.isl_union_map_copy(arg1.ptr))
4876 return union_access_info(ctx=ctx, ptr=res)
4877 def set_may_source(arg0, arg1):
4878 try:
4879 if not arg0.__class__ is union_access_info:
4880 arg0 = union_access_info(arg0)
4881 except:
4882 raise
4883 try:
4884 if not arg1.__class__ is union_map:
4885 arg1 = union_map(arg1)
4886 except:
4887 raise
4888 ctx = arg0.ctx
4889 res = isl.isl_union_access_info_set_may_source(isl.isl_union_access_info_copy(arg0.ptr), isl.isl_union_map_copy(arg1.ptr))
4890 return union_access_info(ctx=ctx, ptr=res)
4891 def set_must_source(arg0, arg1):
4892 try:
4893 if not arg0.__class__ is union_access_info:
4894 arg0 = union_access_info(arg0)
4895 except:
4896 raise
4897 try:
4898 if not arg1.__class__ is union_map:
4899 arg1 = union_map(arg1)
4900 except:
4901 raise
4902 ctx = arg0.ctx
4903 res = isl.isl_union_access_info_set_must_source(isl.isl_union_access_info_copy(arg0.ptr), isl.isl_union_map_copy(arg1.ptr))
4904 return union_access_info(ctx=ctx, ptr=res)
4905 def set_schedule(arg0, arg1):
4906 try:
4907 if not arg0.__class__ is union_access_info:
4908 arg0 = union_access_info(arg0)
4909 except:
4910 raise
4911 try:
4912 if not arg1.__class__ is schedule:
4913 arg1 = schedule(arg1)
4914 except:
4915 raise
4916 ctx = arg0.ctx
4917 res = isl.isl_union_access_info_set_schedule(isl.isl_union_access_info_copy(arg0.ptr), isl.isl_schedule_copy(arg1.ptr))
4918 return union_access_info(ctx=ctx, ptr=res)
4919 def set_schedule_map(arg0, arg1):
4920 try:
4921 if not arg0.__class__ is union_access_info:
4922 arg0 = union_access_info(arg0)
4923 except:
4924 raise
4925 try:
4926 if not arg1.__class__ is union_map:
4927 arg1 = union_map(arg1)
4928 except:
4929 raise
4930 ctx = arg0.ctx
4931 res = isl.isl_union_access_info_set_schedule_map(isl.isl_union_access_info_copy(arg0.ptr), isl.isl_union_map_copy(arg1.ptr))
4932 return union_access_info(ctx=ctx, ptr=res)
4934 isl.isl_union_access_info_from_sink.restype = c_void_p
4935 isl.isl_union_access_info_from_sink.argtypes = [c_void_p]
4936 isl.isl_union_access_info_compute_flow.restype = c_void_p
4937 isl.isl_union_access_info_compute_flow.argtypes = [c_void_p]
4938 isl.isl_union_access_info_set_kill.restype = c_void_p
4939 isl.isl_union_access_info_set_kill.argtypes = [c_void_p, c_void_p]
4940 isl.isl_union_access_info_set_may_source.restype = c_void_p
4941 isl.isl_union_access_info_set_may_source.argtypes = [c_void_p, c_void_p]
4942 isl.isl_union_access_info_set_must_source.restype = c_void_p
4943 isl.isl_union_access_info_set_must_source.argtypes = [c_void_p, c_void_p]
4944 isl.isl_union_access_info_set_schedule.restype = c_void_p
4945 isl.isl_union_access_info_set_schedule.argtypes = [c_void_p, c_void_p]
4946 isl.isl_union_access_info_set_schedule_map.restype = c_void_p
4947 isl.isl_union_access_info_set_schedule_map.argtypes = [c_void_p, c_void_p]
4948 isl.isl_union_access_info_copy.restype = c_void_p
4949 isl.isl_union_access_info_copy.argtypes = [c_void_p]
4950 isl.isl_union_access_info_free.restype = c_void_p
4951 isl.isl_union_access_info_free.argtypes = [c_void_p]
4952 isl.isl_union_access_info_to_str.restype = POINTER(c_char)
4953 isl.isl_union_access_info_to_str.argtypes = [c_void_p]
4955 class union_flow(object):
4956 def __init__(self, *args, **keywords):
4957 if "ptr" in keywords:
4958 self.ctx = keywords["ctx"]
4959 self.ptr = keywords["ptr"]
4960 return
4961 raise Error
4962 def __del__(self):
4963 if hasattr(self, 'ptr'):
4964 isl.isl_union_flow_free(self.ptr)
4965 def __str__(arg0):
4966 try:
4967 if not arg0.__class__ is union_flow:
4968 arg0 = union_flow(arg0)
4969 except:
4970 raise
4971 ptr = isl.isl_union_flow_to_str(arg0.ptr)
4972 res = cast(ptr, c_char_p).value.decode('ascii')
4973 libc.free(ptr)
4974 return res
4975 def __repr__(self):
4976 s = str(self)
4977 if '"' in s:
4978 return 'isl.union_flow("""%s""")' % s
4979 else:
4980 return 'isl.union_flow("%s")' % s
4981 def get_full_may_dependence(arg0):
4982 try:
4983 if not arg0.__class__ is union_flow:
4984 arg0 = union_flow(arg0)
4985 except:
4986 raise
4987 ctx = arg0.ctx
4988 res = isl.isl_union_flow_get_full_may_dependence(arg0.ptr)
4989 return union_map(ctx=ctx, ptr=res)
4990 def get_full_must_dependence(arg0):
4991 try:
4992 if not arg0.__class__ is union_flow:
4993 arg0 = union_flow(arg0)
4994 except:
4995 raise
4996 ctx = arg0.ctx
4997 res = isl.isl_union_flow_get_full_must_dependence(arg0.ptr)
4998 return union_map(ctx=ctx, ptr=res)
4999 def get_may_dependence(arg0):
5000 try:
5001 if not arg0.__class__ is union_flow:
5002 arg0 = union_flow(arg0)
5003 except:
5004 raise
5005 ctx = arg0.ctx
5006 res = isl.isl_union_flow_get_may_dependence(arg0.ptr)
5007 return union_map(ctx=ctx, ptr=res)
5008 def get_may_no_source(arg0):
5009 try:
5010 if not arg0.__class__ is union_flow:
5011 arg0 = union_flow(arg0)
5012 except:
5013 raise
5014 ctx = arg0.ctx
5015 res = isl.isl_union_flow_get_may_no_source(arg0.ptr)
5016 return union_map(ctx=ctx, ptr=res)
5017 def get_must_dependence(arg0):
5018 try:
5019 if not arg0.__class__ is union_flow:
5020 arg0 = union_flow(arg0)
5021 except:
5022 raise
5023 ctx = arg0.ctx
5024 res = isl.isl_union_flow_get_must_dependence(arg0.ptr)
5025 return union_map(ctx=ctx, ptr=res)
5026 def get_must_no_source(arg0):
5027 try:
5028 if not arg0.__class__ is union_flow:
5029 arg0 = union_flow(arg0)
5030 except:
5031 raise
5032 ctx = arg0.ctx
5033 res = isl.isl_union_flow_get_must_no_source(arg0.ptr)
5034 return union_map(ctx=ctx, ptr=res)
5036 isl.isl_union_flow_get_full_may_dependence.restype = c_void_p
5037 isl.isl_union_flow_get_full_may_dependence.argtypes = [c_void_p]
5038 isl.isl_union_flow_get_full_must_dependence.restype = c_void_p
5039 isl.isl_union_flow_get_full_must_dependence.argtypes = [c_void_p]
5040 isl.isl_union_flow_get_may_dependence.restype = c_void_p
5041 isl.isl_union_flow_get_may_dependence.argtypes = [c_void_p]
5042 isl.isl_union_flow_get_may_no_source.restype = c_void_p
5043 isl.isl_union_flow_get_may_no_source.argtypes = [c_void_p]
5044 isl.isl_union_flow_get_must_dependence.restype = c_void_p
5045 isl.isl_union_flow_get_must_dependence.argtypes = [c_void_p]
5046 isl.isl_union_flow_get_must_no_source.restype = c_void_p
5047 isl.isl_union_flow_get_must_no_source.argtypes = [c_void_p]
5048 isl.isl_union_flow_copy.restype = c_void_p
5049 isl.isl_union_flow_copy.argtypes = [c_void_p]
5050 isl.isl_union_flow_free.restype = c_void_p
5051 isl.isl_union_flow_free.argtypes = [c_void_p]
5052 isl.isl_union_flow_to_str.restype = POINTER(c_char)
5053 isl.isl_union_flow_to_str.argtypes = [c_void_p]
5055 class val(object):
5056 def __init__(self, *args, **keywords):
5057 if "ptr" in keywords:
5058 self.ctx = keywords["ctx"]
5059 self.ptr = keywords["ptr"]
5060 return
5061 if len(args) == 1 and type(args[0]) == str:
5062 self.ctx = Context.getDefaultInstance()
5063 self.ptr = isl.isl_val_read_from_str(self.ctx, args[0].encode('ascii'))
5064 return
5065 if len(args) == 1 and type(args[0]) == int:
5066 self.ctx = Context.getDefaultInstance()
5067 self.ptr = isl.isl_val_int_from_si(self.ctx, args[0])
5068 return
5069 raise Error
5070 def __del__(self):
5071 if hasattr(self, 'ptr'):
5072 isl.isl_val_free(self.ptr)
5073 def __str__(arg0):
5074 try:
5075 if not arg0.__class__ is val:
5076 arg0 = val(arg0)
5077 except:
5078 raise
5079 ptr = isl.isl_val_to_str(arg0.ptr)
5080 res = cast(ptr, c_char_p).value.decode('ascii')
5081 libc.free(ptr)
5082 return res
5083 def __repr__(self):
5084 s = str(self)
5085 if '"' in s:
5086 return 'isl.val("""%s""")' % s
5087 else:
5088 return 'isl.val("%s")' % s
5089 def abs(arg0):
5090 try:
5091 if not arg0.__class__ is val:
5092 arg0 = val(arg0)
5093 except:
5094 raise
5095 ctx = arg0.ctx
5096 res = isl.isl_val_abs(isl.isl_val_copy(arg0.ptr))
5097 return val(ctx=ctx, ptr=res)
5098 def abs_eq(arg0, arg1):
5099 try:
5100 if not arg0.__class__ is val:
5101 arg0 = val(arg0)
5102 except:
5103 raise
5104 try:
5105 if not arg1.__class__ is val:
5106 arg1 = val(arg1)
5107 except:
5108 raise
5109 ctx = arg0.ctx
5110 res = isl.isl_val_abs_eq(arg0.ptr, arg1.ptr)
5111 if res < 0:
5112 raise
5113 return bool(res)
5114 def add(arg0, arg1):
5115 try:
5116 if not arg0.__class__ is val:
5117 arg0 = val(arg0)
5118 except:
5119 raise
5120 try:
5121 if not arg1.__class__ is val:
5122 arg1 = val(arg1)
5123 except:
5124 raise
5125 ctx = arg0.ctx
5126 res = isl.isl_val_add(isl.isl_val_copy(arg0.ptr), isl.isl_val_copy(arg1.ptr))
5127 return val(ctx=ctx, ptr=res)
5128 def ceil(arg0):
5129 try:
5130 if not arg0.__class__ is val:
5131 arg0 = val(arg0)
5132 except:
5133 raise
5134 ctx = arg0.ctx
5135 res = isl.isl_val_ceil(isl.isl_val_copy(arg0.ptr))
5136 return val(ctx=ctx, ptr=res)
5137 def cmp_si(arg0, arg1):
5138 try:
5139 if not arg0.__class__ is val:
5140 arg0 = val(arg0)
5141 except:
5142 raise
5143 ctx = arg0.ctx
5144 res = isl.isl_val_cmp_si(arg0.ptr, arg1)
5145 return res
5146 def div(arg0, arg1):
5147 try:
5148 if not arg0.__class__ is val:
5149 arg0 = val(arg0)
5150 except:
5151 raise
5152 try:
5153 if not arg1.__class__ is val:
5154 arg1 = val(arg1)
5155 except:
5156 raise
5157 ctx = arg0.ctx
5158 res = isl.isl_val_div(isl.isl_val_copy(arg0.ptr), isl.isl_val_copy(arg1.ptr))
5159 return val(ctx=ctx, ptr=res)
5160 def eq(arg0, arg1):
5161 try:
5162 if not arg0.__class__ is val:
5163 arg0 = val(arg0)
5164 except:
5165 raise
5166 try:
5167 if not arg1.__class__ is val:
5168 arg1 = val(arg1)
5169 except:
5170 raise
5171 ctx = arg0.ctx
5172 res = isl.isl_val_eq(arg0.ptr, arg1.ptr)
5173 if res < 0:
5174 raise
5175 return bool(res)
5176 def floor(arg0):
5177 try:
5178 if not arg0.__class__ is val:
5179 arg0 = val(arg0)
5180 except:
5181 raise
5182 ctx = arg0.ctx
5183 res = isl.isl_val_floor(isl.isl_val_copy(arg0.ptr))
5184 return val(ctx=ctx, ptr=res)
5185 def gcd(arg0, arg1):
5186 try:
5187 if not arg0.__class__ is val:
5188 arg0 = val(arg0)
5189 except:
5190 raise
5191 try:
5192 if not arg1.__class__ is val:
5193 arg1 = val(arg1)
5194 except:
5195 raise
5196 ctx = arg0.ctx
5197 res = isl.isl_val_gcd(isl.isl_val_copy(arg0.ptr), isl.isl_val_copy(arg1.ptr))
5198 return val(ctx=ctx, ptr=res)
5199 def ge(arg0, arg1):
5200 try:
5201 if not arg0.__class__ is val:
5202 arg0 = val(arg0)
5203 except:
5204 raise
5205 try:
5206 if not arg1.__class__ is val:
5207 arg1 = val(arg1)
5208 except:
5209 raise
5210 ctx = arg0.ctx
5211 res = isl.isl_val_ge(arg0.ptr, arg1.ptr)
5212 if res < 0:
5213 raise
5214 return bool(res)
5215 def gt(arg0, arg1):
5216 try:
5217 if not arg0.__class__ is val:
5218 arg0 = val(arg0)
5219 except:
5220 raise
5221 try:
5222 if not arg1.__class__ is val:
5223 arg1 = val(arg1)
5224 except:
5225 raise
5226 ctx = arg0.ctx
5227 res = isl.isl_val_gt(arg0.ptr, arg1.ptr)
5228 if res < 0:
5229 raise
5230 return bool(res)
5231 @staticmethod
5232 def infty():
5233 ctx = Context.getDefaultInstance()
5234 res = isl.isl_val_infty(ctx)
5235 return val(ctx=ctx, ptr=res)
5236 def inv(arg0):
5237 try:
5238 if not arg0.__class__ is val:
5239 arg0 = val(arg0)
5240 except:
5241 raise
5242 ctx = arg0.ctx
5243 res = isl.isl_val_inv(isl.isl_val_copy(arg0.ptr))
5244 return val(ctx=ctx, ptr=res)
5245 def is_divisible_by(arg0, arg1):
5246 try:
5247 if not arg0.__class__ is val:
5248 arg0 = val(arg0)
5249 except:
5250 raise
5251 try:
5252 if not arg1.__class__ is val:
5253 arg1 = val(arg1)
5254 except:
5255 raise
5256 ctx = arg0.ctx
5257 res = isl.isl_val_is_divisible_by(arg0.ptr, arg1.ptr)
5258 if res < 0:
5259 raise
5260 return bool(res)
5261 def is_infty(arg0):
5262 try:
5263 if not arg0.__class__ is val:
5264 arg0 = val(arg0)
5265 except:
5266 raise
5267 ctx = arg0.ctx
5268 res = isl.isl_val_is_infty(arg0.ptr)
5269 if res < 0:
5270 raise
5271 return bool(res)
5272 def is_int(arg0):
5273 try:
5274 if not arg0.__class__ is val:
5275 arg0 = val(arg0)
5276 except:
5277 raise
5278 ctx = arg0.ctx
5279 res = isl.isl_val_is_int(arg0.ptr)
5280 if res < 0:
5281 raise
5282 return bool(res)
5283 def is_nan(arg0):
5284 try:
5285 if not arg0.__class__ is val:
5286 arg0 = val(arg0)
5287 except:
5288 raise
5289 ctx = arg0.ctx
5290 res = isl.isl_val_is_nan(arg0.ptr)
5291 if res < 0:
5292 raise
5293 return bool(res)
5294 def is_neg(arg0):
5295 try:
5296 if not arg0.__class__ is val:
5297 arg0 = val(arg0)
5298 except:
5299 raise
5300 ctx = arg0.ctx
5301 res = isl.isl_val_is_neg(arg0.ptr)
5302 if res < 0:
5303 raise
5304 return bool(res)
5305 def is_neginfty(arg0):
5306 try:
5307 if not arg0.__class__ is val:
5308 arg0 = val(arg0)
5309 except:
5310 raise
5311 ctx = arg0.ctx
5312 res = isl.isl_val_is_neginfty(arg0.ptr)
5313 if res < 0:
5314 raise
5315 return bool(res)
5316 def is_negone(arg0):
5317 try:
5318 if not arg0.__class__ is val:
5319 arg0 = val(arg0)
5320 except:
5321 raise
5322 ctx = arg0.ctx
5323 res = isl.isl_val_is_negone(arg0.ptr)
5324 if res < 0:
5325 raise
5326 return bool(res)
5327 def is_nonneg(arg0):
5328 try:
5329 if not arg0.__class__ is val:
5330 arg0 = val(arg0)
5331 except:
5332 raise
5333 ctx = arg0.ctx
5334 res = isl.isl_val_is_nonneg(arg0.ptr)
5335 if res < 0:
5336 raise
5337 return bool(res)
5338 def is_nonpos(arg0):
5339 try:
5340 if not arg0.__class__ is val:
5341 arg0 = val(arg0)
5342 except:
5343 raise
5344 ctx = arg0.ctx
5345 res = isl.isl_val_is_nonpos(arg0.ptr)
5346 if res < 0:
5347 raise
5348 return bool(res)
5349 def is_one(arg0):
5350 try:
5351 if not arg0.__class__ is val:
5352 arg0 = val(arg0)
5353 except:
5354 raise
5355 ctx = arg0.ctx
5356 res = isl.isl_val_is_one(arg0.ptr)
5357 if res < 0:
5358 raise
5359 return bool(res)
5360 def is_pos(arg0):
5361 try:
5362 if not arg0.__class__ is val:
5363 arg0 = val(arg0)
5364 except:
5365 raise
5366 ctx = arg0.ctx
5367 res = isl.isl_val_is_pos(arg0.ptr)
5368 if res < 0:
5369 raise
5370 return bool(res)
5371 def is_rat(arg0):
5372 try:
5373 if not arg0.__class__ is val:
5374 arg0 = val(arg0)
5375 except:
5376 raise
5377 ctx = arg0.ctx
5378 res = isl.isl_val_is_rat(arg0.ptr)
5379 if res < 0:
5380 raise
5381 return bool(res)
5382 def is_zero(arg0):
5383 try:
5384 if not arg0.__class__ is val:
5385 arg0 = val(arg0)
5386 except:
5387 raise
5388 ctx = arg0.ctx
5389 res = isl.isl_val_is_zero(arg0.ptr)
5390 if res < 0:
5391 raise
5392 return bool(res)
5393 def le(arg0, arg1):
5394 try:
5395 if not arg0.__class__ is val:
5396 arg0 = val(arg0)
5397 except:
5398 raise
5399 try:
5400 if not arg1.__class__ is val:
5401 arg1 = val(arg1)
5402 except:
5403 raise
5404 ctx = arg0.ctx
5405 res = isl.isl_val_le(arg0.ptr, arg1.ptr)
5406 if res < 0:
5407 raise
5408 return bool(res)
5409 def lt(arg0, arg1):
5410 try:
5411 if not arg0.__class__ is val:
5412 arg0 = val(arg0)
5413 except:
5414 raise
5415 try:
5416 if not arg1.__class__ is val:
5417 arg1 = val(arg1)
5418 except:
5419 raise
5420 ctx = arg0.ctx
5421 res = isl.isl_val_lt(arg0.ptr, arg1.ptr)
5422 if res < 0:
5423 raise
5424 return bool(res)
5425 def max(arg0, arg1):
5426 try:
5427 if not arg0.__class__ is val:
5428 arg0 = val(arg0)
5429 except:
5430 raise
5431 try:
5432 if not arg1.__class__ is val:
5433 arg1 = val(arg1)
5434 except:
5435 raise
5436 ctx = arg0.ctx
5437 res = isl.isl_val_max(isl.isl_val_copy(arg0.ptr), isl.isl_val_copy(arg1.ptr))
5438 return val(ctx=ctx, ptr=res)
5439 def min(arg0, arg1):
5440 try:
5441 if not arg0.__class__ is val:
5442 arg0 = val(arg0)
5443 except:
5444 raise
5445 try:
5446 if not arg1.__class__ is val:
5447 arg1 = val(arg1)
5448 except:
5449 raise
5450 ctx = arg0.ctx
5451 res = isl.isl_val_min(isl.isl_val_copy(arg0.ptr), isl.isl_val_copy(arg1.ptr))
5452 return val(ctx=ctx, ptr=res)
5453 def mod(arg0, arg1):
5454 try:
5455 if not arg0.__class__ is val:
5456 arg0 = val(arg0)
5457 except:
5458 raise
5459 try:
5460 if not arg1.__class__ is val:
5461 arg1 = val(arg1)
5462 except:
5463 raise
5464 ctx = arg0.ctx
5465 res = isl.isl_val_mod(isl.isl_val_copy(arg0.ptr), isl.isl_val_copy(arg1.ptr))
5466 return val(ctx=ctx, ptr=res)
5467 def mul(arg0, arg1):
5468 try:
5469 if not arg0.__class__ is val:
5470 arg0 = val(arg0)
5471 except:
5472 raise
5473 try:
5474 if not arg1.__class__ is val:
5475 arg1 = val(arg1)
5476 except:
5477 raise
5478 ctx = arg0.ctx
5479 res = isl.isl_val_mul(isl.isl_val_copy(arg0.ptr), isl.isl_val_copy(arg1.ptr))
5480 return val(ctx=ctx, ptr=res)
5481 @staticmethod
5482 def nan():
5483 ctx = Context.getDefaultInstance()
5484 res = isl.isl_val_nan(ctx)
5485 return val(ctx=ctx, ptr=res)
5486 def ne(arg0, arg1):
5487 try:
5488 if not arg0.__class__ is val:
5489 arg0 = val(arg0)
5490 except:
5491 raise
5492 try:
5493 if not arg1.__class__ is val:
5494 arg1 = val(arg1)
5495 except:
5496 raise
5497 ctx = arg0.ctx
5498 res = isl.isl_val_ne(arg0.ptr, arg1.ptr)
5499 if res < 0:
5500 raise
5501 return bool(res)
5502 def neg(arg0):
5503 try:
5504 if not arg0.__class__ is val:
5505 arg0 = val(arg0)
5506 except:
5507 raise
5508 ctx = arg0.ctx
5509 res = isl.isl_val_neg(isl.isl_val_copy(arg0.ptr))
5510 return val(ctx=ctx, ptr=res)
5511 @staticmethod
5512 def neginfty():
5513 ctx = Context.getDefaultInstance()
5514 res = isl.isl_val_neginfty(ctx)
5515 return val(ctx=ctx, ptr=res)
5516 @staticmethod
5517 def negone():
5518 ctx = Context.getDefaultInstance()
5519 res = isl.isl_val_negone(ctx)
5520 return val(ctx=ctx, ptr=res)
5521 @staticmethod
5522 def one():
5523 ctx = Context.getDefaultInstance()
5524 res = isl.isl_val_one(ctx)
5525 return val(ctx=ctx, ptr=res)
5526 def sgn(arg0):
5527 try:
5528 if not arg0.__class__ is val:
5529 arg0 = val(arg0)
5530 except:
5531 raise
5532 ctx = arg0.ctx
5533 res = isl.isl_val_sgn(arg0.ptr)
5534 return res
5535 def sub(arg0, arg1):
5536 try:
5537 if not arg0.__class__ is val:
5538 arg0 = val(arg0)
5539 except:
5540 raise
5541 try:
5542 if not arg1.__class__ is val:
5543 arg1 = val(arg1)
5544 except:
5545 raise
5546 ctx = arg0.ctx
5547 res = isl.isl_val_sub(isl.isl_val_copy(arg0.ptr), isl.isl_val_copy(arg1.ptr))
5548 return val(ctx=ctx, ptr=res)
5549 def trunc(arg0):
5550 try:
5551 if not arg0.__class__ is val:
5552 arg0 = val(arg0)
5553 except:
5554 raise
5555 ctx = arg0.ctx
5556 res = isl.isl_val_trunc(isl.isl_val_copy(arg0.ptr))
5557 return val(ctx=ctx, ptr=res)
5558 @staticmethod
5559 def zero():
5560 ctx = Context.getDefaultInstance()
5561 res = isl.isl_val_zero(ctx)
5562 return val(ctx=ctx, ptr=res)
5564 isl.isl_val_read_from_str.restype = c_void_p
5565 isl.isl_val_read_from_str.argtypes = [Context, c_char_p]
5566 isl.isl_val_int_from_si.restype = c_void_p
5567 isl.isl_val_int_from_si.argtypes = [Context, c_long]
5568 isl.isl_val_abs.restype = c_void_p
5569 isl.isl_val_abs.argtypes = [c_void_p]
5570 isl.isl_val_abs_eq.restype = c_bool
5571 isl.isl_val_abs_eq.argtypes = [c_void_p, c_void_p]
5572 isl.isl_val_add.restype = c_void_p
5573 isl.isl_val_add.argtypes = [c_void_p, c_void_p]
5574 isl.isl_val_ceil.restype = c_void_p
5575 isl.isl_val_ceil.argtypes = [c_void_p]
5576 isl.isl_val_cmp_si.argtypes = [c_void_p, c_long]
5577 isl.isl_val_div.restype = c_void_p
5578 isl.isl_val_div.argtypes = [c_void_p, c_void_p]
5579 isl.isl_val_eq.restype = c_bool
5580 isl.isl_val_eq.argtypes = [c_void_p, c_void_p]
5581 isl.isl_val_floor.restype = c_void_p
5582 isl.isl_val_floor.argtypes = [c_void_p]
5583 isl.isl_val_gcd.restype = c_void_p
5584 isl.isl_val_gcd.argtypes = [c_void_p, c_void_p]
5585 isl.isl_val_ge.restype = c_bool
5586 isl.isl_val_ge.argtypes = [c_void_p, c_void_p]
5587 isl.isl_val_gt.restype = c_bool
5588 isl.isl_val_gt.argtypes = [c_void_p, c_void_p]
5589 isl.isl_val_infty.restype = c_void_p
5590 isl.isl_val_infty.argtypes = [Context]
5591 isl.isl_val_inv.restype = c_void_p
5592 isl.isl_val_inv.argtypes = [c_void_p]
5593 isl.isl_val_is_divisible_by.restype = c_bool
5594 isl.isl_val_is_divisible_by.argtypes = [c_void_p, c_void_p]
5595 isl.isl_val_is_infty.restype = c_bool
5596 isl.isl_val_is_infty.argtypes = [c_void_p]
5597 isl.isl_val_is_int.restype = c_bool
5598 isl.isl_val_is_int.argtypes = [c_void_p]
5599 isl.isl_val_is_nan.restype = c_bool
5600 isl.isl_val_is_nan.argtypes = [c_void_p]
5601 isl.isl_val_is_neg.restype = c_bool
5602 isl.isl_val_is_neg.argtypes = [c_void_p]
5603 isl.isl_val_is_neginfty.restype = c_bool
5604 isl.isl_val_is_neginfty.argtypes = [c_void_p]
5605 isl.isl_val_is_negone.restype = c_bool
5606 isl.isl_val_is_negone.argtypes = [c_void_p]
5607 isl.isl_val_is_nonneg.restype = c_bool
5608 isl.isl_val_is_nonneg.argtypes = [c_void_p]
5609 isl.isl_val_is_nonpos.restype = c_bool
5610 isl.isl_val_is_nonpos.argtypes = [c_void_p]
5611 isl.isl_val_is_one.restype = c_bool
5612 isl.isl_val_is_one.argtypes = [c_void_p]
5613 isl.isl_val_is_pos.restype = c_bool
5614 isl.isl_val_is_pos.argtypes = [c_void_p]
5615 isl.isl_val_is_rat.restype = c_bool
5616 isl.isl_val_is_rat.argtypes = [c_void_p]
5617 isl.isl_val_is_zero.restype = c_bool
5618 isl.isl_val_is_zero.argtypes = [c_void_p]
5619 isl.isl_val_le.restype = c_bool
5620 isl.isl_val_le.argtypes = [c_void_p, c_void_p]
5621 isl.isl_val_lt.restype = c_bool
5622 isl.isl_val_lt.argtypes = [c_void_p, c_void_p]
5623 isl.isl_val_max.restype = c_void_p
5624 isl.isl_val_max.argtypes = [c_void_p, c_void_p]
5625 isl.isl_val_min.restype = c_void_p
5626 isl.isl_val_min.argtypes = [c_void_p, c_void_p]
5627 isl.isl_val_mod.restype = c_void_p
5628 isl.isl_val_mod.argtypes = [c_void_p, c_void_p]
5629 isl.isl_val_mul.restype = c_void_p
5630 isl.isl_val_mul.argtypes = [c_void_p, c_void_p]
5631 isl.isl_val_nan.restype = c_void_p
5632 isl.isl_val_nan.argtypes = [Context]
5633 isl.isl_val_ne.restype = c_bool
5634 isl.isl_val_ne.argtypes = [c_void_p, c_void_p]
5635 isl.isl_val_neg.restype = c_void_p
5636 isl.isl_val_neg.argtypes = [c_void_p]
5637 isl.isl_val_neginfty.restype = c_void_p
5638 isl.isl_val_neginfty.argtypes = [Context]
5639 isl.isl_val_negone.restype = c_void_p
5640 isl.isl_val_negone.argtypes = [Context]
5641 isl.isl_val_one.restype = c_void_p
5642 isl.isl_val_one.argtypes = [Context]
5643 isl.isl_val_sgn.argtypes = [c_void_p]
5644 isl.isl_val_sub.restype = c_void_p
5645 isl.isl_val_sub.argtypes = [c_void_p, c_void_p]
5646 isl.isl_val_trunc.restype = c_void_p
5647 isl.isl_val_trunc.argtypes = [c_void_p]
5648 isl.isl_val_zero.restype = c_void_p
5649 isl.isl_val_zero.argtypes = [Context]
5650 isl.isl_val_copy.restype = c_void_p
5651 isl.isl_val_copy.argtypes = [c_void_p]
5652 isl.isl_val_free.restype = c_void_p
5653 isl.isl_val_free.argtypes = [c_void_p]
5654 isl.isl_val_to_str.restype = POINTER(c_char)
5655 isl.isl_val_to_str.argtypes = [c_void_p]