| arithmetique.h | | arithmetique.h | |
|
| | | /* | |
| | | This file is part of PolyLib. | |
| | | | |
| | | PolyLib is free software: you can redistribute it and/or modify | |
| | | it under the terms of the GNU General Public License as published by | |
| | | the Free Software Foundation, either version 3 of the License, or | |
| | | (at your option) any later version. | |
| | | | |
| | | PolyLib is distributed in the hope that it will be useful, | |
| | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| | | GNU General Public License for more details. | |
| | | | |
| | | You should have received a copy of the GNU General Public License | |
| | | along with PolyLib. If not, see <http://www.gnu.org/licenses/>. | |
| | | */ | |
| | | | |
| /* header file built by cproto */ | | /* header file built by cproto */ | |
| #ifndef arithmetique_header_included | | #ifndef arithmetique_header_included | |
| #define arithmetique_header_included | | #define arithmetique_header_included | |
| | | | |
| /** package arithmetique | | /** package arithmetique | |
| * | | * | |
|
| * $Id: arithmetique.h,v 1.23 2006/10/25 20:44:44 skimo Exp $ | | * $Id: arithmetique.h,v 1.24 2007/02/22 09:16:57 skimo Exp $ | |
| * | | * | |
| * Francois Irigoin, mai 1989 | | * Francois Irigoin, mai 1989 | |
| * | | * | |
| * Modifications | | * Modifications | |
| * - rewrite of DIVIDE which was wrong (Remi Triolet, Francois Irigoin, | | * - rewrite of DIVIDE which was wrong (Remi Triolet, Francois Irigoin, | |
| * april 90) | | * april 90) | |
| * - simplification of POSITIVE_DIVIDE by suppressing one modulo | | * - simplification of POSITIVE_DIVIDE by suppressing one modulo | |
| * - B.Meister : added addmul, operation existing in gmp and quite useful | | * - B.Meister : added addmul, operation existing in gmp and quite useful | |
| * (05-2005) | | * (05-2005) | |
| */ | | */ | |
| | | | |
| skipping to change at line 326 | | skipping to change at line 343 | |
| | | | |
| #define value_addto(ref,val1,val2) ((ref) = (val1)+(val2)) | | #define value_addto(ref,val1,val2) ((ref) = (val1)+(val2)) | |
| #define value_add_int(ref,val,vint) ((ref) = (val)+(vint)) | | #define value_add_int(ref,val,vint) ((ref) = (val)+(vint)) | |
| #define value_addmul(ref, val1, val2) ((ref) += (val1)*(val2)) | | #define value_addmul(ref, val1, val2) ((ref) += (val1)*(val2)) | |
| #define value_increment(ref,val) ((ref) = (val)+1) | | #define value_increment(ref,val) ((ref) = (val)+1) | |
| #define value_multiply(ref,val1,val2) ((ref) = (val1)*(val2)) | | #define value_multiply(ref,val1,val2) ((ref) = (val1)*(val2)) | |
| #define value_subtract(ref,val1,val2) ((ref) = (val1)-(val2)) | | #define value_subtract(ref,val1,val2) ((ref) = (val1)-(val2)) | |
| #define value_sub_int(ref,val1,val2) ((ref) = (val1)-(val2)) | | #define value_sub_int(ref,val1,val2) ((ref) = (val1)-(val2)) | |
| #define value_decrement(ref,val) ((ref) = (val)-1) | | #define value_decrement(ref,val) ((ref) = (val)-1) | |
| #define value_division(ref,val1,val2) ((ref) = cln::truncate1(val1,val2)) | | #define value_division(ref,val1,val2) ((ref) = cln::truncate1(val1,val2)) | |
|
| | | #define value_divexact(ref,val1,val2) ((ref) = cln::exquo(val1,val2)) | |
| #define value_modulus(ref,val1,val2) ((ref) = cln::truncate2(val1,val2).
remainder) | | #define value_modulus(ref,val1,val2) ((ref) = cln::truncate2(val1,val2).
remainder) | |
| #define value_pdivision(ref,val1,val2) ((ref) = cln::floor1(val1,val2)) | | #define value_pdivision(ref,val1,val2) ((ref) = cln::floor1(val1,val2)) | |
| #define value_pmodulus(ref,val1,val2) ((ref) = cln::floor2(val1,val2).rem
ainder) | | #define value_pmodulus(ref,val1,val2) ((ref) = cln::floor2(val1,val2).rem
ainder) | |
| #define value_oppose(ref,val) ((ref) = -(val)) | | #define value_oppose(ref,val) ((ref) = -(val)) | |
| #define value_absolute(ref,val) ((ref) = cln::abs(val)) | | #define value_absolute(ref,val) ((ref) = cln::abs(val)) | |
| #define value_minimum(ref,val1,val2) ((ref) = cln::min((val1),(val2))) | | #define value_minimum(ref,val1,val2) ((ref) = cln::min((val1),(val2))) | |
| #define value_maximum(ref,val1,val2) ((ref) = cln::max((val1),(val2))) | | #define value_maximum(ref,val1,val2) ((ref) = cln::max((val1),(val2))) | |
|
| | | #define value_gcd(ref,val1,val2) ((ref) = cln::gcd((val1),(val2))) | |
| | | #define value_lcm(ref,val1,val2) ((ref) = cln::lcm((val1),(val2))) | |
| #define value_orto(ref,val1,val2) ((ref) = (val1)|(val2)) | | #define value_orto(ref,val1,val2) ((ref) = (val1)|(val2)) | |
| #define value_andto(ref,val1,val2) ((ref) = (val1)&(val2)) | | #define value_andto(ref,val1,val2) ((ref) = (val1)&(val2)) | |
| | | | |
| /* Conditional operations on 'Value' */ | | /* Conditional operations on 'Value' */ | |
| | | | |
| #define value_pos_p(val) ((val) > 0) | | #define value_pos_p(val) ((val) > 0) | |
| #define value_neg_p(val) ((val) < 0) | | #define value_neg_p(val) ((val) < 0) | |
| #define value_posz_p(val) ((val) >= 0) | | #define value_posz_p(val) ((val) >= 0) | |
| #define value_negz_p(val) ((val) <= 0) | | #define value_negz_p(val) ((val) <= 0) | |
| #define value_zero_p(val) ((val) == 0) | | #define value_zero_p(val) ((val) == 0) | |
| | | | |
| skipping to change at line 360 | | skipping to change at line 380 | |
| #elif defined(GNUMP) | | #elif defined(GNUMP) | |
| | | | |
| /* Basic macros */ | | /* Basic macros */ | |
| | | | |
| #define value_init(val) (mpz_init((val))) | | #define value_init(val) (mpz_init((val))) | |
| #define value_assign(v1,v2) (mpz_set((v1),(v2))) | | #define value_assign(v1,v2) (mpz_set((v1),(v2))) | |
| #define value_set_si(val,i) (mpz_set_si((val),(i))) | | #define value_set_si(val,i) (mpz_set_si((val),(i))) | |
| #define value_set_double(val,d)(mpz_set_d((val),(d))) | | #define value_set_double(val,d)(mpz_set_d((val),(d))) | |
| #define value_clear(val) (mpz_clear((val))) | | #define value_clear(val) (mpz_clear((val))) | |
| #define value_read(val,str) (mpz_set_str((val),(str),10)) | | #define value_read(val,str) (mpz_set_str((val),(str),10)) | |
|
| | | typedef void (*value_print_gmp_free_t)(void *, size_t); | |
| #define value_print(Dst,fmt,val) {char *str; \ | | #define value_print(Dst,fmt,val) {char *str; \ | |
|
| void (*gmp_free) (void *, size_t); \ | | value_print_gmp_free_t gmp_free; \ | |
| str = mpz_get_str(0,10,(val)); \ | | str = mpz_get_str(0,10,(val)); \ | |
| fprintf((Dst),(fmt),str); \ | | fprintf((Dst),(fmt),str); \ | |
| mp_get_memory_functions(NULL, NULL, &gmp_fre
e); \ | | mp_get_memory_functions(NULL, NULL, &gmp_fre
e); \ | |
| (*gmp_free) (str, strlen(str)+1); \ | | (*gmp_free) (str, strlen(str)+1); \ | |
| } | | } | |
| #define value_swap(val1,val2) (mpz_swap(val1, val2)) | | #define value_swap(val1,val2) (mpz_swap(val1, val2)) | |
| | | | |
| /* Boolean operators on 'Value' */ | | /* Boolean operators on 'Value' */ | |
| | | | |
| #define value_eq(v1,v2) (mpz_cmp((v1),(v2)) == 0) | | #define value_eq(v1,v2) (mpz_cmp((v1),(v2)) == 0) | |
| | | | |
| skipping to change at line 401 | | skipping to change at line 422 | |
| | | | |
| #define value_addto(ref,val1,val2) (mpz_add((ref),(val1),(val2))) | | #define value_addto(ref,val1,val2) (mpz_add((ref),(val1),(val2))) | |
| #define value_add_int(ref,val,vint) (mpz_add_ui((ref),(val),(long)(vint
))) | | #define value_add_int(ref,val,vint) (mpz_add_ui((ref),(val),(long)(vint
))) | |
| #define value_addmul(ref, val1, val2) (mpz_addmul((ref), (val1), (val2))) | | #define value_addmul(ref, val1, val2) (mpz_addmul((ref), (val1), (val2))) | |
| #define value_increment(ref,val) (mpz_add_ui((ref),(val),1)) | | #define value_increment(ref,val) (mpz_add_ui((ref),(val),1)) | |
| #define value_multiply(ref,val1,val2) (mpz_mul((ref),(val1),(val2))) | | #define value_multiply(ref,val1,val2) (mpz_mul((ref),(val1),(val2))) | |
| #define value_subtract(ref,val1,val2) (mpz_sub((ref),(val1),(val2))) | | #define value_subtract(ref,val1,val2) (mpz_sub((ref),(val1),(val2))) | |
| #define value_sub_int(ref,val,vint) (mpz_sub_ui((ref),(val),(long)(vint
))) | | #define value_sub_int(ref,val,vint) (mpz_sub_ui((ref),(val),(long)(vint
))) | |
| #define value_decrement(ref,val) (mpz_sub_ui((ref),(val),1)) | | #define value_decrement(ref,val) (mpz_sub_ui((ref),(val),1)) | |
| #define value_division(ref,val1,val2) (mpz_tdiv_q((ref),(val1),(val2))) | | #define value_division(ref,val1,val2) (mpz_tdiv_q((ref),(val1),(val2))) | |
|
| | | #define value_divexact(ref,val1,val2) (mpz_divexact((ref),(val1),(val2))) | |
| #define value_modulus(ref,val1,val2) (mpz_tdiv_r((ref),(val1),(val2))) | | #define value_modulus(ref,val1,val2) (mpz_tdiv_r((ref),(val1),(val2))) | |
| #define value_pdivision(ref,val1,val2) (mpz_fdiv_q((ref),(val1),(val2))) | | #define value_pdivision(ref,val1,val2) (mpz_fdiv_q((ref),(val1),(val2))) | |
| #define value_pmodulus(ref,val1,val2) (mpz_fdiv_r((ref),(val1),(val2))) | | #define value_pmodulus(ref,val1,val2) (mpz_fdiv_r((ref),(val1),(val2))) | |
| #define value_oppose(ref,val) (mpz_neg((ref),(val))) | | #define value_oppose(ref,val) (mpz_neg((ref),(val))) | |
| #define value_absolute(ref,val) (mpz_abs((ref),(val))) | | #define value_absolute(ref,val) (mpz_abs((ref),(val))) | |
| #define value_minimum(ref,val1,val2) (value_le((val1),(val2)) ? \ | | #define value_minimum(ref,val1,val2) (value_le((val1),(val2)) ? \ | |
| mpz_set((ref),(val1)) : \ | | mpz_set((ref),(val1)) : \ | |
| mpz_set((ref),(val2))) | | mpz_set((ref),(val2))) | |
| #define value_maximum(ref,val1,val2) (value_ge((val1),(val2)) ? \ | | #define value_maximum(ref,val1,val2) (value_ge((val1),(val2)) ? \ | |
| mpz_set((ref),(val1)) : \ | | mpz_set((ref),(val1)) : \ | |
| mpz_set((ref),(val2))) | | mpz_set((ref),(val2))) | |
|
| | | #define value_gcd(ref,val1,val2) (mpz_gcd(ref,val1,val2)) | |
| | | #define value_lcm(ref,val1,val2) (mpz_lcm(ref,val1,val2)) | |
| #define value_orto(ref,val1,val2) (mpz_ior((ref),(val1),(val2))) | | #define value_orto(ref,val1,val2) (mpz_ior((ref),(val1),(val2))) | |
| #define value_andto(ref,val1,val2) (mpz_and((ref),(val1),(val2))) | | #define value_andto(ref,val1,val2) (mpz_and((ref),(val1),(val2))) | |
| | | | |
| /* Conditional operations on 'Value' */ | | /* Conditional operations on 'Value' */ | |
| | | | |
| #define value_pos_p(val) (mpz_sgn(val) > 0) | | #define value_pos_p(val) (mpz_sgn(val) > 0) | |
| #define value_neg_p(val) (mpz_sgn(val) < 0) | | #define value_neg_p(val) (mpz_sgn(val) < 0) | |
| #define value_posz_p(val) (mpz_sgn(val) >= 0) | | #define value_posz_p(val) (mpz_sgn(val) >= 0) | |
| #define value_negz_p(val) (mpz_sgn(val) <= 0) | | #define value_negz_p(val) (mpz_sgn(val) <= 0) | |
| #define value_zero_p(val) (mpz_sgn(val) == 0) | | #define value_zero_p(val) (mpz_sgn(val) == 0) | |
| | | | |
| skipping to change at line 500 | | skipping to change at line 524 | |
| #define value_addto(ref,val1,val2) ((ref) = (val1)+(val2)) | | #define value_addto(ref,val1,val2) ((ref) = (val1)+(val2)) | |
| #define value_add_int(ref,val,vint) ((ref) = (val)+(Value)(vint)) | | #define value_add_int(ref,val,vint) ((ref) = (val)+(Value)(vint)) | |
| #define value_addmul(ref, val1, val2) ((ref) += (val1)*(val2)) | | #define value_addmul(ref, val1, val2) ((ref) += (val1)*(val2)) | |
| #define value_increment(ref,val) ((ref) = (val)+VALUE_ONE) | | #define value_increment(ref,val) ((ref) = (val)+VALUE_ONE) | |
| #define value_direct_product(ref,val1,val2) ((ref) = (val1)*(val2)) /* dire
ct! */ | | #define value_direct_product(ref,val1,val2) ((ref) = (val1)*(val2)) /* dire
ct! */ | |
| #define value_multiply(ref,val1,val2) ((ref) = value_mult((val1),(val2))) | | #define value_multiply(ref,val1,val2) ((ref) = value_mult((val1),(val2))) | |
| #define value_subtract(ref,val1,val2) ((ref) = (val1)-(val2)) | | #define value_subtract(ref,val1,val2) ((ref) = (val1)-(val2)) | |
| #define value_sub_int(ref,val,vint) ((ref) = (val)-(Value)(vint)) | | #define value_sub_int(ref,val,vint) ((ref) = (val)-(Value)(vint)) | |
| #define value_decrement(ref,val) ((ref) = (val)-VALUE_ONE) | | #define value_decrement(ref,val) ((ref) = (val)-VALUE_ONE) | |
| #define value_division(ref,val1,val2) ((ref) = (val1)/(val2)) | | #define value_division(ref,val1,val2) ((ref) = (val1)/(val2)) | |
|
| | | #define value_divexact(ref,val1,val2) ((ref) = (val1)/(val2)) | |
| #define value_modulus(ref,val1,val2) ((ref) = (val1)%(val2)) | | #define value_modulus(ref,val1,val2) ((ref) = (val1)%(val2)) | |
| #define value_pdivision(ref,val1,val2) ((ref) = value_pdiv((val1),(val2))) | | #define value_pdivision(ref,val1,val2) ((ref) = value_pdiv((val1),(val2))) | |
| #define value_pmodulus(ref,val1,val2) ((ref) = value_pmod((val1),(val2))) | | #define value_pmodulus(ref,val1,val2) ((ref) = value_pmod((val1),(val2))) | |
| #define value_oppose(ref,val) ((ref) = value_uminus((val))) | | #define value_oppose(ref,val) ((ref) = value_uminus((val))) | |
| #define value_absolute(ref,val) ((ref) = value_abs((val))) | | #define value_absolute(ref,val) ((ref) = value_abs((val))) | |
| #define value_minimum(ref,val1,val2) ((ref) = value_min((val1),(val2))) | | #define value_minimum(ref,val1,val2) ((ref) = value_min((val1),(val2))) | |
| #define value_maximum(ref,val1,val2) ((ref) = value_max((val1),(val2))) | | #define value_maximum(ref,val1,val2) ((ref) = value_max((val1),(val2))) | |
|
| | | #define value_gcd(ref,val1,val2) Gcd((val1),(val2),&(ref)) | |
| | | #define value_lcm(ref,val1,val2) Lcm3((val1),(val2),&(ref)) | |
| #define value_orto(ref,val1,val2) ((ref) = (val1)|(val2)) | | #define value_orto(ref,val1,val2) ((ref) = (val1)|(val2)) | |
| #define value_andto(ref,val1,val2) ((ref) = (val1)&(val2)) | | #define value_andto(ref,val1,val2) ((ref) = (val1)&(val2)) | |
| | | | |
| /* Unary operators on 'Value' */ | | /* Unary operators on 'Value' */ | |
| | | | |
| #define value_uminus(val) (-(val)) | | #define value_uminus(val) (-(val)) | |
| #define value_not(val) (~(val)) | | #define value_not(val) (~(val)) | |
| #define value_abs(val) (value_posz_p(val)? \ | | #define value_abs(val) (value_posz_p(val)? \ | |
| (val) : \ | | (val) : \ | |
| (value_ne((val), VALUE_NAN) ? \ | | (value_ne((val), VALUE_NAN) ? \ | |
| | | | |
| skipping to change at line 532 | | skipping to change at line 559 | |
| #define value_pos_p(val) value_gt(val,VALUE_ZERO) | | #define value_pos_p(val) value_gt(val,VALUE_ZERO) | |
| #define value_neg_p(val) value_lt(val,VALUE_ZERO) | | #define value_neg_p(val) value_lt(val,VALUE_ZERO) | |
| #define value_posz_p(val) value_ge(val,VALUE_ZERO) | | #define value_posz_p(val) value_ge(val,VALUE_ZERO) | |
| #define value_negz_p(val) value_le(val,VALUE_ZERO) | | #define value_negz_p(val) value_le(val,VALUE_ZERO) | |
| #define value_zero_p(val) value_eq(val,VALUE_ZERO) | | #define value_zero_p(val) value_eq(val,VALUE_ZERO) | |
| #define value_notzero_p(val) value_ne(val,VALUE_ZERO) | | #define value_notzero_p(val) value_ne(val,VALUE_ZERO) | |
| #define value_one_p(val) value_eq(val,VALUE_ONE) | | #define value_one_p(val) value_eq(val,VALUE_ONE) | |
| #define value_notone_p(val) value_ne(val,VALUE_ONE) | | #define value_notone_p(val) value_ne(val,VALUE_ONE) | |
| #define value_mone_p(val) value_eq(val,VALUE_MONE) | | #define value_mone_p(val) value_eq(val,VALUE_MONE) | |
| #define value_notmone_p(val) value_ne(val,VALUE_MONE) | | #define value_notmone_p(val) value_ne(val,VALUE_MONE) | |
|
| #define value_cmp_si(val, n) (val - VALUE_CONST(n)) | | #define value_cmp_si(val, n) (val - (n)) | |
| #define value_min_p(val) value_eq(val,VALUE_MIN) | | #define value_min_p(val) value_eq(val,VALUE_MIN) | |
| #define value_max_p(val) value_eq(val,VALUE_MAX) | | #define value_max_p(val) value_eq(val,VALUE_MAX) | |
| #define value_notmin_p(val) value_ne(val,VALUE_MIN) | | #define value_notmin_p(val) value_ne(val,VALUE_MIN) | |
| #define value_notmax_p(val) value_ne(val,VALUE_MAX) | | #define value_notmax_p(val) value_ne(val,VALUE_MAX) | |
| | | | |
| #endif /* 'Value' set to |longlong|long|float|char *|int */ | | #endif /* 'Value' set to |longlong|long|float|char *|int */ | |
| | | | |
| /* *********************** PROTECTED MULTIPLICATION **********************
*/ | | /* *********************** PROTECTED MULTIPLICATION **********************
*/ | |
| | | | |
| #include "arithmetic_errors.h" | | #include "arithmetic_errors.h" | |
| | | | |
| skipping to change at line 646 | | skipping to change at line 673 | |
| #undef value_addto | | #undef value_addto | |
| #define value_addto(v1,v2) value_assign(v1,value_plus(v1,v2)) | | #define value_addto(v1,v2) value_assign(v1,value_plus(v1,v2)) | |
| #undef value_subtract | | #undef value_subtract | |
| #define value_subtract(v1,v2) value_addto(v1,v2) | | #define value_subtract(v1,v2) value_addto(v1,v2) | |
| #undef value_product | | #undef value_product | |
| #define value_product(v1,v2) value_addto(v1,v2) | | #define value_product(v1,v2) value_addto(v1,v2) | |
| #undef value_modulus | | #undef value_modulus | |
| #define value_modulus(v1,v2) value_addto(v1,v2) | | #define value_modulus(v1,v2) value_addto(v1,v2) | |
| #undef value_division | | #undef value_division | |
| #define value_division(v1,v2) value_addto(v1,v2) | | #define value_division(v1,v2) value_addto(v1,v2) | |
|
| | | #undef value_divexact | |
| | | #define value_divexact(v1,v2) value_addto(v1,v2) | |
| #undef value_increment | | #undef value_increment | |
| #define value_increment(v) value_addto(v,VALUE_ONE) | | #define value_increment(v) value_addto(v,VALUE_ONE) | |
| #undef value_decrement | | #undef value_decrement | |
| #define value_decrement(v) value_addto(v,VALUE_MONE) | | #define value_decrement(v) value_addto(v,VALUE_MONE) | |
| #undef value_orto | | #undef value_orto | |
| #define value_orto(ref,val) value_addto(v1,v2) | | #define value_orto(ref,val) value_addto(v1,v2) | |
| #undef value_andto | | #undef value_andto | |
| #define value_andto(ref,val) value_addto(v1,v2) | | #define value_andto(ref,val) value_addto(v1,v2) | |
| #undef value_or | | #undef value_or | |
| #define value_or(v1,v2) value_fake_binary(v1,v2) | | #define value_or(v1,v2) value_fake_binary(v1,v2) | |
| | | | |
End of changes. 12 change blocks. |
| 3 lines changed or deleted | | 32 lines changed or added | |
|
| ehrhart.h | | ehrhart.h | |
|
| | | /* | |
| | | This file is part of PolyLib. | |
| | | | |
| | | PolyLib is free software: you can redistribute it and/or modify | |
| | | it under the terms of the GNU General Public License as published by | |
| | | the Free Software Foundation, either version 3 of the License, or | |
| | | (at your option) any later version. | |
| | | | |
| | | PolyLib is distributed in the hope that it will be useful, | |
| | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| | | GNU General Public License for more details. | |
| | | | |
| | | You should have received a copy of the GNU General Public License | |
| | | along with PolyLib. If not, see <http://www.gnu.org/licenses/>. | |
| | | */ | |
| | | | |
| #ifndef _ehrhart_H_ | | #ifndef _ehrhart_H_ | |
| #define _ehrhart_H_ | | #define _ehrhart_H_ | |
| | | | |
| /*********************** User defines ******************************/ | | /*********************** User defines ******************************/ | |
| | | | |
| /* Print all overflow warnings, or just one per domain */ | | /* Print all overflow warnings, or just one per domain */ | |
| /* #define ALL_OVERFLOW_WARNINGS */ | | /* #define ALL_OVERFLOW_WARNINGS */ | |
| | | | |
| /******************* End of user defines ***************************/ | | /******************* End of user defines ***************************/ | |
| | | | |
| #ifndef ALL_OVERFLOW_WARNINGS | | #ifndef ALL_OVERFLOW_WARNINGS | |
| extern int overflow_warning_flag; | | extern int overflow_warning_flag; | |
| #endif | | #endif | |
| | | | |
|
| #if (defined(__STDC__) || defined(__cplusplus)) | | | |
| | | | |
| #if defined(__cplusplus) | | #if defined(__cplusplus) | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| extern void count_points ( int pos, Polyhedron *P, Value *context, Value *r
es ); | | extern void count_points ( int pos, Polyhedron *P, Value *context, Value *r
es ); | |
| extern void eadd ( evalue *e1, evalue *res ); | | extern void eadd ( evalue *e1, evalue *res ); | |
| extern enode *ecopy ( enode *e ); | | extern enode *ecopy ( enode *e ); | |
| extern void edot ( enode *v1, enode *v2, evalue *res ); | | extern void edot ( enode *v1, enode *v2, evalue *res ); | |
| extern enode *new_enode( enode_type type,int size, int pos ); | | extern enode *new_enode( enode_type type,int size, int pos ); | |
| extern void free_evalue_refs ( evalue *e ); | | extern void free_evalue_refs ( evalue *e ); | |
|
| extern Enumeration *Polyhedron_Enumerate ( Polyhedron *P, Polyhedron *C, | | extern Enumeration *Polyhedron_Enumerate(Polyhedron *P, Polyhedron *C, | |
| unsigned MAXRAYS, char **pname ) | | unsigned MAXRAYS, const char **pnam | |
| ; | | e); | |
| extern void print_enode ( FILE *DST, enode *p, char **pname ); | | extern void print_enode(FILE *DST, enode *p, const char **pname); | |
| extern void print_evalue ( FILE *DST, evalue *e, char **pname ); | | extern void print_evalue(FILE *DST, evalue *e, const char **pname); | |
| extern void reduce_evalue (evalue *e); | | extern void reduce_evalue (evalue *e); | |
| extern void Enumeration_Free(Enumeration *en); | | extern void Enumeration_Free(Enumeration *en); | |
| extern Enumeration *Ehrhart_Quick_Apx(Matrix * M, Matrix * C, | | extern Enumeration *Ehrhart_Quick_Apx(Matrix * M, Matrix * C, | |
| Matrix ** Validity_Lattice, | | Matrix ** Validity_Lattice, | |
| unsigned MAXRAYS); | | unsigned MAXRAYS); | |
| extern Enumeration * Enumeration_zero(unsigned int nbParms, | | extern Enumeration * Enumeration_zero(unsigned int nbParms, | |
| unsigned int maxRays); | | unsigned int maxRays); | |
| | | | |
| #if defined(__cplusplus) | | #if defined(__cplusplus) | |
| } | | } | |
| #endif | | #endif | |
| | | | |
|
| #else /* (defined(__STDC__) || defined(__cplusplus)) */ | | | |
| | | | |
| extern void count_points (/* int pos, Polyhedron *P, Value *context, Value | | | |
| *res */); | | | |
| extern void eadd (/* evalue *e1, evalue *res */); | | | |
| extern enode *ecopy (/* enode *e */); | | | |
| extern void edot (/* enode *v1, enode *v2, evalue *res */); | | | |
| extern enode *new_enode(/* enode_type type,int size, int pos*/ ); | | | |
| extern void free_evalue_refs (/* evalue *e */); | | | |
| extern Enumeration *Polyhedron_Enumerate (/* Polyhedron *P, Polyhedron | | | |
| *C, unsigned MAXRAYS, char **pname */ | | | |
| ); | | | |
| extern void print_enode (/* FILE *DST, enode *p, char **pname */); | | | |
| extern void print_evalue (/* FILE *DST, evalue *e, char **pname */); | | | |
| extern void reduce_evalue (/* evalue *e */); | | | |
| extern void Enumeration_Free(/* Enumeration *en */); | | | |
| extern Enumeration *Ehrhart_Quick_Apx(/*Matrix * M, Matrix * C, | | | |
| Matrix ** Validity_Lattice, | | | |
| unsigned MAXRAYS*/); | | | |
| extern Enumeration * Enumeration_zero(/* unsigned int nbParms, | | | |
| unsigned int maxRays*/); | | | |
| | | | |
| #endif /* (defined(__STDC__) || defined(__cplusplus)) */ | | | |
| #endif /* _ehrhart_H_ */ | | #endif /* _ehrhart_H_ */ | |
| | | | |
End of changes. 4 change blocks. |
| 30 lines changed or deleted | | 21 lines changed or added | |
|
| matrix_addon.h | | matrix_addon.h | |
|
| | | /* | |
| | | This file is part of PolyLib. | |
| | | | |
| | | PolyLib is free software: you can redistribute it and/or modify | |
| | | it under the terms of the GNU General Public License as published by | |
| | | the Free Software Foundation, either version 3 of the License, or | |
| | | (at your option) any later version. | |
| | | | |
| | | PolyLib is distributed in the hope that it will be useful, | |
| | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| | | GNU General Public License for more details. | |
| | | | |
| | | You should have received a copy of the GNU General Public License | |
| | | along with PolyLib. If not, see <http://www.gnu.org/licenses/>. | |
| | | */ | |
| | | | |
| /** | | /** | |
|
| * $Id: matrix_addon.h,v 1.8 2006/10/01 02:10:46 meister Exp $ | | | |
| * | | | |
| * Polylib matrix addons | | * Polylib matrix addons | |
| * Mainly, deals with polyhedra represented in implicit form (set of | | * Mainly, deals with polyhedra represented in implicit form (set of | |
| * constraints). | | * constraints). | |
| * @author Benoit Meister | | * @author Benoit Meister | |
| */ | | */ | |
| | | | |
| #ifndef __BM_MATRIX_ADDON_H__ | | #ifndef __BM_MATRIX_ADDON_H__ | |
| #define __BM_MATRIX_ADDON_H__ | | #define __BM_MATRIX_ADDON_H__ | |
| | | | |
| #include<polylib/polylib.h> | | #include<polylib/polylib.h> | |
| | | | |
| skipping to change at line 43 | | skipping to change at line 58 | |
| /* "Frees" a view of the constraints of a polyhedron */ | | /* "Frees" a view of the constraints of a polyhedron */ | |
| void constraintsView_Free(Matrix * M); | | void constraintsView_Free(Matrix * M); | |
| | | | |
| /* splits a matrix of constraints M into a matrix of equalities Eqs and a | | /* splits a matrix of constraints M into a matrix of equalities Eqs and a | |
| matrix of inequalities Ineqs allocs the new matrices. */ | | matrix of inequalities Ineqs allocs the new matrices. */ | |
| void split_constraints(Matrix const * M, Matrix ** Eqs, Matrix **Ineqs); | | void split_constraints(Matrix const * M, Matrix ** Eqs, Matrix **Ineqs); | |
| | | | |
| /* returns the dim-dimensional identity matrix */ | | /* returns the dim-dimensional identity matrix */ | |
| Matrix * Identity_Matrix(unsigned int dim); | | Matrix * Identity_Matrix(unsigned int dim); | |
| | | | |
|
| | | void Matrix_identity(unsigned int dim, Matrix **I); | |
| | | | |
| /* given a n x n integer transformation matrix transf, compute its inverse
M/g, | | /* given a n x n integer transformation matrix transf, compute its inverse
M/g, | |
| where M is a nxn integer matrix. g is a common denominator for elements o
f | | where M is a nxn integer matrix. g is a common denominator for elements o
f | |
| (transf^{-1})*/ | | (transf^{-1})*/ | |
| void mtransformation_inverse(Matrix * transf, Matrix ** inv, Value * g); | | void mtransformation_inverse(Matrix * transf, Matrix ** inv, Value * g); | |
| | | | |
| /* simplifies a matrix seen as a polyhedron, by dividing its rows by the gc
d of | | /* simplifies a matrix seen as a polyhedron, by dividing its rows by the gc
d of | |
| their elements. */ | | their elements. */ | |
| void mpolyhedron_simplify(Matrix * polyh); | | void mpolyhedron_simplify(Matrix * polyh); | |
| | | | |
| /* inflates a polyhedron (represented as a matrix) P, so that the apx of it
s | | /* inflates a polyhedron (represented as a matrix) P, so that the apx of it
s | |
| | | | |
| skipping to change at line 89 | | skipping to change at line 106 | |
| Ineqs represented as a matrix eliminates the m first variables | | Ineqs represented as a matrix eliminates the m first variables | |
| - assumes that Eqs allows to eliminate the m equalities | | - assumes that Eqs allows to eliminate the m equalities | |
| - modifies Ineqs */ | | - modifies Ineqs */ | |
| unsigned int mpolyhedron_eliminate_first_variables(Matrix * Eqs, | | unsigned int mpolyhedron_eliminate_first_variables(Matrix * Eqs, | |
| Matrix * Ineqs); | | Matrix * Ineqs); | |
| #define Constraints_eliminateFirstVars(a,b) mpolyhedron_eliminate_first_var
iables(a,b) | | #define Constraints_eliminateFirstVars(a,b) mpolyhedron_eliminate_first_var
iables(a,b) | |
| | | | |
| /** returns a contiguous submatrix of a matrix. */ | | /** returns a contiguous submatrix of a matrix. */ | |
| void Matrix_subMatrix(Matrix * M, unsigned int sr, unsigned int sc, | | void Matrix_subMatrix(Matrix * M, unsigned int sr, unsigned int sc, | |
| unsigned int nbR, unsigned int nbC, Matrix ** sub); | | unsigned int nbR, unsigned int nbC, Matrix ** sub); | |
|
| | | /** | |
| | | * Cloning function. Similar to Matrix_Copy() but allocates the target matr | |
| | | ix | |
| | | * if it is set to NULL. | |
| | | */ | |
| | | void Matrix_clone(Matrix * M, Matrix ** Cl); | |
| | | | |
| /** | | /** | |
| * Copies a contiguous submatrix of M1 into M2, at the indicated position. | | * Copies a contiguous submatrix of M1 into M2, at the indicated position. | |
| * M1 and M2 are assumed t be allocated already. | | * M1 and M2 are assumed t be allocated already. | |
| */ | | */ | |
| void Matrix_copySubMatrix(Matrix *M1, | | void Matrix_copySubMatrix(Matrix *M1, | |
| unsigned int sr1, unsigned int sc1, | | unsigned int sr1, unsigned int sc1, | |
| unsigned int nbR, unsigned int nbC, | | unsigned int nbR, unsigned int nbC, | |
| Matrix * M2, | | Matrix * M2, | |
| unsigned int sr2, unsigned int sc2); | | unsigned int sr2, unsigned int sc2); | |
| | | | |
End of changes. 4 change blocks. |
| 2 lines changed or deleted | | 25 lines changed or added | |
|
| polyhedron.h | | polyhedron.h | |
| /* | | /* | |
|
| * This file was automatically generated by version 1.7 of cextract. | | This file is part of PolyLib. | |
| * Manual editing not recommended. | | | |
| * | | PolyLib is free software: you can redistribute it and/or modify | |
| * Created: Mon Mar 30 11:33:20 1998 | | it under the terms of the GNU General Public License as published by | |
| */ | | the Free Software Foundation, either version 3 of the License, or | |
| | | (at your option) any later version. | |
| | | | |
| | | PolyLib is distributed in the hope that it will be useful, | |
| | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| | | GNU General Public License for more details. | |
| | | | |
| | | You should have received a copy of the GNU General Public License | |
| | | along with PolyLib. If not, see <http://www.gnu.org/licenses/>. | |
| | | */ | |
| | | | |
| #ifndef _polyhedron_H_ | | #ifndef _polyhedron_H_ | |
| #define _polyhedron_H_ | | #define _polyhedron_H_ | |
| | | | |
| /* Make sure the Constraint member is valid */ | | /* Make sure the Constraint member is valid */ | |
| #define POL_ENSURE_INEQUALITIES(P)
\ | | #define POL_ENSURE_INEQUALITIES(P)
\ | |
| if (F_ISSET(P, POL_VALID) && !F_ISSET(P, POL_INEQUALITIES))
\ | | if (F_ISSET(P, POL_VALID) && !F_ISSET(P, POL_INEQUALITIES))
\ | |
| Polyhedron_Compute_Dual(P); | | Polyhedron_Compute_Dual(P); | |
| /* Make sure the Ray member is valid */ | | /* Make sure the Ray member is valid */ | |
| #define POL_ENSURE_POINTS(P)
\ | | #define POL_ENSURE_POINTS(P)
\ | |
| if (F_ISSET(P, POL_VALID) && !F_ISSET(P, POL_POINTS))
\ | | if (F_ISSET(P, POL_VALID) && !F_ISSET(P, POL_POINTS))
\ | |
| | | | |
| skipping to change at line 33 | | skipping to change at line 44 | |
| #define POL_ENSURE_VERTICES(P)
\ | | #define POL_ENSURE_VERTICES(P)
\ | |
| if (F_ISSET(P, POL_VALID) && !F_ISSET(P, POL_VERTICES))
\ | | if (F_ISSET(P, POL_VALID) && !F_ISSET(P, POL_VERTICES))
\ | |
| Polyhedron_Compute_Dual(P); | | Polyhedron_Compute_Dual(P); | |
| | | | |
| #if defined(__cplusplus) | | #if defined(__cplusplus) | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| extern void Polyhedron_Compute_Dual(Polyhedron *P); | | extern void Polyhedron_Compute_Dual(Polyhedron *P); | |
| | | | |
|
| #if defined(__cplusplus) | | | |
| } | | | |
| #endif | | | |
| | | | |
| #if (defined(__STDC__) || defined(__cplusplus)) | | | |
| | | | |
| #if defined(__cplusplus) | | | |
| extern "C" { | | | |
| #endif | | | |
| | | | |
| Polyhedron *DomainConstraintSimplify(Polyhedron *P, unsigned MaxRays); | | Polyhedron *DomainConstraintSimplify(Polyhedron *P, unsigned MaxRays); | |
| | | | |
| extern Polyhedron *AddConstraints(Value *Con,unsigned NbConstraints, | | extern Polyhedron *AddConstraints(Value *Con,unsigned NbConstraints, | |
| Polyhedron *Pol,unsigned NbMaxRays ); | | Polyhedron *Pol,unsigned NbMaxRays ); | |
| extern Polyhedron *AddPolyToDomain(Polyhedron *Pol,Polyhedron *PolDomain); | | extern Polyhedron *AddPolyToDomain(Polyhedron *Pol,Polyhedron *PolDomain); | |
| extern Polyhedron *AddRays (Value *Ray2,unsigned NbRay2,Polyhedron | | extern Polyhedron *AddRays (Value *Ray2,unsigned NbRay2,Polyhedron | |
| *Pol1,unsigned NbMaxRays); | | *Pol1,unsigned NbMaxRays); | |
| extern Polyhedron *align_context(Polyhedron *Pol,int align_dimension, | | extern Polyhedron *align_context(Polyhedron *Pol,int align_dimension, | |
| int NbMaxRays); | | int NbMaxRays); | |
| extern Polyhedron *Constraints2Polyhedron(Matrix *Constraints, unsigned | | extern Polyhedron *Constraints2Polyhedron(Matrix *Constraints, unsigned | |
| | | | |
| skipping to change at line 78 | | skipping to change at line 79 | |
| extern Polyhedron *DomainPreimage(Polyhedron *Pol,Matrix *Func, | | extern Polyhedron *DomainPreimage(Polyhedron *Pol,Matrix *Func, | |
| unsigned NbMaxRays); | | unsigned NbMaxRays); | |
| extern Polyhedron *DomainSimplify(Polyhedron *Pol1, Polyhedron *Pol2, | | extern Polyhedron *DomainSimplify(Polyhedron *Pol1, Polyhedron *Pol2, | |
| unsigned NbMaxRays); | | unsigned NbMaxRays); | |
| extern Polyhedron *Stras_DomainSimplify(Polyhedron *Pol1, Polyhedron *Pol2, | | extern Polyhedron *Stras_DomainSimplify(Polyhedron *Pol1, Polyhedron *Pol2, | |
| unsigned NbMaxRays); | | unsigned NbMaxRays); | |
| extern Polyhedron *DomainUnion(Polyhedron *Pol1,Polyhedron *Pol2, | | extern Polyhedron *DomainUnion(Polyhedron *Pol1,Polyhedron *Pol2, | |
| unsigned NbMaxRays); | | unsigned NbMaxRays); | |
| extern Polyhedron *Domain_Copy(Polyhedron *Pol); | | extern Polyhedron *Domain_Copy(Polyhedron *Pol); | |
| extern void Domain_Free (Polyhedron *Pol); | | extern void Domain_Free (Polyhedron *Pol); | |
|
| extern void Domain_PrintConstraints(FILE *Dst,char *Format,Polyhedron *Pol) | | extern void Domain_PrintConstraints(FILE *Dst, const char *Format, | |
| ; | | Polyhedron *Pol); | |
| extern Polyhedron *Empty_Polyhedron(unsigned Dimension); | | extern Polyhedron *Empty_Polyhedron(unsigned Dimension); | |
| extern int Gauss(Matrix *Mat,int NbEq,int Dimension); | | extern int Gauss(Matrix *Mat,int NbEq,int Dimension); | |
| extern int lower_upper_bounds(int pos,Polyhedron *P,Value *context, | | extern int lower_upper_bounds(int pos,Polyhedron *P,Value *context, | |
| Value *LBp,Value *UBp); | | Value *LBp,Value *UBp); | |
| extern Matrix *Polyhedron2Constraints(Polyhedron *Pol); | | extern Matrix *Polyhedron2Constraints(Polyhedron *Pol); | |
| extern Matrix *Polyhedron2Rays(Polyhedron *Pol); | | extern Matrix *Polyhedron2Rays(Polyhedron *Pol); | |
| extern int PolyhedronIncludes(Polyhedron *Pol1,Polyhedron *Pol2); | | extern int PolyhedronIncludes(Polyhedron *Pol1,Polyhedron *Pol2); | |
| extern Polyhedron* Polyhedron_Alloc(unsigned Dimension,unsigned | | extern Polyhedron* Polyhedron_Alloc(unsigned Dimension,unsigned | |
| NbConstraints,unsigned NbRays); | | NbConstraints,unsigned NbRays); | |
| extern Polyhedron *Polyhedron_Copy(Polyhedron *Pol); | | extern Polyhedron *Polyhedron_Copy(Polyhedron *Pol); | |
| extern void Polyhedron_Free(Polyhedron *Pol); | | extern void Polyhedron_Free(Polyhedron *Pol); | |
| extern Polyhedron *Polyhedron_Image(Polyhedron *Pol,Matrix *Func, | | extern Polyhedron *Polyhedron_Image(Polyhedron *Pol,Matrix *Func, | |
| unsigned NbMaxConstrs); | | unsigned NbMaxConstrs); | |
| extern Polyhedron *Polyhedron_Preimage(Polyhedron *Pol,Matrix *Func, | | extern Polyhedron *Polyhedron_Preimage(Polyhedron *Pol,Matrix *Func, | |
| unsigned NbMaxRays); | | unsigned NbMaxRays); | |
|
| extern void Polyhedron_Print(FILE *Dst,char *Format,Polyhedron *Pol); | | extern void Polyhedron_Print(FILE *Dst, const char *Format, const Polyhedro | |
| extern void Polyhedron_PrintConstraints(FILE *Dst,char *Format, | | n *Pol); | |
| | | extern void Polyhedron_PrintConstraints(FILE *Dst, const char *Format, | |
| Polyhedron *Pol); | | Polyhedron *Pol); | |
| extern Polyhedron *Polyhedron_Scan(Polyhedron *D,Polyhedron *C, | | extern Polyhedron *Polyhedron_Scan(Polyhedron *D,Polyhedron *C, | |
| unsigned MAXRAYS); | | unsigned MAXRAYS); | |
| extern void PolyPrint(Polyhedron *Pol); | | extern void PolyPrint(Polyhedron *Pol); | |
| extern Polyhedron *Rays2Polyhedron(Matrix *Ray,unsigned NbMaxConstrs); | | extern Polyhedron *Rays2Polyhedron(Matrix *Ray,unsigned NbMaxConstrs); | |
| extern Polyhedron *SubConstraint(Value *Con,Polyhedron *Pol, | | extern Polyhedron *SubConstraint(Value *Con,Polyhedron *Pol, | |
| unsigned NbMaxRays, int Pass); | | unsigned NbMaxRays, int Pass); | |
| extern Polyhedron *Universe_Polyhedron (unsigned Dimension); | | extern Polyhedron *Universe_Polyhedron (unsigned Dimension); | |
| | | | |
| #if defined(__cplusplus) | | #if defined(__cplusplus) | |
| } | | } | |
| #endif | | #endif | |
| | | | |
|
| #else /* (defined(__STDC__) || defined(__cplusplus)) */ | | | |
| | | | |
| extern Polyhedron *AddConstraints(/*Value *Con,unsigned NbConstraints, | | | |
| Polyhedron *Pol,unsigned NbMaxRays */); | | | |
| extern Polyhedron *AddPolyToDomain(/*Polyhedron *Pol,Polyhedron *PolDomain* | | | |
| /); | | | |
| extern Polyhedron *AddRays (/*Value *Ray2,unsigned NbRay2,Polyhedron | | | |
| *Pol1,unsigned NbMaxRays*/); | | | |
| extern Polyhedron *align_context(/*Polyhedron *Pol,int align_dimension, | | | |
| int NbMaxRays*/); | | | |
| extern Polyhedron *Constraints2Polyhedron(/*Matrix *Constraints, unsigned | | | |
| NbMaxRays*/); | | | |
| extern Polyhedron *Disjoint_Domain(/* Polyhedron *Pol, int flag, unsigned N | | | |
| bMaxRays */); | | | |
| extern Polyhedron *DomainAddConstraints(/*Polyhedron *Pol,Matrix *Mat, | | | |
| unsigned NbMaxRays*/); | | | |
| extern Polyhedron *DomainAddRays(/*Polyhedron *Pol,Matrix *Ray, | | | |
| unsigned NbMaxConstrs*/); | | | |
| extern Polyhedron *DomainConvex(/*Polyhedron *Pol,unsigned NbMaxConstrs*/); | | | |
| extern Interval *DomainCost(/*Polyhedron *Pol,Value *Cost*/); | | | |
| extern Polyhedron *DomainDifference(/*Polyhedron *Pol1,Polyhedron *Pol2, | | | |
| unsigned NbMaxRays*/); | | | |
| extern Polyhedron *DomainImage(/*Polyhedron *Pol,Matrix *Func,unsigned | | | |
| NbMaxConstrs*/); | | | |
| extern Polyhedron *DomainIntersection(/*Polyhedron *Pol1,Polyhedron | | | |
| *Pol2, unsigned NbMaxRays*/); | | | |
| extern Polyhedron *DomainPreimage(/*Polyhedron *Pol,Matrix *Func, | | | |
| unsigned NbMaxRays*/); | | | |
| extern Polyhedron *DomainSimplify(/*Polyhedron *Pol1, Polyhedron *Pol2, | | | |
| unsigned NbMaxRays*/); | | | |
| extern Polyhedron *DomainUnion(/*Polyhedron *Pol1,Polyhedron *Pol2, | | | |
| unsigned NbMaxRays*/); | | | |
| extern Polyhedron *Domain_Copy(/*Polyhedron *Pol*/); | | | |
| extern void Domain_Free (/*Polyhedron *Pol*/); | | | |
| extern void Domain_PrintConstraints(/*FILE *Dst,char *Format,Polyhedron *Po | | | |
| l*/); | | | |
| extern Polyhedron *Empty_Polyhedron(/*unsigned Dimension*/); | | | |
| extern int Gauss(/*Matrix *Mat,int NbEq,int Dimension*/); | | | |
| extern int lower_upper_bounds(/*int pos,Polyhedron *P,Value *context, | | | |
| Value *LBp,Value *UBp*/); | | | |
| extern Matrix *Polyhedron2Constraints(/*Polyhedron *Pol*/); | | | |
| extern Matrix *Polyhedron2Rays(/*Polyhedron *Pol*/); | | | |
| extern int PolyhedronIncludes(/*Polyhedron *Pol1,Polyhedron *Pol2*/); | | | |
| extern Polyhedron* Polyhedron_Alloc(/*unsigned Dimension,unsigned | | | |
| NbConstraints,unsigned NbRays*/); | | | |
| extern Polyhedron *Polyhedron_Copy(/*Polyhedron *Pol*/); | | | |
| extern void Polyhedron_Free(/*Polyhedron *Pol*/); | | | |
| extern Polyhedron *Polyhedron_Image(/*Polyhedron *Pol,Matrix *Func, | | | |
| unsigned NbMaxConstrs*/); | | | |
| extern Polyhedron *Polyhedron_Preimage(/*Polyhedron *Pol,Matrix *Func, | | | |
| unsigned NbMaxRays*/); | | | |
| extern void Polyhedron_Print(/*FILE *Dst,char *Format,Polyhedron *Pol*/); | | | |
| extern void Polyhedron_PrintConstraints(/*FILE *Dst,char *Format, | | | |
| Polyhedron *Pol*/); | | | |
| extern Polyhedron *Polyhedron_Scan(/*Polyhedron *D,Polyhedron *C, | | | |
| unsigned MAXRAYS*/); | | | |
| extern void PolyPrint(/*Polyhedron *Pol*/); | | | |
| extern Polyhedron *Rays2Polyhedron(/*Matrix *Ray,unsigned NbMaxConstrs*/); | | | |
| extern Polyhedron *SubConstraint(/*Value *Con,Polyhedron *Pol, | | | |
| unsigned NbMaxRays, int Pass*/); | | | |
| extern Polyhedron *Universe_Polyhedron (/*unsigned Dimension*/); | | | |
| | | | |
| #endif /* (defined(__STDC__) || defined(__cplusplus)) */ | | | |
| #endif /* _polyhedron_H_ */ | | #endif /* _polyhedron_H_ */ | |
| | | | |
End of changes. 5 change blocks. |
| 82 lines changed or deleted | | 21 lines changed or added | |
|
| polyparam.h | | polyparam.h | |
| /* | | /* | |
|
| * This file was automatically generated by version 1.7 of cextract. | | This file is part of PolyLib. | |
| * Manual editing not recommended. | | | |
| * | | PolyLib is free software: you can redistribute it and/or modify | |
| * Created: Mon Mar 30 11:33:21 1998 | | it under the terms of the GNU General Public License as published by | |
| */ | | the Free Software Foundation, either version 3 of the License, or | |
| | | (at your option) any later version. | |
| | | | |
| | | PolyLib is distributed in the hope that it will be useful, | |
| | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| | | GNU General Public License for more details. | |
| | | | |
| | | You should have received a copy of the GNU General Public License | |
| | | along with PolyLib. If not, see <http://www.gnu.org/licenses/>. | |
| | | */ | |
| | | | |
| #ifndef _polyparam_H_ | | #ifndef _polyparam_H_ | |
| #define _polyparam_H_ | | #define _polyparam_H_ | |
|
| #if (defined(__STDC__) || defined(__cplusplus)) | | | |
| | | | |
| #if defined(__cplusplus) | | #if defined(__cplusplus) | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| extern void Compute_PDomains ( Param_Domain *PD, int nb_domains, int | | extern void Compute_PDomains ( Param_Domain *PD, int nb_domains, int | |
| working_space ); | | working_space ); | |
|
| extern Param_Polyhedron *GenParamPolyhedron (Polyhedron *Pol); | | extern Param_Polyhedron *GenParamPolyhedron(Polyhedron *Pol, Matrix *Rays); | |
| extern void Param_Domain_Free (Param_Domain *PD); | | extern void Param_Domain_Free (Param_Domain *PD); | |
| extern void Param_Polyhedron_Free ( Param_Polyhedron *P ); | | extern void Param_Polyhedron_Free ( Param_Polyhedron *P ); | |
| extern void Param_Vertices_Free ( Param_Vertices *PV ); | | extern void Param_Vertices_Free ( Param_Vertices *PV ); | |
|
| extern void Param_Vertices_Print ( FILE *DST, Param_Vertices *PV, | | extern void Param_Vertices_Print(FILE *DST, Param_Vertices *PV, | |
| char **param_names ); | | const char **param_names); | |
| extern Polyhedron *PDomainDifference ( Polyhedron *Pol1, Polyhedron | | extern Polyhedron *PDomainDifference ( Polyhedron *Pol1, Polyhedron | |
| *Pol2, unsigned NbMaxRays ); | | *Pol2, unsigned NbMaxRays ); | |
| extern Polyhedron *PDomainIntersection ( Polyhedron *Pol1, Polyhedron | | extern Polyhedron *PDomainIntersection ( Polyhedron *Pol1, Polyhedron | |
| *Pol2, unsigned NbMaxRays ); | | *Pol2, unsigned NbMaxRays ); | |
| extern Param_Polyhedron *Polyhedron2Param_Domain ( Polyhedron *Din, | | extern Param_Polyhedron *Polyhedron2Param_Domain ( Polyhedron *Din, | |
| Polyhedron *Cin, int | | Polyhedron *Cin, int | |
| working_space ); | | working_space ); | |
| extern Param_Polyhedron *Polyhedron2Param_SimplifiedDomain ( | | extern Param_Polyhedron *Polyhedron2Param_SimplifiedDomain ( | |
| Polyhedron **Din, Polyhedron *Cin, int working_space, | | Polyhedron **Din, Polyhedron *Cin, int working_space, | |
| Polyhedron **CEq, Matrix **CT ); | | Polyhedron **CEq, Matrix **CT ); | |
| extern Param_Polyhedron *Polyhedron2Param_Vertices ( Polyhedron *Din, | | extern Param_Polyhedron *Polyhedron2Param_Vertices ( Polyhedron *Din, | |
| Polyhedron *Cin, int | | Polyhedron *Cin, int | |
| working_space ); | | working_space ); | |
|
| extern void Print_Domain ( FILE *DST, Polyhedron *D, char **param_names ); | | extern void Print_Domain(FILE *DST, Polyhedron *D, const char **param_names | |
| extern void Print_Vertex ( FILE *DST, Matrix *V, char **param_names ); | | ); | |
| | | extern void Print_Vertex(FILE *DST, Matrix *V, const char **param_names); | |
| extern Matrix *VertexCT( Matrix *V, Matrix *CT ); | | extern Matrix *VertexCT( Matrix *V, Matrix *CT ); | |
|
| | | void Param_Polyhedron_Scale_Integer(Param_Polyhedron *PP, Polyhedron **P, | |
| | | Value *det, unsigned MaxRays); | |
| | | | |
| #if defined(__cplusplus) | | #if defined(__cplusplus) | |
| } | | } | |
| #endif | | #endif | |
| | | | |
|
| #else /* (defined(__STDC__) || defined(__cplusplus)) */ | | | |
| | | | |
| extern void Compute_PDomains (/* Param_Domain *PD, int nb_domains, int | | | |
| working_space */); | | | |
| extern Param_Polyhedron *GenParamPolyhedron (/* Polyhedron *Pol */); | | | |
| extern void Param_Domain_Free (/* Param_Domain *PD */); | | | |
| extern void Param_Polyhedron_Free (/* Param_Polyhedron *P */); | | | |
| extern void Param_Vertices_Free (/* Param_Vertices *PV */); | | | |
| extern void Param_Vertices_Print (/* FILE *DST, Param_Vertices *PV, | | | |
| char **param_names */); | | | |
| extern Polyhedron *PDomainDifference (/* Polyhedron *Pol1, Polyhedron | | | |
| *Pol2, unsigned NbMaxRays */); | | | |
| extern Polyhedron *PDomainIntersection (/* Polyhedron *Pol1, Polyhedron | | | |
| *Pol2, unsigned NbMaxRays */); | | | |
| extern Param_Polyhedron *Polyhedron2Param_Domain (/* Polyhedron *Din, | | | |
| Polyhedron *Cin, int | | | |
| working_space */); | | | |
| extern Param_Polyhedron *Polyhedron2Param_SimplifiedDomain (/* | | | |
| Polyhedron **Din, Polyhedron *Cin, int working_space, | | | |
| Polyhedron **CEq, Matrix **CT */); | | | |
| extern Param_Polyhedron *Polyhedron2Param_Vertices (/* Polyhedron *Din, | | | |
| Polyhedron *Cin, int | | | |
| working_space */); | | | |
| extern void Print_Domain (/* FILE *DST, Polyhedron *D, char **param_names * | | | |
| /); | | | |
| extern void Print_Vertex (/* FILE *DST, Matrix *V, char **param_names */); | | | |
| extern Matrix *VertexCT(/* Matrix *V, Matrix *CT */); | | | |
| | | | |
| #endif /* (defined(__STDC__) || defined(__cplusplus)) */ | | | |
| #endif /* _polyparam_H_ */ | | #endif /* _polyparam_H_ */ | |
| | | | |
End of changes. 7 change blocks. |
| 40 lines changed or deleted | | 24 lines changed or added | |
|
| vector.h | | vector.h | |
| /* | | /* | |
|
| * This file was automatically generated by version 1.7 of cextract. | | This file is part of PolyLib. | |
| * Manual editing not recommended. | | | |
| * | | PolyLib is free software: you can redistribute it and/or modify | |
| * Created: Mon Mar 30 11:33:18 1998 | | it under the terms of the GNU General Public License as published by | |
| */ | | the Free Software Foundation, either version 3 of the License, or | |
| | | (at your option) any later version. | |
| | | | |
| | | PolyLib is distributed in the hope that it will be useful, | |
| | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| | | GNU General Public License for more details. | |
| | | | |
| | | You should have received a copy of the GNU General Public License | |
| | | along with PolyLib. If not, see <http://www.gnu.org/licenses/>. | |
| | | */ | |
| | | | |
| #ifndef _vector_H_ | | #ifndef _vector_H_ | |
| #define _vector_H_ | | #define _vector_H_ | |
|
| #if (defined(__STDC__) || defined(__cplusplus)) | | | |
| | | | |
| #if defined(__cplusplus) | | #if defined(__cplusplus) | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| int ConstraintSimplify(Value *old, Value *n, int len, Value* v); | | int ConstraintSimplify(Value *old, Value *n, int len, Value* v); | |
| Value* value_alloc(int want, int *got); | | Value* value_alloc(int want, int *got); | |
| void value_free(Value *p, int size); | | void value_free(Value *p, int size); | |
| | | | |
| extern void Factorial(int n,Value *result); | | extern void Factorial(int n,Value *result); | |
| extern void Binomial(int n,int p,Value *result); | | extern void Binomial(int n,int p,Value *result); | |
| extern void CNP(int a,int b,Value *result); | | extern void CNP(int a,int b,Value *result); | |
| extern void Gcd(Value a,Value b,Value *result); | | extern void Gcd(Value a,Value b,Value *result); | |
| extern int First_Non_Zero(Value *p, unsigned length); | | extern int First_Non_Zero(Value *p, unsigned length); | |
| extern Vector *Vector_Alloc(unsigned length); | | extern Vector *Vector_Alloc(unsigned length); | |
| extern void Vector_Free(Vector *vector); | | extern void Vector_Free(Vector *vector); | |
|
| extern void Vector_Print(FILE *Dst,char *Format,Vector *Vec); | | extern void Vector_Print(FILE *Dst, const char *Format, Vector *Vec); | |
| extern Vector *Vector_Read(void); | | extern Vector *Vector_Read(void); | |
| extern void Vector_Set(Value *p,int n,unsigned length); | | extern void Vector_Set(Value *p,int n,unsigned length); | |
| extern void Vector_Exchange(Value *p1, Value *p2, unsigned length); | | extern void Vector_Exchange(Value *p1, Value *p2, unsigned length); | |
| extern void Vector_Copy(Value *p1, Value *p2, unsigned length); | | extern void Vector_Copy(Value *p1, Value *p2, unsigned length); | |
| extern void Vector_Add(Value *p1,Value *p2,Value *p3,unsigned length); | | extern void Vector_Add(Value *p1,Value *p2,Value *p3,unsigned length); | |
| extern void Vector_Sub(Value *p1,Value *p2,Value *p3,unsigned length); | | extern void Vector_Sub(Value *p1,Value *p2,Value *p3,unsigned length); | |
| extern void Vector_Or(Value *p1,Value *p2,Value *p3,unsigned length); | | extern void Vector_Or(Value *p1,Value *p2,Value *p3,unsigned length); | |
| extern void Vector_Scale(Value *p1, Value *p2, Value lambda, unsigned | | extern void Vector_Scale(Value *p1, Value *p2, Value lambda, unsigned | |
| length); | | length); | |
| extern void Vector_AntiScale(Value *p1,Value *p2,Value lambda, | | extern void Vector_AntiScale(Value *p1,Value *p2,Value lambda, | |
| unsigned length); | | unsigned length); | |
|
| | | extern void Vector_Oppose(Value *p1, Value *p2, unsigned length); | |
| extern void Inner_Product(Value *p1,Value *p2,unsigned length, Value *resul
t); | | extern void Inner_Product(Value *p1,Value *p2,unsigned length, Value *resul
t); | |
| extern void Vector_Max(Value *p,unsigned length, Value *result); | | extern void Vector_Max(Value *p,unsigned length, Value *result); | |
| extern void Vector_Min(Value *p,unsigned length, Value *result); | | extern void Vector_Min(Value *p,unsigned length, Value *result); | |
| extern void Vector_Combine(Value *p1,Value *p2,Value *p3,Value | | extern void Vector_Combine(Value *p1,Value *p2,Value *p3,Value | |
| lambda, Value mu, unsigned length); | | lambda, Value mu, unsigned length); | |
| extern int Vector_Equal(Value *Vec1,Value *Vec2,unsigned n); | | extern int Vector_Equal(Value *Vec1,Value *Vec2,unsigned n); | |
| extern void Vector_Min_Not_Zero(Value *p,unsigned length,int *index,Value | | extern void Vector_Min_Not_Zero(Value *p,unsigned length,int *index,Value | |
| *result); | | *result); | |
| extern void Vector_Gcd(Value *p,unsigned length,Value *result); | | extern void Vector_Gcd(Value *p,unsigned length,Value *result); | |
| extern void Vector_Map(Value *p1,Value *p2,Value *p3,unsigned | | extern void Vector_Map(Value *p1,Value *p2,Value *p3,unsigned | |
| | | | |
| skipping to change at line 61 | | skipping to change at line 72 | |
| int pos); | | int pos); | |
| extern void Vector_Reduce(Value *p,unsigned length, | | extern void Vector_Reduce(Value *p,unsigned length, | |
| void(*f)(Value,Value *),Value *result); | | void(*f)(Value,Value *),Value *result); | |
| extern void Vector_Sort(Value *vector,unsigned n); | | extern void Vector_Sort(Value *vector,unsigned n); | |
| extern int Vector_IsZero(Value * v, unsigned length); | | extern int Vector_IsZero(Value * v, unsigned length); | |
| | | | |
| #if defined(__cplusplus) | | #if defined(__cplusplus) | |
| } | | } | |
| #endif | | #endif | |
| | | | |
|
| #else /* (defined(__STDC__) || defined(__cplusplus)) */ | | | |
| | | | |
| extern void Factorial(/*int n,Value *result*/); | | | |
| extern void Binomial(/*int n,int p,Value *result*/); | | | |
| extern void CNP(/*int a,int b,Value *result*/); | | | |
| extern void Gcd(/*Value a,Value b,Value *result*/); | | | |
| extern int First_Non_Zero(/*Value *p, unsigned length*/); | | | |
| extern Vector *Vector_Alloc(/*unsigned length*/); | | | |
| extern void Vector_Free(/*Vector *vector*/); | | | |
| extern void Vector_Print(/*FILE *Dst,char *Format,Vector *Vec*/); | | | |
| extern Vector *Vector_Read(/*void*/); | | | |
| extern void Vector_Set(/*Value *p,int n,unsigned length*/); | | | |
| extern void Vector_Exchange(/*Value *p1, Value *p2, unsigned length*/); | | | |
| extern void Vector_Copy(/*Value *p1, Value *p2, unsigned length*/); | | | |
| extern void Vector_Add(/*Value *p1,Value *p2,Value *p3,unsigned length*/); | | | |
| extern void Vector_Sub(/*Value *p1,Value *p2,Value *p3,unsigned length*/); | | | |
| extern void Vector_Or(/*Value *p1,Value *p2,Value *p3,unsigned length*/); | | | |
| extern void Vector_Scale(/*Value *p1, Value *p2, Value lambda, unsigned | | | |
| length*/); | | | |
| extern void Vector_AntiScale(/*Value *p1,Value *p2,Value lambda, | | | |
| unsigned length*/); | | | |
| extern void Inner_Product(/*Value *p1,Value *p2,unsigned length, Value *res | | | |
| ult*/); | | | |
| extern void Vector_Max(/*Value *p,unsigned length, Value *result*/); | | | |
| extern void Vector_Min(/*Value *p,unsigned length, Value *result*/); | | | |
| extern void Vector_Combine(/*Value *p1,Value *p2,Value *p3,Value | | | |
| lambda, Value mu, unsigned length*/); | | | |
| extern int Vector_Equal(/*Value *Vec1,Value *Vec2,unsigned n*/); | | | |
| extern void Vector_Min_Not_Zero(/*Value *p,unsigned length,int *index,Value | | | |
| *result*/); | | | |
| extern void Vector_Gcd(/*Value *p,unsigned length,Value *result*/); | | | |
| extern void Vector_Map(/*Value *p1,Value *p2,Value *p3,unsigned | | | |
| length, Value *(*f)()*/); | | | |
| extern void Vector_Normalize(/*Value *p,unsigned length*/); | | | |
| extern void Vector_Normalize_Positive(/*Value *p,int length, | | | |
| int pos*/); | | | |
| extern void Vector_Reduce(/*Value *p,unsigned length, | | | |
| void(*f)(Value,Value *),Value *result*/); | | | |
| extern void Vector_Sort(/*Value *vector,unsigned n*/); | | | |
| extern int Vector_IsZero(/*Value * v, unsigned length*/); | | | |
| | | | |
| #endif /* (defined(__STDC__) || defined(__cplusplus)) */ | | | |
| #endif /* _vector_H_ */ | | #endif /* _vector_H_ */ | |
| | | | |
End of changes. 5 change blocks. |
| 49 lines changed or deleted | | 18 lines changed or added | |
|