/* * Copyright 2008-2009 Katholieke Universiteit Leuven * * Use of this software is governed by the MIT license * * Written by Sven Verdoolaege, K.U.Leuven, Departement * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */ #include <isl_ctx_private.h> #include <isl_map_private.h> #include "isl_basis_reduction.h" #include "isl_scan.h" #include <isl_seq.h> #include "isl_tab.h" #include <isl_val_private.h> #include <isl_vec_private.h> struct isl_counter { … }; static isl_stat increment_counter(struct isl_scan_callback *cb, __isl_take isl_vec *sample) { … } static int increment_range(struct isl_scan_callback *cb, isl_int min, isl_int max) { … } /* Call callback->add with the current sample value of the tableau "tab". */ static int add_solution(struct isl_tab *tab, struct isl_scan_callback *callback) { … } static isl_stat scan_0D(__isl_take isl_basic_set *bset, struct isl_scan_callback *callback) { … } /* Look for all integer points in "bset", which is assumed to be bounded, * and call callback->add on each of them. * * We first compute a reduced basis for the set and then scan * the set in the directions of this basis. * We basically perform a depth first search, where in each level i * we compute the range in the i-th basis vector direction, given * fixed values in the directions of the previous basis vector. * We then add an equality to the tableau fixing the value in the * direction of the current basis vector to each value in the range * in turn and then continue to the next level. * * The search is implemented iteratively. "level" identifies the current * basis vector. "init" is true if we want the first value at the current * level and false if we want the next value. * Solutions are added in the leaves of the search tree, i.e., after * we have fixed a value in each direction of the basis. */ isl_stat isl_basic_set_scan(__isl_take isl_basic_set *bset, struct isl_scan_callback *callback) { … } isl_stat isl_set_scan(__isl_take isl_set *set, struct isl_scan_callback *callback) { … } int isl_basic_set_count_upto(__isl_keep isl_basic_set *bset, isl_int max, isl_int *count) { … } int isl_set_count_upto(__isl_keep isl_set *set, isl_int max, isl_int *count) { … } int isl_set_count(__isl_keep isl_set *set, isl_int *count) { … } /* Count the total number of elements in "set" (in an inefficient way) and * return the result. */ __isl_give isl_val *isl_set_count_val(__isl_keep isl_set *set) { … }