1use crate::bindings::{Context, Val, Vec};
5use libc::uintptr_t;
6
7pub struct Mat {
9 pub ptr: uintptr_t,
10 pub should_free_on_drop: bool,
11}
12
13extern "C" {
14
15 fn isl_mat_get_ctx(mat: uintptr_t) -> uintptr_t;
16
17 fn isl_mat_alloc(ctx: uintptr_t, n_row: u32, n_col: u32) -> uintptr_t;
18
19 fn isl_mat_extend(mat: uintptr_t, n_row: u32, n_col: u32) -> uintptr_t;
20
21 fn isl_mat_identity(ctx: uintptr_t, n_row: u32) -> uintptr_t;
22
23 fn isl_mat_copy(mat: uintptr_t) -> uintptr_t;
24
25 fn isl_mat_free(mat: uintptr_t) -> uintptr_t;
26
27 fn isl_mat_rows(mat: uintptr_t) -> i32;
28
29 fn isl_mat_cols(mat: uintptr_t) -> i32;
30
31 fn isl_mat_get_element_val(mat: uintptr_t, row: i32, col: i32) -> uintptr_t;
32
33 fn isl_mat_set_element_si(mat: uintptr_t, row: i32, col: i32, v: i32) -> uintptr_t;
34
35 fn isl_mat_set_element_val(mat: uintptr_t, row: i32, col: i32, v: uintptr_t) -> uintptr_t;
36
37 fn isl_mat_swap_cols(mat: uintptr_t, i: u32, j: u32) -> uintptr_t;
38
39 fn isl_mat_swap_rows(mat: uintptr_t, i: u32, j: u32) -> uintptr_t;
40
41 fn isl_mat_vec_product(mat: uintptr_t, vec: uintptr_t) -> uintptr_t;
42
43 fn isl_mat_vec_inverse_product(mat: uintptr_t, vec: uintptr_t) -> uintptr_t;
44
45 fn isl_mat_aff_direct_sum(left: uintptr_t, right: uintptr_t) -> uintptr_t;
46
47 fn isl_mat_diagonal(mat1: uintptr_t, mat2: uintptr_t) -> uintptr_t;
48
49 fn isl_mat_lin_to_aff(mat: uintptr_t) -> uintptr_t;
50
51 fn isl_mat_inverse_product(left: uintptr_t, right: uintptr_t) -> uintptr_t;
52
53 fn isl_mat_product(left: uintptr_t, right: uintptr_t) -> uintptr_t;
54
55 fn isl_mat_transpose(mat: uintptr_t) -> uintptr_t;
56
57 fn isl_mat_right_inverse(mat: uintptr_t) -> uintptr_t;
58
59 fn isl_mat_right_kernel(mat: uintptr_t) -> uintptr_t;
60
61 fn isl_mat_normalize(mat: uintptr_t) -> uintptr_t;
62
63 fn isl_mat_normalize_row(mat: uintptr_t, row: i32) -> uintptr_t;
64
65 fn isl_mat_drop_cols(mat: uintptr_t, col: u32, n: u32) -> uintptr_t;
66
67 fn isl_mat_drop_rows(mat: uintptr_t, row: u32, n: u32) -> uintptr_t;
68
69 fn isl_mat_insert_cols(mat: uintptr_t, col: u32, n: u32) -> uintptr_t;
70
71 fn isl_mat_insert_rows(mat: uintptr_t, row: u32, n: u32) -> uintptr_t;
72
73 fn isl_mat_move_cols(mat: uintptr_t, dst_col: u32, src_col: u32, n: u32) -> uintptr_t;
74
75 fn isl_mat_add_rows(mat: uintptr_t, n: u32) -> uintptr_t;
76
77 fn isl_mat_insert_zero_cols(mat: uintptr_t, first: u32, n: u32) -> uintptr_t;
78
79 fn isl_mat_add_zero_cols(mat: uintptr_t, n: u32) -> uintptr_t;
80
81 fn isl_mat_insert_zero_rows(mat: uintptr_t, row: u32, n: u32) -> uintptr_t;
82
83 fn isl_mat_add_zero_rows(mat: uintptr_t, n: u32) -> uintptr_t;
84
85 fn isl_mat_col_add(mat: uintptr_t, dst_col: i32, src_col: i32);
86
87 fn isl_mat_unimodular_complete(M: uintptr_t, row: i32) -> uintptr_t;
88
89 fn isl_mat_row_basis(mat: uintptr_t) -> uintptr_t;
90
91 fn isl_mat_row_basis_extension(mat1: uintptr_t, mat2: uintptr_t) -> uintptr_t;
92
93 fn isl_mat_from_row_vec(vec: uintptr_t) -> uintptr_t;
94
95 fn isl_mat_concat(top: uintptr_t, bot: uintptr_t) -> uintptr_t;
96
97 fn isl_mat_vec_concat(top: uintptr_t, bot: uintptr_t) -> uintptr_t;
98
99 fn isl_mat_is_equal(mat1: uintptr_t, mat2: uintptr_t) -> i32;
100
101 fn isl_mat_has_linearly_independent_rows(mat1: uintptr_t, mat2: uintptr_t) -> i32;
102
103 fn isl_mat_rank(mat: uintptr_t) -> i32;
104
105 fn isl_mat_initial_non_zero_cols(mat: uintptr_t) -> i32;
106
107 fn isl_mat_dump(mat: uintptr_t);
108
109}
110
111impl Mat {
112 pub fn get_ctx(&self) -> Context {
114 let mat = self;
115 let mat = mat.ptr;
116 let isl_rs_result = unsafe { isl_mat_get_ctx(mat) };
117 let isl_rs_result = Context { ptr: isl_rs_result,
118 should_free_on_drop: true };
119 let mut isl_rs_result = isl_rs_result;
120 isl_rs_result.do_not_free_on_drop();
121 isl_rs_result
122 }
123
124 pub fn alloc(ctx: &Context, n_row: u32, n_col: u32) -> Mat {
126 let ctx = ctx.ptr;
127 let isl_rs_result = unsafe { isl_mat_alloc(ctx, n_row, n_col) };
128 let isl_rs_result = Mat { ptr: isl_rs_result,
129 should_free_on_drop: true };
130 isl_rs_result
131 }
132
133 pub fn extend(self, n_row: u32, n_col: u32) -> Mat {
135 let mat = self;
136 let mut mat = mat;
137 mat.do_not_free_on_drop();
138 let mat = mat.ptr;
139 let isl_rs_result = unsafe { isl_mat_extend(mat, n_row, n_col) };
140 let isl_rs_result = Mat { ptr: isl_rs_result,
141 should_free_on_drop: true };
142 isl_rs_result
143 }
144
145 pub fn identity(ctx: &Context, n_row: u32) -> Mat {
147 let ctx = ctx.ptr;
148 let isl_rs_result = unsafe { isl_mat_identity(ctx, n_row) };
149 let isl_rs_result = Mat { ptr: isl_rs_result,
150 should_free_on_drop: true };
151 isl_rs_result
152 }
153
154 pub fn copy(&self) -> Mat {
156 let mat = self;
157 let mat = mat.ptr;
158 let isl_rs_result = unsafe { isl_mat_copy(mat) };
159 let isl_rs_result = Mat { ptr: isl_rs_result,
160 should_free_on_drop: true };
161 isl_rs_result
162 }
163
164 pub fn free(self) -> Mat {
166 let mat = self;
167 let mut mat = mat;
168 mat.do_not_free_on_drop();
169 let mat = mat.ptr;
170 let isl_rs_result = unsafe { isl_mat_free(mat) };
171 let isl_rs_result = Mat { ptr: isl_rs_result,
172 should_free_on_drop: true };
173 isl_rs_result
174 }
175
176 pub fn rows(&self) -> i32 {
178 let mat = self;
179 let mat = mat.ptr;
180 let isl_rs_result = unsafe { isl_mat_rows(mat) };
181 isl_rs_result
182 }
183
184 pub fn cols(&self) -> i32 {
186 let mat = self;
187 let mat = mat.ptr;
188 let isl_rs_result = unsafe { isl_mat_cols(mat) };
189 isl_rs_result
190 }
191
192 pub fn get_element_val(&self, row: i32, col: i32) -> Val {
194 let mat = self;
195 let mat = mat.ptr;
196 let isl_rs_result = unsafe { isl_mat_get_element_val(mat, row, col) };
197 let isl_rs_result = Val { ptr: isl_rs_result,
198 should_free_on_drop: true };
199 isl_rs_result
200 }
201
202 pub fn set_element_si(self, row: i32, col: i32, v: i32) -> Mat {
204 let mat = self;
205 let mut mat = mat;
206 mat.do_not_free_on_drop();
207 let mat = mat.ptr;
208 let isl_rs_result = unsafe { isl_mat_set_element_si(mat, row, col, v) };
209 let isl_rs_result = Mat { ptr: isl_rs_result,
210 should_free_on_drop: true };
211 isl_rs_result
212 }
213
214 pub fn set_element_val(self, row: i32, col: i32, v: Val) -> Mat {
216 let mat = self;
217 let mut mat = mat;
218 mat.do_not_free_on_drop();
219 let mat = mat.ptr;
220 let mut v = v;
221 v.do_not_free_on_drop();
222 let v = v.ptr;
223 let isl_rs_result = unsafe { isl_mat_set_element_val(mat, row, col, v) };
224 let isl_rs_result = Mat { ptr: isl_rs_result,
225 should_free_on_drop: true };
226 isl_rs_result
227 }
228
229 pub fn swap_cols(self, i: u32, j: u32) -> Mat {
231 let mat = self;
232 let mut mat = mat;
233 mat.do_not_free_on_drop();
234 let mat = mat.ptr;
235 let isl_rs_result = unsafe { isl_mat_swap_cols(mat, i, j) };
236 let isl_rs_result = Mat { ptr: isl_rs_result,
237 should_free_on_drop: true };
238 isl_rs_result
239 }
240
241 pub fn swap_rows(self, i: u32, j: u32) -> Mat {
243 let mat = self;
244 let mut mat = mat;
245 mat.do_not_free_on_drop();
246 let mat = mat.ptr;
247 let isl_rs_result = unsafe { isl_mat_swap_rows(mat, i, j) };
248 let isl_rs_result = Mat { ptr: isl_rs_result,
249 should_free_on_drop: true };
250 isl_rs_result
251 }
252
253 pub fn vec_product(self, vec: Vec) -> Vec {
255 let mat = self;
256 let mut mat = mat;
257 mat.do_not_free_on_drop();
258 let mat = mat.ptr;
259 let mut vec = vec;
260 vec.do_not_free_on_drop();
261 let vec = vec.ptr;
262 let isl_rs_result = unsafe { isl_mat_vec_product(mat, vec) };
263 let isl_rs_result = Vec { ptr: isl_rs_result,
264 should_free_on_drop: true };
265 isl_rs_result
266 }
267
268 pub fn vec_inverse_product(self, vec: Vec) -> Vec {
270 let mat = self;
271 let mut mat = mat;
272 mat.do_not_free_on_drop();
273 let mat = mat.ptr;
274 let mut vec = vec;
275 vec.do_not_free_on_drop();
276 let vec = vec.ptr;
277 let isl_rs_result = unsafe { isl_mat_vec_inverse_product(mat, vec) };
278 let isl_rs_result = Vec { ptr: isl_rs_result,
279 should_free_on_drop: true };
280 isl_rs_result
281 }
282
283 pub fn aff_direct_sum(self, right: Mat) -> Mat {
285 let left = self;
286 let mut left = left;
287 left.do_not_free_on_drop();
288 let left = left.ptr;
289 let mut right = right;
290 right.do_not_free_on_drop();
291 let right = right.ptr;
292 let isl_rs_result = unsafe { isl_mat_aff_direct_sum(left, right) };
293 let isl_rs_result = Mat { ptr: isl_rs_result,
294 should_free_on_drop: true };
295 isl_rs_result
296 }
297
298 pub fn diagonal(self, mat2: Mat) -> Mat {
300 let mat1 = self;
301 let mut mat1 = mat1;
302 mat1.do_not_free_on_drop();
303 let mat1 = mat1.ptr;
304 let mut mat2 = mat2;
305 mat2.do_not_free_on_drop();
306 let mat2 = mat2.ptr;
307 let isl_rs_result = unsafe { isl_mat_diagonal(mat1, mat2) };
308 let isl_rs_result = Mat { ptr: isl_rs_result,
309 should_free_on_drop: true };
310 isl_rs_result
311 }
312
313 pub fn lin_to_aff(self) -> Mat {
315 let mat = self;
316 let mut mat = mat;
317 mat.do_not_free_on_drop();
318 let mat = mat.ptr;
319 let isl_rs_result = unsafe { isl_mat_lin_to_aff(mat) };
320 let isl_rs_result = Mat { ptr: isl_rs_result,
321 should_free_on_drop: true };
322 isl_rs_result
323 }
324
325 pub fn inverse_product(self, right: Mat) -> Mat {
327 let left = self;
328 let mut left = left;
329 left.do_not_free_on_drop();
330 let left = left.ptr;
331 let mut right = right;
332 right.do_not_free_on_drop();
333 let right = right.ptr;
334 let isl_rs_result = unsafe { isl_mat_inverse_product(left, right) };
335 let isl_rs_result = Mat { ptr: isl_rs_result,
336 should_free_on_drop: true };
337 isl_rs_result
338 }
339
340 pub fn product(self, right: Mat) -> Mat {
342 let left = self;
343 let mut left = left;
344 left.do_not_free_on_drop();
345 let left = left.ptr;
346 let mut right = right;
347 right.do_not_free_on_drop();
348 let right = right.ptr;
349 let isl_rs_result = unsafe { isl_mat_product(left, right) };
350 let isl_rs_result = Mat { ptr: isl_rs_result,
351 should_free_on_drop: true };
352 isl_rs_result
353 }
354
355 pub fn transpose(self) -> Mat {
357 let mat = self;
358 let mut mat = mat;
359 mat.do_not_free_on_drop();
360 let mat = mat.ptr;
361 let isl_rs_result = unsafe { isl_mat_transpose(mat) };
362 let isl_rs_result = Mat { ptr: isl_rs_result,
363 should_free_on_drop: true };
364 isl_rs_result
365 }
366
367 pub fn right_inverse(self) -> Mat {
369 let mat = self;
370 let mut mat = mat;
371 mat.do_not_free_on_drop();
372 let mat = mat.ptr;
373 let isl_rs_result = unsafe { isl_mat_right_inverse(mat) };
374 let isl_rs_result = Mat { ptr: isl_rs_result,
375 should_free_on_drop: true };
376 isl_rs_result
377 }
378
379 pub fn right_kernel(self) -> Mat {
381 let mat = self;
382 let mut mat = mat;
383 mat.do_not_free_on_drop();
384 let mat = mat.ptr;
385 let isl_rs_result = unsafe { isl_mat_right_kernel(mat) };
386 let isl_rs_result = Mat { ptr: isl_rs_result,
387 should_free_on_drop: true };
388 isl_rs_result
389 }
390
391 pub fn normalize(self) -> Mat {
393 let mat = self;
394 let mut mat = mat;
395 mat.do_not_free_on_drop();
396 let mat = mat.ptr;
397 let isl_rs_result = unsafe { isl_mat_normalize(mat) };
398 let isl_rs_result = Mat { ptr: isl_rs_result,
399 should_free_on_drop: true };
400 isl_rs_result
401 }
402
403 pub fn normalize_row(self, row: i32) -> Mat {
405 let mat = self;
406 let mut mat = mat;
407 mat.do_not_free_on_drop();
408 let mat = mat.ptr;
409 let isl_rs_result = unsafe { isl_mat_normalize_row(mat, row) };
410 let isl_rs_result = Mat { ptr: isl_rs_result,
411 should_free_on_drop: true };
412 isl_rs_result
413 }
414
415 pub fn drop_cols(self, col: u32, n: u32) -> Mat {
417 let mat = self;
418 let mut mat = mat;
419 mat.do_not_free_on_drop();
420 let mat = mat.ptr;
421 let isl_rs_result = unsafe { isl_mat_drop_cols(mat, col, n) };
422 let isl_rs_result = Mat { ptr: isl_rs_result,
423 should_free_on_drop: true };
424 isl_rs_result
425 }
426
427 pub fn drop_rows(self, row: u32, n: u32) -> Mat {
429 let mat = self;
430 let mut mat = mat;
431 mat.do_not_free_on_drop();
432 let mat = mat.ptr;
433 let isl_rs_result = unsafe { isl_mat_drop_rows(mat, row, n) };
434 let isl_rs_result = Mat { ptr: isl_rs_result,
435 should_free_on_drop: true };
436 isl_rs_result
437 }
438
439 pub fn insert_cols(self, col: u32, n: u32) -> Mat {
441 let mat = self;
442 let mut mat = mat;
443 mat.do_not_free_on_drop();
444 let mat = mat.ptr;
445 let isl_rs_result = unsafe { isl_mat_insert_cols(mat, col, n) };
446 let isl_rs_result = Mat { ptr: isl_rs_result,
447 should_free_on_drop: true };
448 isl_rs_result
449 }
450
451 pub fn insert_rows(self, row: u32, n: u32) -> Mat {
453 let mat = self;
454 let mut mat = mat;
455 mat.do_not_free_on_drop();
456 let mat = mat.ptr;
457 let isl_rs_result = unsafe { isl_mat_insert_rows(mat, row, n) };
458 let isl_rs_result = Mat { ptr: isl_rs_result,
459 should_free_on_drop: true };
460 isl_rs_result
461 }
462
463 pub fn move_cols(self, dst_col: u32, src_col: u32, n: u32) -> Mat {
465 let mat = self;
466 let mut mat = mat;
467 mat.do_not_free_on_drop();
468 let mat = mat.ptr;
469 let isl_rs_result = unsafe { isl_mat_move_cols(mat, dst_col, src_col, n) };
470 let isl_rs_result = Mat { ptr: isl_rs_result,
471 should_free_on_drop: true };
472 isl_rs_result
473 }
474
475 pub fn add_rows(self, n: u32) -> Mat {
477 let mat = self;
478 let mut mat = mat;
479 mat.do_not_free_on_drop();
480 let mat = mat.ptr;
481 let isl_rs_result = unsafe { isl_mat_add_rows(mat, n) };
482 let isl_rs_result = Mat { ptr: isl_rs_result,
483 should_free_on_drop: true };
484 isl_rs_result
485 }
486
487 pub fn insert_zero_cols(self, first: u32, n: u32) -> Mat {
489 let mat = self;
490 let mut mat = mat;
491 mat.do_not_free_on_drop();
492 let mat = mat.ptr;
493 let isl_rs_result = unsafe { isl_mat_insert_zero_cols(mat, first, n) };
494 let isl_rs_result = Mat { ptr: isl_rs_result,
495 should_free_on_drop: true };
496 isl_rs_result
497 }
498
499 pub fn add_zero_cols(self, n: u32) -> Mat {
501 let mat = self;
502 let mut mat = mat;
503 mat.do_not_free_on_drop();
504 let mat = mat.ptr;
505 let isl_rs_result = unsafe { isl_mat_add_zero_cols(mat, n) };
506 let isl_rs_result = Mat { ptr: isl_rs_result,
507 should_free_on_drop: true };
508 isl_rs_result
509 }
510
511 pub fn insert_zero_rows(self, row: u32, n: u32) -> Mat {
513 let mat = self;
514 let mut mat = mat;
515 mat.do_not_free_on_drop();
516 let mat = mat.ptr;
517 let isl_rs_result = unsafe { isl_mat_insert_zero_rows(mat, row, n) };
518 let isl_rs_result = Mat { ptr: isl_rs_result,
519 should_free_on_drop: true };
520 isl_rs_result
521 }
522
523 pub fn add_zero_rows(self, n: u32) -> Mat {
525 let mat = self;
526 let mut mat = mat;
527 mat.do_not_free_on_drop();
528 let mat = mat.ptr;
529 let isl_rs_result = unsafe { isl_mat_add_zero_rows(mat, n) };
530 let isl_rs_result = Mat { ptr: isl_rs_result,
531 should_free_on_drop: true };
532 isl_rs_result
533 }
534
535 pub fn col_add(&self, dst_col: i32, src_col: i32) {
537 let mat = self;
538 let mat = mat.ptr;
539 let isl_rs_result = unsafe { isl_mat_col_add(mat, dst_col, src_col) };
540 isl_rs_result
541 }
542
543 pub fn unimodular_complete(self, row: i32) -> Mat {
545 let M = self;
546 let mut M = M;
547 M.do_not_free_on_drop();
548 let M = M.ptr;
549 let isl_rs_result = unsafe { isl_mat_unimodular_complete(M, row) };
550 let isl_rs_result = Mat { ptr: isl_rs_result,
551 should_free_on_drop: true };
552 isl_rs_result
553 }
554
555 pub fn row_basis(self) -> Mat {
557 let mat = self;
558 let mut mat = mat;
559 mat.do_not_free_on_drop();
560 let mat = mat.ptr;
561 let isl_rs_result = unsafe { isl_mat_row_basis(mat) };
562 let isl_rs_result = Mat { ptr: isl_rs_result,
563 should_free_on_drop: true };
564 isl_rs_result
565 }
566
567 pub fn row_basis_extension(self, mat2: Mat) -> Mat {
569 let mat1 = self;
570 let mut mat1 = mat1;
571 mat1.do_not_free_on_drop();
572 let mat1 = mat1.ptr;
573 let mut mat2 = mat2;
574 mat2.do_not_free_on_drop();
575 let mat2 = mat2.ptr;
576 let isl_rs_result = unsafe { isl_mat_row_basis_extension(mat1, mat2) };
577 let isl_rs_result = Mat { ptr: isl_rs_result,
578 should_free_on_drop: true };
579 isl_rs_result
580 }
581
582 pub fn from_row_vec(vec: Vec) -> Mat {
584 let mut vec = vec;
585 vec.do_not_free_on_drop();
586 let vec = vec.ptr;
587 let isl_rs_result = unsafe { isl_mat_from_row_vec(vec) };
588 let isl_rs_result = Mat { ptr: isl_rs_result,
589 should_free_on_drop: true };
590 isl_rs_result
591 }
592
593 pub fn concat(self, bot: Mat) -> Mat {
595 let top = self;
596 let mut top = top;
597 top.do_not_free_on_drop();
598 let top = top.ptr;
599 let mut bot = bot;
600 bot.do_not_free_on_drop();
601 let bot = bot.ptr;
602 let isl_rs_result = unsafe { isl_mat_concat(top, bot) };
603 let isl_rs_result = Mat { ptr: isl_rs_result,
604 should_free_on_drop: true };
605 isl_rs_result
606 }
607
608 pub fn vec_concat(self, bot: Vec) -> Mat {
610 let top = self;
611 let mut top = top;
612 top.do_not_free_on_drop();
613 let top = top.ptr;
614 let mut bot = bot;
615 bot.do_not_free_on_drop();
616 let bot = bot.ptr;
617 let isl_rs_result = unsafe { isl_mat_vec_concat(top, bot) };
618 let isl_rs_result = Mat { ptr: isl_rs_result,
619 should_free_on_drop: true };
620 isl_rs_result
621 }
622
623 pub fn is_equal(&self, mat2: &Mat) -> bool {
625 let mat1 = self;
626 let mat1 = mat1.ptr;
627 let mat2 = mat2.ptr;
628 let isl_rs_result = unsafe { isl_mat_is_equal(mat1, mat2) };
629 let isl_rs_result = match isl_rs_result {
630 0 => false,
631 1 => true,
632 _ => panic!("Got isl_bool = -1"),
633 };
634 isl_rs_result
635 }
636
637 pub fn has_linearly_independent_rows(&self, mat2: &Mat) -> bool {
639 let mat1 = self;
640 let mat1 = mat1.ptr;
641 let mat2 = mat2.ptr;
642 let isl_rs_result = unsafe { isl_mat_has_linearly_independent_rows(mat1, mat2) };
643 let isl_rs_result = match isl_rs_result {
644 0 => false,
645 1 => true,
646 _ => panic!("Got isl_bool = -1"),
647 };
648 isl_rs_result
649 }
650
651 pub fn rank(&self) -> i32 {
653 let mat = self;
654 let mat = mat.ptr;
655 let isl_rs_result = unsafe { isl_mat_rank(mat) };
656 isl_rs_result
657 }
658
659 pub fn initial_non_zero_cols(&self) -> i32 {
661 let mat = self;
662 let mat = mat.ptr;
663 let isl_rs_result = unsafe { isl_mat_initial_non_zero_cols(mat) };
664 isl_rs_result
665 }
666
667 pub fn dump(&self) {
669 let mat = self;
670 let mat = mat.ptr;
671 let isl_rs_result = unsafe { isl_mat_dump(mat) };
672 isl_rs_result
673 }
674
675 pub fn do_not_free_on_drop(&mut self) {
677 self.should_free_on_drop = false;
678 }
679}
680
681impl Drop for Mat {
682 fn drop(&mut self) {
683 if self.should_free_on_drop {
684 unsafe {
685 isl_mat_free(self.ptr);
686 }
687 }
688 }
689}