isl_union_map.c \
isl_union_map_private.h \
isl_val.c \
+ isl_val_gmp.c \
isl_vec.c \
isl_version.c \
isl_vertices_private.h \
include/isl/union_set.h \
include/isl/union_set_type.h \
include/isl/val.h \
+ include/isl/val_gmp.h \
include/isl/vec.h \
include/isl/version.h \
include/isl/vertices.h
__isl_give isl_printer *isl_printer_print_val(
__isl_take isl_printer *p, __isl_keep isl_val *v);
+=head3 GMP specific functions
+
+These functions are only available if C<isl> has been compiled with C<GMP>
+support.
+
+Specific integer and rational values can be created from C<GMP> values using
+the following functions.
+
+ #include <isl/val_gmp.h>
+ __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
+ mpz_t z);
+ __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
+ const mpz_t n, const mpz_t d);
+
+The numerator and denominator of a rational value can be extracted as
+C<GMP> values using the following functions.
+
+ #include <isl/val_gmp.h>
+ int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
+ int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
+
=head2 Integers (obsolescent)
All operations on integers, mainly the coefficients
--- /dev/null
+#ifndef ISL_VAL_GMP_H
+#define ISL_VAL_GMP_H
+
+#include <gmp.h>
+#include <isl/val.h>
+
+__isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx, mpz_t z);
+__isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
+ const mpz_t n, const mpz_t d);
+int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
+int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
+
+#endif
--- /dev/null
+#include <isl/val_gmp.h>
+#include <isl_val_private.h>
+
+/* Return a reference to an isl_val representing the integer "z".
+ */
+__isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx, mpz_t z)
+{
+ isl_val *v;
+
+ v = isl_val_alloc(ctx);
+ if (!v)
+ return NULL;
+
+ isl_int_set(v->n, z);
+ isl_int_set_si(v->d, 1);
+
+ return v;
+}
+
+/* Return a reference to an isl_val representing the rational value "n"/"d".
+ */
+__isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx, const mpz_t n, const mpz_t d)
+{
+ isl_val *v;
+
+ v = isl_val_alloc(ctx);
+ if (!v)
+ return NULL;
+
+ isl_int_set(v->n, n);
+ isl_int_set(v->d, d);
+
+ return isl_val_normalize(v);
+}
+
+/* Extract the numerator of a rational value "v" in "z".
+ *
+ * If "v" is not a rational value, then the result is undefined.
+ */
+int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z)
+{
+ if (!v)
+ return -1;
+ if (!isl_val_is_rat(v))
+ isl_die(isl_val_get_ctx(v), isl_error_invalid,
+ "expecting rational value", return -1);
+ mpz_set(z, v->n);
+ return 0;
+}
+
+/* Extract the denominator of a rational value "v" in "z".
+ *
+ * If "v" is not a rational value, then the result is undefined.
+ */
+int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z)
+{
+ if (!v)
+ return -1;
+ if (!isl_val_is_rat(v))
+ isl_die(isl_val_get_ctx(v), isl_error_invalid,
+ "expecting rational value", return -1);
+ mpz_set(z, v->d);
+ return 0;
+}