1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright © 2026 Mikhail Hogrefe
//
// This file is part of Malachite.
//
// Malachite 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
// 3 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>.
use crateInteger;
use crateadd_assign_ref;
use cratesub_assign_ref;
use crateNatural;
use Vec;
use min;
use AddMulAssign;
use ;
// Adds `ys` multiplied by `c` into `xs`. Where `ys` is longer than `xs`, `xs` is extended by the
// products of the remaining elements of `ys` and `c`, so that the elements of `xs` and `ys` at the
// same index are always added: this is the operation $p \gets p + cq$ on coefficients.
//
// Nothing is trimmed, since leading coefficients can cancel, and a caller holding the coefficients
// of a polynomial must trim them. When `c` is zero, `xs` is left alone and not extended.
//
// # Worst-case complexity
// $T(n) = O(n \log n \log\log n)$
//
// $M(n) = O(n \log n)$
//
// where $T$ is time, $M$ is additional memory, and $n$ is the total number of bits of the elements
// of `xs` and `ys` and of `c`.
//
// This is equivalent to `_fmpz_vec_scalar_addmul_fmpz` from `fmpz_vec/scalar_addmul_fmpz.c`, FLINT
// 3.6.0, extended to vectors of different lengths.