/* * Copyright 2005-2007 Universiteit Leiden * Copyright 2008-2009 Katholieke Universiteit Leuven * Copyright 2010 INRIA Saclay * * Use of this software is governed by the MIT license * * Written by Sven Verdoolaege, Leiden Institute of Advanced Computer Science, * Universiteit Leiden, Niels Bohrweg 1, 2333 CA Leiden, The Netherlands * and K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, * B-3001 Leuven, Belgium * and INRIA Saclay - Ile-de-France, Parc Club Orsay Universite, * ZAC des vignes, 4 rue Jacques Monod, 91893 Orsay, France */ #include <isl_map_private.h> #include <isl_factorization.h> #include <isl_space_private.h> #include <isl_mat_private.h> /* Return the isl_ctx to which "f" belongs. */ isl_ctx *isl_factorizer_get_ctx(__isl_keep isl_factorizer *f) { … } static __isl_give isl_factorizer *isl_factorizer_alloc( __isl_keep isl_basic_set *bset, __isl_take isl_morph *morph, int n_group) { … } __isl_null isl_factorizer *isl_factorizer_free(__isl_take isl_factorizer *f) { … } void isl_factorizer_dump(__isl_take isl_factorizer *f) { … } __isl_give isl_factorizer *isl_factorizer_identity(__isl_keep isl_basic_set *bset) { … } __isl_give isl_factorizer *isl_factorizer_groups(__isl_keep isl_basic_set *bset, __isl_take isl_mat *Q, __isl_take isl_mat *U, int n, int *len) { … } struct isl_factor_groups { … }; /* Initialize isl_factor_groups structure: find pivot row positions, * each column initially belongs to its own group and the groups * of the constraints are still unknown. */ static int init_groups(struct isl_factor_groups *g, __isl_keep isl_mat *H) { … } /* Update group[k] to the group column k belongs to. * When merging two groups, only the group of the current * group leader is changed. Here we change the group of * the other members to also point to the group that the * old group leader now points to. */ static void update_group(struct isl_factor_groups *g, int k) { … } /* Merge group i with all groups of the subsequent columns * with non-zero coefficients in row j of H. * (The previous columns are all zero; otherwise we would have handled * the row before.) */ static int update_group_i_with_row_j(struct isl_factor_groups *g, int i, int j, __isl_keep isl_mat *H) { … } /* Update the group information based on the constraint matrix. */ static int update_groups(struct isl_factor_groups *g, __isl_keep isl_mat *H) { … } static void clear_groups(struct isl_factor_groups *g) { … } /* Determine if the set variables of the basic set can be factorized and * return the results in an isl_factorizer. * * The algorithm works by first computing the Hermite normal form * and then grouping columns linked by one or more constraints together, * where a constraints "links" two or more columns if the constraint * has nonzero coefficients in the columns. */ __isl_give isl_factorizer *isl_basic_set_factorizer( __isl_keep isl_basic_set *bset) { … } /* Given the factorizer "f" of a basic set, * call "test" on each resulting factor as long as each call succeeds. */ __isl_give isl_bool isl_factorizer_every_factor_basic_set( __isl_keep isl_factorizer *f, isl_bool (*test)(__isl_keep isl_basic_set *bset, void *user), void *user) { … }