-#include "isl_seq.h"
+/*
+ * Copyright 2008-2009 Katholieke Universiteit Leuven
+ *
+ * Use of this software is governed by the GNU LGPLv2.1 license
+ *
+ * Written by Sven Verdoolaege, K.U.Leuven, Departement
+ * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
+ */
+
+#include <isl/seq.h>
void isl_seq_clr(isl_int *p, unsigned len)
{
isl_int_set_si(p[i], 0);
}
+void isl_seq_set(isl_int *p, isl_int v, unsigned len)
+{
+ int i;
+ for (i = 0; i < len; ++i)
+ isl_int_set(p[i], v);
+}
+
void isl_seq_neg(isl_int *dst, isl_int *src, unsigned len)
{
int i;
isl_int_divexact(dst[i], src[i], m);
}
+void isl_seq_cdiv_q(isl_int *dst, isl_int *src, isl_int m, unsigned len)
+{
+ int i;
+ for (i = 0; i < len; ++i)
+ isl_int_cdiv_q(dst[i], src[i], m);
+}
+
+void isl_seq_fdiv_q(isl_int *dst, isl_int *src, isl_int m, unsigned len)
+{
+ int i;
+ for (i = 0; i < len; ++i)
+ isl_int_fdiv_q(dst[i], src[i], m);
+}
+
+void isl_seq_fdiv_r(isl_int *dst, isl_int *src, isl_int m, unsigned len)
+{
+ int i;
+ for (i = 0; i < len; ++i)
+ isl_int_fdiv_r(dst[i], src[i], m);
+}
+
void isl_seq_combine(isl_int *dst, isl_int m1, isl_int *src1,
isl_int m2, isl_int *src2, unsigned len)
{
return -1;
}
+int isl_seq_last_non_zero(isl_int *p, unsigned len)
+{
+ int i;
+
+ for (i = len - 1; i >= 0; --i)
+ if (!isl_int_is_zero(p[i]))
+ return i;
+ return -1;
+}
+
int isl_seq_abs_min_non_zero(isl_int *p, unsigned len)
{
int i, min = isl_seq_first_non_zero(p, len);
}
}
-void isl_seq_normalize(isl_int *p, unsigned len)
+void isl_seq_normalize(struct isl_ctx *ctx, isl_int *p, unsigned len)
{
- isl_int gcd;
-
if (len == 0)
return;
- isl_int_init(gcd);
- isl_seq_gcd(p, len, &gcd);
- if (!isl_int_is_zero(gcd))
- isl_seq_scale_down(p, p, gcd, len);
- isl_int_clear(gcd);
+ isl_seq_gcd(p, len, &ctx->normalize_gcd);
+ if (!isl_int_is_zero(ctx->normalize_gcd) &&
+ !isl_int_is_one(ctx->normalize_gcd))
+ isl_seq_scale_down(p, p, ctx->normalize_gcd, len);
}
void isl_seq_lcm(isl_int *p, unsigned len, isl_int *lcm)