Defined in header <scicpp/polynomials.hpp>
Divide two polynomials.
Return a pair of two arrays [Q, R]
where Q
is the quotient and R
is the remainder.
T
, std::size_t M
, std::size_t N
>polymul
(const std::array<T, M> &U, const std::array<T, N> &U)¶#include <scicpp/core.hpp>
#include <scicpp/polynomials.hpp>
int main()
{
const std::vector u{1., 2., 3.};
const std::vector v{3., 2., 1.};
const auto [q, r] = scicpp::polynomial::polydiv(u, v);
scicpp::print(q); // [ 3.0 ]
scicpp::print(r); // [ -8.0, -4.0 ]
}