mirror of
https://github.com/vale981/arb
synced 2025-03-04 17:01:40 -05:00
add polynomial valuation functions
This commit is contained in:
parent
b6be51978f
commit
a357181b71
6 changed files with 64 additions and 0 deletions
|
@ -69,6 +69,8 @@ ACB_POLY_INLINE slong acb_poly_degree(const acb_poly_t poly)
|
||||||
return poly->length - 1;
|
return poly->length - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slong acb_poly_valuation(const acb_poly_t poly);
|
||||||
|
|
||||||
ACB_POLY_INLINE int
|
ACB_POLY_INLINE int
|
||||||
acb_poly_is_zero(const acb_poly_t z)
|
acb_poly_is_zero(const acb_poly_t z)
|
||||||
{
|
{
|
||||||
|
|
25
acb_poly/valuation.c
Normal file
25
acb_poly/valuation.c
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2016 Fredrik Johansson
|
||||||
|
|
||||||
|
This file is part of Arb.
|
||||||
|
|
||||||
|
Arb is free software: you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU Lesser General Public License (LGPL) as published
|
||||||
|
by the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "acb_poly.h"
|
||||||
|
|
||||||
|
slong
|
||||||
|
acb_poly_valuation(const acb_poly_t poly)
|
||||||
|
{
|
||||||
|
slong i, len = poly->length;
|
||||||
|
|
||||||
|
for (i = 0; i < len; i++)
|
||||||
|
if (!acb_is_zero(poly->coeffs + i))
|
||||||
|
return i;
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
|
@ -81,6 +81,8 @@ ARB_POLY_INLINE slong arb_poly_degree(const arb_poly_t poly)
|
||||||
return poly->length - 1;
|
return poly->length - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slong arb_poly_valuation(const arb_poly_t poly);
|
||||||
|
|
||||||
ARB_POLY_INLINE int
|
ARB_POLY_INLINE int
|
||||||
arb_poly_is_zero(const arb_poly_t z)
|
arb_poly_is_zero(const arb_poly_t z)
|
||||||
{
|
{
|
||||||
|
|
25
arb_poly/valuation.c
Normal file
25
arb_poly/valuation.c
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2016 Fredrik Johansson
|
||||||
|
|
||||||
|
This file is part of Arb.
|
||||||
|
|
||||||
|
Arb is free software: you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU Lesser General Public License (LGPL) as published
|
||||||
|
by the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "arb_poly.h"
|
||||||
|
|
||||||
|
slong
|
||||||
|
arb_poly_valuation(const arb_poly_t poly)
|
||||||
|
{
|
||||||
|
slong i, len = poly->length;
|
||||||
|
|
||||||
|
for (i = 0; i < len; i++)
|
||||||
|
if (!arb_is_zero(poly->coeffs + i))
|
||||||
|
return i;
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
|
@ -143,6 +143,11 @@ Basic properties and manipulation
|
||||||
Truncates *poly* to have length at most *n*, i.e. degree
|
Truncates *poly* to have length at most *n*, i.e. degree
|
||||||
strictly smaller than *n*.
|
strictly smaller than *n*.
|
||||||
|
|
||||||
|
.. function:: slong acb_poly_valuation(const acb_poly_t poly)
|
||||||
|
|
||||||
|
Returns the degree of the lowest term that is not exactly zero in *poly*.
|
||||||
|
Returns -1 if *poly* is the zero polynomial.
|
||||||
|
|
||||||
Input and output
|
Input and output
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -137,6 +137,11 @@ Basic manipulation
|
||||||
Truncates *poly* to have length at most *n*, i.e. degree
|
Truncates *poly* to have length at most *n*, i.e. degree
|
||||||
strictly smaller than *n*.
|
strictly smaller than *n*.
|
||||||
|
|
||||||
|
.. function:: slong arb_poly_valuation(const arb_poly_t poly)
|
||||||
|
|
||||||
|
Returns the degree of the lowest term that is not exactly zero in *poly*.
|
||||||
|
Returns -1 if *poly* is the zero polynomial.
|
||||||
|
|
||||||
Conversions
|
Conversions
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue