ENH: acb poly scalar mul and div convenience functions

This commit is contained in:
alex 2016-04-27 21:23:54 -04:00
parent 53b6db89d3
commit ae3777314d
5 changed files with 31 additions and 8 deletions

View file

@ -104,7 +104,7 @@ int main()
acb_poly_mullow(C, C, B, n1, bits2);
acb_gamma(c, s, bits2);
_acb_vec_scalar_div(C->coeffs, C->coeffs, C->length, c, bits2);
acb_poly_scalar_div(C, C, c, bits2);
acb_poly_truncate(C, n1 - 1);
}
@ -123,7 +123,7 @@ int main()
acb_poly_mullow(C, C, B, n1, bits2);
_acb_vec_scalar_mul(C->coeffs, C->coeffs, C->length, s, bits2);
acb_poly_scalar_mul(C, C, s, bits2);
acb_poly_neg(C, C);
acb_poly_truncate(C, n1 - 1);
@ -138,7 +138,7 @@ int main()
acb_poly_derivative(B, S, bits2);
acb_poly_mullow(D, C, B, n1, bits2);
acb_poly_integral(D, D, bits2);
_acb_vec_scalar_mul(D->coeffs, D->coeffs, D->length, s, bits2);
acb_poly_scalar_mul(D, D, s, bits2);
acb_poly_mullow(C, C, S, n1, bits2);
acb_poly_sub(D, C, D, bits2);
@ -152,7 +152,7 @@ int main()
acb_poly_mullow(C, C, B, n1, bits2);
acb_gamma(c, s, bits2);
_acb_vec_scalar_div(C->coeffs, C->coeffs, C->length, c, bits2);
acb_poly_scalar_div(C, C, c, bits2);
acb_poly_truncate(C, n1 - 1);

View file

@ -93,7 +93,7 @@ int main()
acb_poly_mullow(C, C, B, n1, bits2);
acb_gamma(c, s, bits2);
_acb_vec_scalar_div(C->coeffs, C->coeffs, C->length, c, bits2);
acb_poly_scalar_div(C, C, c, bits2);
acb_poly_truncate(C, n1 - 1);
}
@ -107,7 +107,7 @@ int main()
acb_poly_derivative(B, S, bits2);
acb_poly_mullow(D, C, B, n1, bits2);
acb_poly_integral(D, D, bits2);
_acb_vec_scalar_mul(D->coeffs, D->coeffs, D->length, s, bits2);
acb_poly_scalar_mul(D, D, s, bits2);
acb_poly_mullow(C, C, S, n1, bits2);
acb_poly_sub(D, C, D, bits2);

View file

@ -229,6 +229,22 @@ acb_poly_scalar_mul_2exp_si(acb_poly_t res, const acb_poly_t poly, slong c)
_acb_poly_set_length(res, poly->length);
}
ACB_POLY_INLINE void
acb_poly_scalar_mul(acb_poly_t res, const acb_poly_t poly, const acb_t c, slong prec)
{
acb_poly_fit_length(res, poly->length);
_acb_vec_scalar_mul(res->coeffs, poly->coeffs, poly->length, c, prec);
_acb_poly_set_length(res, poly->length);
}
ACB_POLY_INLINE void
acb_poly_scalar_div(acb_poly_t res, const acb_poly_t poly, const acb_t c, slong prec)
{
acb_poly_fit_length(res, poly->length);
_acb_vec_scalar_div(res->coeffs, poly->coeffs, poly->length, c, prec);
_acb_poly_set_length(res, poly->length);
}
void acb_poly_mullow_classical(acb_poly_t res, const acb_poly_t poly1,
const acb_poly_t poly2,
slong n, slong prec);
@ -685,4 +701,3 @@ void acb_poly_erf_series(acb_poly_t g, const acb_poly_t h, slong n, slong prec);
#endif
#endif

View file

@ -43,7 +43,7 @@ int main()
acb_poly_product_roots(a, roots, deg, prec);
acb_randtest(t, state, prec, 1 + n_randint(state, 20));
_acb_vec_scalar_mul(a->coeffs, a->coeffs, a->length, t, prec);
acb_poly_scalar_mul(a, a, t, prec);
acb_poly_root_bound_fujiwara(mag1, a);

View file

@ -246,6 +246,14 @@ Arithmetic
Sets *C* to *A* multiplied by `2^c`.
.. function:: void acb_poly_scalar_mul(acb_poly_t C, const acb_poly_t A, const acb_t c, slong prec)
Sets *C* to *A* multiplied by *c*.
.. function:: void acb_poly_scalar_div(acb_poly_t C, const acb_poly_t A, const acb_t c, slong prec)
Sets *C* to *A* divided by *c*.
.. function:: void _acb_poly_mullow_classical(acb_ptr C, acb_srcptr A, slong lenA, acb_srcptr B, slong lenB, slong n, slong prec)
.. function:: void _acb_poly_mullow_transpose(acb_ptr C, acb_srcptr A, slong lenA, acb_srcptr B, slong lenB, slong n, slong prec)