|
Macaulay2 Engine
|
rawRoots(...) — univariate polynomial root finder over RR / CC. More...
#include "interface/factory.h"#include "interface/ring.h"#include <mps/mps.h>#include <stdlib.h>#include "aring-CCC.hpp"#include "aring.hpp"#include "error.h"#include "monoid.hpp"#include "polyring.hpp"#include "relem.hpp"#include "ring.hpp"#include "ringelem.hpp"Go to the source code of this file.
Macros | |
| #define | register |
| #define | abs(x) |
| #define | max(a, b) |
Functions | |
| engine_RawRingElementArrayOrNull | rawRoots (const RingElement *p, long prec, int unique) |
rawRoots(...) — univariate polynomial root finder over RR / CC.
Implementation behind interface/factory.h's rawRoots, the engine entry point reachable from M2 as roots(f) and roots(f, Precision => ...). Given a univariate polynomial over RR_n or CC_n, returns a one-row Matrix of all complex roots (counted with multiplicity); requesting real roots only is a flag that drops conjugate pairs back at the M2 level. Low-degree polynomials use closed-form formulas (degrees 1-4); higher degrees dispatch to MPSolve for arbitrary precision, FLINT's arb complex-roots routine for MPFR precision, or LAPACK eigenvalues of the companion matrix for hardware precision on small inputs.
The MPSolve include neutralises the obsolete C++ register keyword first (#define register then #undef) so the vendored header compiles under C++17. The function is bundled under interface/factory.h for historical reasons — root finding once travelled with the Factory factorisation library, even though the heavy lifting has since moved to MPSolve and FLINT.
Definition in file polyroots.cpp.