1 /*
2 Copyright (C) 2012 Fredrik Johansson
3
4 This file is part of Arb.
5
6 Arb is free software: you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License (LGPL) as published
8 by the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version. See <http://www.gnu.org/licenses/>.
10 */
11
12 #include "acb_poly.h"
13
14 int
_acb_poly_overlaps(acb_srcptr poly1,slong len1,acb_srcptr poly2,slong len2)15 _acb_poly_overlaps(acb_srcptr poly1, slong len1,
16 acb_srcptr poly2, slong len2)
17 {
18 slong i;
19
20 for (i = 0; i < len2; i++)
21 if (!acb_overlaps(poly1 + i, poly2 + i))
22 return 0;
23
24 for (i = len2; i < len1; i++)
25 if (!acb_contains_zero(poly1 + i))
26 return 0;
27
28 return 1;
29 }
30
31 int
acb_poly_overlaps(const acb_poly_t poly1,const acb_poly_t poly2)32 acb_poly_overlaps(const acb_poly_t poly1, const acb_poly_t poly2)
33 {
34 slong len1 = poly1->length;
35 slong len2 = poly2->length;
36
37 if (len1 >= len2)
38 return _acb_poly_overlaps(poly1->coeffs, len1, poly2->coeffs, len2);
39 else
40 return _acb_poly_overlaps(poly2->coeffs, len2, poly1->coeffs, len1);
41 }
42
43