add poly_set_round methods

This commit is contained in:
Fredrik Johansson 2015-01-19 16:52:15 +01:00
parent f66d002884
commit 9f46fd1133
6 changed files with 90 additions and 0 deletions

View file

@ -155,6 +155,8 @@ void acb_poly_integral(acb_poly_t res, const acb_poly_t poly, long prec);
void acb_poly_set(acb_poly_t dest, const acb_poly_t src); void acb_poly_set(acb_poly_t dest, const acb_poly_t src);
void acb_poly_set_round(acb_poly_t dest, const acb_poly_t src, long prec);
void acb_poly_set_arb_poly(acb_poly_t poly, const arb_poly_t re); void acb_poly_set_arb_poly(acb_poly_t poly, const arb_poly_t re);
void acb_poly_set2_arb_poly(acb_poly_t poly, const arb_poly_t re, const arb_poly_t im); void acb_poly_set2_arb_poly(acb_poly_t poly, const arb_poly_t re, const arb_poly_t im);

37
acb_poly/set_round.c Normal file
View file

@ -0,0 +1,37 @@
/*=============================================================================
This file is part of ARB.
ARB is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
ARB is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ARB; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=============================================================================*/
/******************************************************************************
Copyright (C) 2012 Fredrik Johansson
******************************************************************************/
#include "acb_poly.h"
void
acb_poly_set_round(acb_poly_t dest, const acb_poly_t src, long prec)
{
long len = acb_poly_length(src);
acb_poly_fit_length(dest, len);
_acb_vec_set_round(dest->coeffs, src->coeffs, len, prec);
_acb_poly_set_length(dest, len);
}

View file

@ -76,6 +76,8 @@ arb_poly_swap(arb_poly_t poly1, arb_poly_t poly2)
void arb_poly_set(arb_poly_t poly, const arb_poly_t src); void arb_poly_set(arb_poly_t poly, const arb_poly_t src);
void arb_poly_set_round(arb_poly_t poly, const arb_poly_t src, long prec);
/* Basic manipulation */ /* Basic manipulation */
ARB_POLY_INLINE long arb_poly_length(const arb_poly_t poly) ARB_POLY_INLINE long arb_poly_length(const arb_poly_t poly)

37
arb_poly/set_round.c Normal file
View file

@ -0,0 +1,37 @@
/*=============================================================================
This file is part of ARB.
ARB is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
ARB is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ARB; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=============================================================================*/
/******************************************************************************
Copyright (C) 2012 Fredrik Johansson
******************************************************************************/
#include "arb_poly.h"
void
arb_poly_set_round(arb_poly_t dest, const arb_poly_t src, long prec)
{
long len = arb_poly_length(src);
arb_poly_fit_length(dest, len);
_arb_vec_set_round(dest->coeffs, src->coeffs, len, prec);
_arb_poly_set_length(dest, len);
}

View file

@ -88,6 +88,10 @@ Basic properties and manipulation
Sets *dest* to a copy of *src*. Sets *dest* to a copy of *src*.
.. function:: void acb_poly_set_round(acb_poly_t dest, const acb_poly_t src, long prec)
Sets *dest* to a copy of *src*, rounded to *prec* bits.
.. function:: void acb_poly_set_coeff_si(acb_poly_t poly, long n, long c) .. function:: void acb_poly_set_coeff_si(acb_poly_t poly, long n, long c)
.. function:: void acb_poly_set_coeff_acb(acb_poly_t poly, long n, const acb_t c) .. function:: void acb_poly_set_coeff_acb(acb_poly_t poly, long n, const acb_t c)

View file

@ -63,6 +63,14 @@ Basic manipulation
Sets *poly* to the constant 0 respectively 1. Sets *poly* to the constant 0 respectively 1.
.. function:: void arb_poly_set(arb_poly_t dest, const arb_poly_t src)
Sets *dest* to a copy of *src*.
.. function:: void arb_poly_set_round(arb_poly_t dest, const arb_poly_t src, long prec)
Sets *dest* to a copy of *src*, rounded to *prec* bits.
.. function:: void arb_poly_set_coeff_si(arb_poly_t poly, long n, long c) .. function:: void arb_poly_set_coeff_si(arb_poly_t poly, long n, long c)
.. function:: void arb_poly_set_coeff_arb(arb_poly_t poly, long n, const arb_t c) .. function:: void arb_poly_set_coeff_arb(arb_poly_t poly, long n, const arb_t c)