.. _flintxx_functions: **flint.. cpp:functions** -- C++ Wrapper =============================================================================== Flint exception type =============================================================================== flint\_exception This is the main exception type used by the flintxx library. It derives from ``std::domain_error``. As such its main method is ``what()``, yielding an English language description of the problem encountered. Rand.. cpp:functions =============================================================================== .. type:: frandxx The type ``frandxx`` wraps ``flint_rand_t`` and takes care of initialising and clearing random states. It is defined in ``flintxx/frandxx.h``. Note that this type is not copyable. .. cpp:function:: frandxx::frandxx() Initialize random state. .. cpp:function:: flint_rand_t& frandxx::_data() .. cpp:function:: const flint_rand_t& frandxx::_data() const Obtain a reference to the underlying C random state. Tuples =============================================================================== .. type:: ltuple Lazy tuples are implemented in ``flintxx/ltuple.h``. They are used throughout flintxx to emula.. cpp:functions with several return values. This header automatically creates a static instance of ``flint::detail::IGNORED_TYPE``. It is accessible in namespace flint, under the name ``FLINT_LTUPLE_PLACEHOLDER_NAME``, which defaults to ``_``. See ``ltupleref`` documentation for how to use this. Construct an ltuple of references, binding to the arguments ``t1``, \dots, ``tn``. Instances of ``flint::detail::IGNORED_TYPE`` can be used as placeholders. Currently $n \le 4$. .. cpp:function:: Ltuple ltuple(const T1& t1, ..., const Tn& tn) Construct an ltuple containing copies of ``t1``, \dots, ``tn``. Currently \code{n \le 4}. .. cpp:function:: Tk_expr Ltuple_expr::get() const If ``Tk`` is an expression template type, then the ``get()`` method returns a lazy expression evaluating to the kth element of the (potentially lazy) ltuple. If ``Tk`` is not an expression template type, this method evaluates the ltuple, and returns the kth entry. On ltuple immediates, reference versions are also available, which can be used to manipulate the entries. Permutations =============================================================================== .. type:: permxx Permutations are mostly used by row reduction algorithms. Even though we support limited arithmetic on them (e.g. composition), permutations are not implemented as expression templates. ``permxx`` wraps the C interface ``perm`` operating on ``slong*``. .. cpp:function:: permxx::permxx(slong n) .. cpp:function:: static permxx permxx::one(slong n) Initialize an identity permutation on the set $[n] = \{0, 1, \dots, n-1\}$. .. cpp:function:: static permxx permxx::randtest(slong n) Generate a random permutation on $[n]$. See ``_perm_randtest``. .. cpp:function:: bool permxx::operator==(const permxx&) .. cpp:function:: bool permxx::operator!=(const permxx&) .. cpp:function:: slong permxx::size() const Return the size of the set being permuted ($n$ in the constructors). .. cpp:function:: slong& operator[](slong i) .. cpp:function:: slong operator[](slong i) const Return the image of $i$ under the permutation. .. cpp:function:: permxx permxx::operator*(const permxx&) .. cpp:function:: permxx compose(const permxx& p1, const permxx& p2) Compute the composition of two permutations. See ``_perm_compose``. .. cpp:function:: void permxx::set_inv(const permxx& o) Set self to the inverse permutation of ``o``. .. cpp:function:: permxx permxx::inv() const .. cpp:function:: permxx inv(const permxx&) Return the inverse permutation. .. cpp:function:: int print(const permxx&) Integers (``fmpz``) =============================================================================== .. type:: fmpzxx C++ particulars ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_expr::unary operation() const The following una.. cpp:functions are made available as member functions: ``sqrt``, ``abs``. .. cpp:function:: Fmpz_expr::binary operation(??) const The following bina.. cpp:functions are made available as member functions: ``cdiv_q``, ``divexact``, ``fdiv_qr``, ``fdiv_r``, ``fdiv_r_2exp``, ``gcd``, ``gcdinv``, ``invmod``, ``lcm``, ``negmod``, ``pow``, ``rfac``, ``root``, ``sqrtmod``, ``tdiv_q``, ``tdiv_q_2exp``, ``tdiv_qr``, ``xgcd``. .. cpp:function:: Fmpz_expr::ternary operation(??, ??) const The following terna.. cpp:functions are made available as member functions: ``divexact2``, ``mul2``, ``mul_tdiv_q_2exp``, ``powm``. Memory management ------------------------------------------------------------------------------- .. cpp:function:: fmpzxx::fmpzxx() Initialize to zero. .. cpp:function:: fmpzxx::fmpzxx(const char*) .. cpp:function:: fmpzxx::fmpzxx(T:is_integer) Initialize from a primitive data type. See ``fmpz_set_str``, ``fmpz_set_si`` and ``fmpz_set_ui``. Random generation ------------------------------------------------------------------------------- .. cpp:function:: static fmpzxx fmpzxx::randbits(frandxx& state) .. cpp:function:: static fmpzxx fmpzxx::randtest(frandxx& state) .. cpp:function:: static fmpzxx fmpzxx::randtest_unsigned(frandxx& state) .. cpp:function:: static fmpzxx fmpzxx::randtest_not_zero(frandxx& state) .. cpp:function:: static fmpzxx fmpzxx::randm(frandxx& state, Fmpz_expr m) .. cpp:function:: static fmpzxx fmpzxx::randtest_mod(frandxx& state, Fmpz_expr m) .. cpp:function:: static fmpzxx fmpzxx::randtest_mod_signed(frandxx& state, Fmpz_expr m) Conversion ------------------------------------------------------------------------------- .. cpp:function:: std::string Fmpz_expr::to_string(int base = 10) const Convert self into a ``string``. See ``fmpz_get_str``. .. cpp:function:: slong Fmpz_expr::to() const Convert self to ``slong``. See ``fmpz_get_si``. .. cpp:function:: ulong Fmpz_expr::to() const Convert self to ``ulong``. See ``fmpz_get_ui``. .. cpp:function:: double Fmpz_expr::to() const Convert self to ``double``. See ``fmpz_get_d``. .. cpp:function:: double Fmpz_expr::get_d_2exp(long& exp) const .. cpp:function:: Fmpz_target Fmpz_target::operator=(const char*) .. cpp:function:: Fmpz_target Fmpz_target::operator=(T:is_integer) See ``fmpz_set_str``, ``fmpz_set_ui`` and ``fmpz_set_si``. .. cpp:function:: void Fmpz_target::set_ui_smod(mp_limb_t x, mv_limb_t m) .. cpp:function:: void Fmpz_target::set_uiui(mp_limb_t x, mv_limb_t m) .. cpp:function:: void Fmpz_target::neg_uiui(mp_limb_t x, mv_limb_t m) Input and output ------------------------------------------------------------------------------- .. cpp:function:: int print(Fmpz_expr) .. cpp:function:: int print(FILE*, Fmpz_expr) .. cpp:function:: int read(Fmpz_target) .. cpp:function:: int read(FILE*, Fmpz_target) Basic properties and manipulation ------------------------------------------------------------------------------- .. cpp:function:: size_t Fmpz_expr::sizeinbase(int) const .. cpp:function:: size_t sizeinbase(Fmpz_expr, int) .. cpp:function:: mp_bitcnt_t Fmpz_expr::bits() const .. cpp:function:: mp_bitcnt_t bits(Fmpz_expr) .. cpp:function:: mp_bitcnt_t Fmpz_expr::size() const .. cpp:function:: mp_bitcnt_t size(Fmpz_expr) .. cpp:function:: mp_bitcnt_t Fmpz_expr::val2() const .. cpp:function:: mp_bitcnt_t val2(Fmpz_expr) .. cpp:function:: int Fmpz_expr::sign() const .. cpp:function:: int sign(Fmpz_expr) .. cpp:function:: void Fmpz_target::set_zero() .. cpp:function:: void Fmpz_target::set_one() .. cpp:function:: bool Fmpz_expr::abs_fits_ui() const .. cpp:function:: bool Fmpz_expr::fits_si() const .. cpp:function:: void Fmpz_target::setbit(ulong) .. cpp:function:: bool Fmpz_expr::tstbit(ulong) const Comparison ------------------------------------------------------------------------------- Relational operators ``<=``, ``>`` etc. are overloaded, where ``e1`` and ``e2`` can be any combination of ``Fmpz_expr`` and ``T:is_integer``. See ``fmpz_cmp``, ``fmpz_cmp_si`` and ``fmpz_cmp_ui``. .. cpp:function:: bool Fmpz_expr::is_zero() const Return if this expression evaluates to zero. .. cpp:function:: bool Fmpz_expr::is_one() const Return if this expression evaluates to one. .. cpp:function:: bool Fmpz_expr::is_pm1() const Return if this expression evaluates to $\pm 1$. .. cpp:function:: bool Fmpz_expr::is_even() const Return if this expression evaluates to an even integer. .. cpp:function:: bool Fmpz_expr::is_odd() const Return if the expression evaluates to an odd integer. Basic arithmetic ------------------------------------------------------------------------------- Arithmetic operators ``+``, ``-``, ``*``, ``/``, ``%``, ``<<`` and ``>>`` are overloaded. See the ``fmpz`` documentation for which argument types are allowed. Symmetric operators with asymmetric type arguments can be used in either order, even if this is not exposed in the C interface. The shift operators wrap ``fmpz_fdiv_q_2exp`` and ``fmpz_mul_2exp``. The division operators use ``fmpz_fdiv``. .. cpp:function:: Fmpz_expr abs(Fmpz_expr) .. cpp:function:: Fmpz_expr mul2_uiui(Fmpz_expr g, ulong x, ulong y) .. cpp:function:: Fmpz_expr cdiv_q(Fmpz_expr, Fmpz_expr) .. cpp:function:: Fmpz_expr cdiv_q(Fmpz_expr, T:is_integer) .. cpp:function:: Fmpz_expr tdiv_q(Fmpz_expr, Fmpz_expr) .. cpp:function:: Fmpz_expr tdiv_q(Fmpz_expr, T:is_integer) .. cpp:function:: Fmpz_expr divexact(Fmpz_expr, Fmpz_expr) .. cpp:function:: Fmpz_expr divexact(Fmpz_expr, T:is_integer) .. cpp:function:: Fmpz_expr fdiv_r(Fmpz_expr, Fmpz_expr) .. cpp:function:: Fmpz_expr tdiv_q_2exp(Fmpz_expr, T:is_unsigned_integer) .. cpp:function:: Fmpz_expr fdiv_r_2exp(Fmpz_expr, T:is_unsigned_integer) .. cpp:function:: Fmpz_expr divexact2(Fmpz_expr g, ulong x, ulong y) .. cpp:function:: Fmpz_expr mul_tdiv_q_2exp(Fmpz_expr g, Fmpz_expr x, ulong exp) .. cpp:function:: Fmpz_expr mul_tdiv_q_2exp(Fmpz_expr g, long x, ulong exp) .. cpp:function:: Ltuple_expr fdiv_qr(Fmpz_expr g, Fmpz_expr h) .. cpp:function:: Ltuple_expr tdiv_qr(Fmpz_expr g, Fmpz_expr h) .. cpp:function:: bool Fmpz_expr::divisible(Fmpz_expr) const .. cpp:function:: bool Fmpz_expr::divisible(T:fits_into_slong) const .. cpp:function:: bool divisible(Fmpz_expr n, Fmpz_expr d) .. cpp:function:: bool divisible(Fmpz_expr n, T:fits_into_slong d) Return if $d$ divides $n$. See ``fmpz_divisible``. .. cpp:function:: Fmpz_expr powm(Fmpz_expr g, ulong e, Fmpz_expr m) .. cpp:function:: Fmpz_expr powm(Fmpz_expr g, Fmpz_expr e, Fmpz_expr m) .. cpp:function:: Fmpz_expr pow(Fmpz_expr, T:is_unsigned_integer) .. cpp:function:: long clog(Fmpz_expr x, Fmpz_expr b) .. cpp:function:: long clog(Fmpz_expr x, ulong b) .. cpp:function:: long flog(Fmpz_expr x, Fmpz_expr b) .. cpp:function:: long flog(Fmpz_expr x, ulong b) .. cpp:function:: double dlog(Fmpz_expr x) .. cpp:function:: long Fmpz_expr::clog(Fmpz_expr) const .. cpp:function:: long Fmpz_expr::clog(T:is_unsigned_integer) const .. cpp:function:: long Fmpz_expr::flog(Fmpz_expr) const .. cpp:function:: long Fmpz_expr::flog(T:is_unsigned_integer) const .. cpp:function:: double Fmpz_expr::dlog() const .. cpp:function:: Ltuple_expr sqrtmod(Fmpz_expr a, Fmpz_expr b) ``ltupleref(b, N) = sqrtmod(A, B)`` has the same effect as ``b = fmpz_sqrtmod(n, a, b)``, where ``n, a, b`` are the underlying ``fmpz_t`` of ``N, A, B``. .. cpp:function:: Ltuple_expr sqrtrem(Fmpz_expr g) .. cpp:function:: Fmpz_expr sqrt(Fmpz_expr) .. cpp:function:: bool Fmpz_expr::is_square() const Return if this expression evaluates to a square integer. .. cpp:function:: Fmpz_expr root(Fmpz_expr, T:fits_into_slong) .. cpp:function:: Fmpz_expr rfac(Fmpz_expr, T:is_unsigned_integer) .. cpp:function:: Fmpz_expr fac(T:is_unsigned_integer) .. cpp:function:: Fmpz_expr fib(T:is_unsigned_integer) .. cpp:function:: Fmpz_expr bin(T:is_unsigned_integer, U:is_unsigned_integer) Greatest common divisor ------------------------------------------------------------------------------- .. cpp:function:: Ltuple_expr gcdinv(Fmpz_expr f, Fmpz_expr g) .. cpp:function:: Ltuple_expr xgcd(Fmpz_expr f, Fmpz_expr g) .. cpp:function:: Fmpz_expr gcd(Fmpz_expr, Fmpz_expr) .. cpp:function:: Fmpz_expr lcm(Fmpz_expr, Fmpz_expr) Modular arithmetic ------------------------------------------------------------------------------- .. cpp:function:: Ltuple_expr remove(Fmpzxx a, Fmpzxx b) .. cpp:function:: int jacobi(Fmpz_expr a, Fmpz_expr p) .. cpp:function:: int Fmpz_expr::jacobi(Fmpz_expr) const .. cpp:function:: Fmpz_expr invmod(Fmpz_expr, Fmpz_expr) .. cpp:function:: Fmpz_expr negmod(Fmpz_expr, Fmpz_expr) Bit packing and unpacking ------------------------------------------------------------------------------- Beware that argument orders are different relative to the C interface, to facilitate default arguments. .. cpp:function:: static Fmpz_expr fmpzxx::bit_unpack(const vector& v, mp_bitcnt_t bits, mp_bitcnt_t shift = 0, int negate = 0, bool borrow = false) .. cpp:function:: static Fmpz_expr fmpzxx::bit_unpack_unsigned(const vector& v, mp_bitcnt_t bits, mp_bitcnt_t shift = 0) Unpack an ``fmpzxx`` from ``v``. .. cpp:function:: bool bit_pack(std::vector& v, mp_bitcnt_t bits, Fmpz_expr, mp_bitcnt_t shift = 0, int negate = 0, bool borrow = false) Pack an ``fmpzxx`` to ``v``. The vector ``v`` is required to be of sufficient size. Logic operations ------------------------------------------------------------------------------- Binary logic operators ``& | ^`` (and, or, xor) are also overloaded (implemented when both arguments are ``Fmpz_expr``). .. cpp:function:: void Fmpz_target::clrbit(ulong i) .. cpp:function:: void Fmpz_target::combit(ulong i) .. cpp:function:: int Fmpz_expr::popcnt() const Chinese remaindering ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_expr Fmpz_expr::CRT(Fmpz_expr, T:is_unsigned_integer, T:is_unsigned_integer, bool) const .. cpp:function:: Fmpz_expr CRT(Fmpz_expr, Fmpz_expr, T:is_unsigned_integer, T:is_unsigned_integer, bool) See ``fmpz_CRT_ui``. .. cpp:function:: fmpz_combxx::fmpz_combxx(const std::vector& primes) The class ``fmpz_combxx`` wraps both ``fmpz_comb_t`` and ``fmpz_comb_temp_t``. The argument ``primes`` is the vector of moduli to use, and must not be deallocated before the newly constructed ``fmpz_combxx``. Note that the internal ``fmpz_comb_temp_t`` structure may be modified even on constant instances of ``fmpz_combxx``. .. cpp:function:: void multi_mod(std::vector& out, Fmpz_expr in, const fmpz_combxx& comb) Reduce ``in`` modulo the primes stored in ``comb``, and store the results in ``out``. The vector ``out`` must have sufficient size, and its size will not be changed. .. cpp:function:: Fmpz_expr multi_CRT(const std::vector& residues, const fmpz_combxx comb, bool sign) Reconstruct an integer from its residues. See ``fmpz_multi_CRT_ui``. Primality testing ------------------------------------------------------------------------------- .. cpp:function:: bool Fmpz_expr::is_probabprime() const .. cpp:function:: bool Fmpz_expr::is_prime_pseudosquare() const Integer factoring (``fmpz_factor``) =============================================================================== .. cpp:function:: fmpz_factorxx::fmpz_factorxx() Initialise an empty factorisation. .. cpp:function:: fmpz_factorxx::fmpz_factorxx(const fmpz_factorxx& o) Copy a factorisation. .. cpp:function:: bool fmpz_factorxx::operator==(const fmpz_factorxx&) Compare two factorisations. .. cpp:function:: ulong fmpz_factorxx::size() const Return the number of stored factors. .. cpp:function:: ulong fmpz_factorxx::exp(slong i) const .. cpp:function:: ulong& fmpz_factorxx::exp(slong i) Obtain the exponent of the ith factor. .. cpp:function:: fmpzxx_srcref fmpz_factorxx::p(slong i) const .. cpp:function:: fmpzxx_ref fmpz_factorxx::p(slong i) Obtain the ith factor. .. cpp:function:: int fmpz_factorxx::sign() const .. cpp:function:: int& fmpz_factorxx::sign() Obtain the sign of the factored expression. .. cpp:function:: void fmpz_factorxx::set_factor(Fmpz_expr) .. cpp:function:: void fmpz_factorxx::set_factor(T:fits_into_slong) .. cpp:function:: bool fmpz_factorxx::set_factor_trial_range(Fmpz_expr, ulong, ulong) .. cpp:function:: bool fmpz_factorxx::set_factor_pp1(Fmpz_expr, ulong, ulong, ulong) Factorise an integer and store its factors. See ``fmpz_factor`` etc. .. cpp:function:: Fmpz_expr fmpz_factorxx::expand() const .. cpp:function:: Fmpz_expr fmpz_factorxx::expand_iterative() const .. cpp:function:: Fmpz_expr fmpz_factorxx::expand_multiexp() const .. cpp:function:: fmpz_factorxx factor(Fmpz_expr) .. cpp:function:: fmpz_factorxx factor(T:fits_into_slong) .. cpp:function:: Ltuple_expr factor_trial_range(Fmpz_expr) .. cpp:function:: fmpz_factorxx factor_pp1(Fmpz_expr) .. cpp:function:: void print(const fmpz_factorxx&) Integer matrices (``fmpz_mat``) =============================================================================== .. type:: fmpz_matxx The class ``fmpz_matxx`` wraps ``fmpz_mat_t``, and so represents matrices with coefficients in $\mathbf{Z}$. Owing to the design of ``fmpz_mat_t``, the use of ``fmpz_matxx`` has a number of peculiarities. - Matrix assignment does not automatically resize. This also includes assigning (and thus evaluating) a lazy expression to an ordinary matrix. As a consequence, the evaluation code cannot use temporary merging, and may thus create more temporaries than a similar expression involving non-matrices. - Sever.. cpp:functions operating on ``fmpz_mat_t`` do not allow aliasing. The flintxx layer just passes expressions on to the C layer, so it is the responsibility of the user to avoid aliasing where it is disallowed. Note that since no temporary merging is used with matrices, aliases are never introduced by the evaluation code. Miscellaneous ------------------------------------------------------------------------------- .. cpp:function:: slong Fmpz_mat_expr::rank() const .. cpp:function:: Fmpz_expr Fmpz_mat_expr::det_modular_given_divisor( Fmpz_mat_expr, Fmpz_expr) const See ``fmpz_mat_det_modular_given_divisor``. .. cpp:function:: Fmpz_mat_target Fmpz_mat_target::operator=(T:fits_into_slong) .. cpp:function:: Fmpz_mat_target Fmpz_mat_target::operator=(const char*) C++ particulars ------------------------------------------------------------------------------- .. cpp:function:: slong Fmpz_mat_expr::rows() const .. cpp:function:: slong Fmpz_mat_expr::cols() const Obtain the number of rows/columns in this matrix. The.. cpp:functions never cause evaluation (the matrix size is computed from the operations in the expression template and the size of the input matrices). .. cpp:function:: Fmpz_mat_expr::unary operation() const The following una.. cpp:functions are made available as member functions: ``sqr``, ``charpoly``, ``det``, ``det_bareiss``, ``det_bound``, ``det_cofactor``, ``det_divisor``, ``trace``, ``transpose``. .. cpp:function:: Fmpz_mat_expr::binary operation(??) const The following bina.. cpp:functions are made available as member functions: ``det_modular``, ``det_modular_accelerated``, ``divexact``, ``mul_classical``, ``mul_multi_mod``, ``pow``, code{solve}, ``solve_bound``, ``solve_cramer``, ``solve_dixon``, ``solve_fflu``. Memory management ------------------------------------------------------------------------------- .. cpp:function:: fmpz_matxx::fmpz_matxx(slong i, slong j) Allocate a matrix of size $i \times j$. Basic assignment and manipulation ------------------------------------------------------------------------------- .. cpp:function:: ?? Fmpz_mat_expr::at(T:fits_into_slong, U:fits_into_slong) const Unified coefficient access to the matrix entries. .. cpp:function:: void Fmpq_mat_target::set_zero() .. cpp:function:: void Fmpq_mat_target::set_one() .. cpp:function:: static fmpq_matxx fmpq_matxx::zero(slong rows, slong cols) .. cpp:function:: static fmpq_matxx fmpq_matxx::one(slong rows, slong cols) Input and output ------------------------------------------------------------------------------- .. cpp:function:: print(Fmpz_mat_expr) .. cpp:function:: print(FILE*, Fmpz_mat_expr) .. cpp:function:: print_pretty(Fmpz_mat_expr) .. cpp:function:: print_pretty(FILE*, Fmpz_mat_expr) .. cpp:function:: read(Fmpz_mat_target) .. cpp:function:: read(FILE*, Fmpz_mat_target) Comparison ------------------------------------------------------------------------------- The overloaded operator ``==`` can be used for equality testing. Additionally, we have the followi.. cpp:functions. .. cpp:function:: bool Fmpz_mat_expr::is_empty() const .. cpp:function:: bool Fmpz_mat_expr::is_quare() const Conversion ------------------------------------------------------------------------------- .. cpp:function:: static fmpz_matxx fmpz_matxx::lift(Nmod_mat_expr) .. cpp:function:: static fmpz_matxx fmpz_matxx::lift_unsigned(Nmod_mat_expr) See ``fmpz_mat_set_nmod_mat`` and ``fmpz_mat_set_nmod_mat_unsigned``. .. cpp:function:: static fmpz_matxx fmpz_matxx::reduce(Fmpq_mat_expr, Fmz_expr) See ``fmpq_mat_get_fmpz_mat_mod_fmpz``. .. cpp:function:: static fmpz_matxx fmpz_matxx::from_integral_fraction(Fmpq_mat_expr) .. cpp:function:: void Fmpz_mat_target::set_integral_fraction(Fmpq_mat_expr) See ``fmpq_mat_get_fmpz_mat``. Raises ``flint_exception`` if the argument has non-integer entries. Randomisation ------------------------------------------------------------------------------- .. cpp:function:: void Fmpz_mat_target::set_randbits(frandxx& state, mp_bitcnt_t bits) .. cpp:function:: void Fmpz_mat_target::set_randtest(frandxx& state, mp_bitcnt_t bits) .. cpp:function:: void Fmpz_mat_target::set_randintrel(frandxx& state, mp_bitcnt_t bits) .. cpp:function:: void Fmpz_mat_target::set_randsimdioph(frandxx& state, mp_bitcnt_t bits, mp_bitcount_t bits2) .. cpp:function:: void Fmpz_mat_target::set_randtrulike(frandxx& state, mp_bitcnt_t bits, ulong q) .. cpp:function:: void Fmpz_mat_target::set_randtrulike2(frandxx& state, mp_bitcnt_t bits, ulong q) .. cpp:function:: void Fmpz_mat_target::set_randajtai(frandxx& state, mp_bitcnt_t bits, double alpha) .. cpp:function:: void Fmpz_mat_target::set_randrank(frandxx& state, slong rank, mp_bitcnt_t bits) .. cpp:function:: void Fmpz_mat_target::set_randdet(frandxx& state, Fmpz_expr d) See ``fmpz_mat_randbits`` etc. .. cpp:function:: static fmpz_matxx fmpz_matxx::randbits(slong r, slong c, frandxx& state, mp_bitcnt_t bits) .. cpp:function:: static fmpz_matxx fmpz_matxx::randtest(slong r, slong c, frandxx& state, mp_bitcnt_t bits) .. cpp:function:: static fmpz_matxx fmpz_matxx::randintrel(slong r, slong c, frandxx& state, mp_bitcnt_t bits) .. cpp:function:: static fmpz_matxx fmpz_matxx::randsimdioph(slong r, slong c, frandxx& state, mp_bitcnt_t bits, mp_bitcount_t bits2) .. cpp:function:: static fmpz_matxx fmpz_matxx::randtrulike(slong r, slong c, frandxx& state, mp_bitcnt_t bits, ulong q) .. cpp:function:: static fmpz_matxx fmpz_matxx::randtrulike2(slong r, slong c, frandxx& state, mp_bitcnt_t bits, ulong q) .. cpp:function:: static fmpz_matxx fmpz_matxx::randajtai(slong r, slong c, frandxx& state, mp_bitcnt_t bits, double alpha) .. cpp:function:: static fmpz_matxx fmpz_matxx::randrank(slong r, slong c, frandxx& state, slong rank, mp_bitcnt_t bits) .. cpp:function:: static fmpz_matxx fmpz_matxx::randdet(slong r, slong c, frandxx& state, Fmpz_expr d) Static versions of the above, where the first two arguments specify the dimensions of the matrix. .. cpp:function:: int Fmpz_mat_target::set_randpermdiag(frandxx& state, Vec v) See ``fmpz_mat_randpermdiag``. The type ``vec`` must have methods ``_array()`` and ``size()`` similar to ``fmpz_vecxx``. .. cpp:function:: void Fmpz_mat_target::apply_randops(frandxx& state, slong count) See ``fmpz_mat_randops``. Transpose ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_expr transpose(Fmpz_mat_expr) Modular reduction and reconstruction ------------------------------------------------------------------------------- To reduce a single matrix modulo a word-sized modulus, see ``nmod_matxx::reduce``. We use a special class ``nmod_mat_vector`` to represent a vector of matrices reduced with respect to differing moduli. .. cpp:function:: Fmpz_mat_expr CRT(Fmpz_mat_expr, Fmpz_expr, Nmod_mat_expr, bool) See ``fmpz_mat_CRT_ui``. .. cpp:function:: nmod_mat_vector::nmod_mat_vector(slong rows, slong cols, const std::vector& primes) Initialize a vector of matrices with dimensions given by ``rows``, ``cols`` and moduli given by ``primes``. .. cpp:function:: nmod_matxx_ref nmod_mat_vector::operator[](std::size_t idx) .. cpp:function:: nmod_matxx_srcref nmod_mat_vector::operator[](std::size_t idx) const Obtain a reference to one of the stored matrices. .. cpp:function:: std::size_t nmod_mat_vector::size() const Obtain the number of stored matrices. .. cpp:function:: void nmod_mat_vector::set_multi_mod(Fmpz_mat_expr m) Reduce ``m`` modulo each of the primes stored in this vector, and store the results. See ``fmpz_mat_multi_mod_ui``. .. cpp:function:: void nmod_mat_vector::set_multi_mod_precomp(Fmpz_mat_expr m, const fmpz_combxx& comb) Reduce ``m`` modulo each of the primes stored in this vector, and store the results. Use precomputed data in ``comp``. See ``fmpz_mat_multi_mod_ui_precomp``. .. cpp:function:: nmod_mat_vector multi_mod(Fmpz_mat_expr m, const std::vector& primes) .. cpp:function:: nmod_mat_vector multi_mod_precomp(Fmpz_mat_expr m, const std::vector& primes, const fmpz_combxx& comb) Convenien.. cpp:functions combining the allocation of memory and modular reduction. Arithmetic ------------------------------------------------------------------------------- The overloaded operators ``+ - *`` can be used for ordinary matrix-matrix and matrix-scalar arithmetic. Additionally, we provide the followi.. cpp:functions. .. cpp:function:: Fmpz_mat_expr divexact(Fmpz_mat_expr, Fmpz_expr) .. cpp:function:: Fmpz_mat_expr divexact(Fmpz_mat_expr, T:is_integer) .. cpp:function:: Fmpz_mat_expr mul_classical(Fmpz_mat_expr, Fmpz_mat_expr) .. cpp:function:: Fmpz_mat_expr mul_multi_mod(Fmpz_mat_expr, Fmpz_mat_expr) .. cpp:function:: Fmpz_expr sqr(Fmpz_mat_expr) .. cpp:function:: Fmpz_mat_expr pow(Fmpz_mat_expr, T:is_unsigned_integer) Inverse ------------------------------------------------------------------------------- .. cpp:function:: Ltuple_expr inv(Fmpz_mat_expr) ``ltupleref(b, M, D) = inv(A)`` has the same effect as ``b = fmpz_mat_inv(m, d, a)``, where ``m, d, a`` are the underlying C objects corresponding to ``M, D, A``. Trace ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_mat_expr trace(Fmpz_mat_expr) Determinant ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_expr det(Fmpz_mat_expr) .. cpp:function:: Fmpz_expr det_cofactor(Fmpz_mat_expr) .. cpp:function:: Fmpz_expr det_bareiss(Fmpz_mat_expr) .. cpp:function:: Fmpz_expr det_divisor(Fmpz_mat_expr) .. cpp:function:: Fmpz_expr det_bound(Fmpz_mat_expr) .. cpp:function:: Fmpz_expr det_modular(Fmpz_mat_expr, bool proved) .. cpp:function:: Fmpz_expr det_modular_accelerated(Fmpz_mat_expr, bool proved) .. cpp:function:: Fmpz_expr det_modular_given_divisor(Fmpz_mat_expr, Fmpz_expr, bool proved) Characteristic polynomial ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_expr charpoly(Fmpz_mat_expr) Rank ------------------------------------------------------------------------------- .. cpp:function:: slong rank(Fmpz_mat_expr) Non-singular solving ------------------------------------------------------------------------------- .. cpp:function:: Ltuple_expr solve(Fmpz_mat_expr B, Fmpz_mat_expr X) .. cpp:function:: Ltuple_expr solve_dixon(Fmpz_mat_expr B, Fmpz_mat_expr X) .. cpp:function:: Ltuple_expr solve_cramer(Fmpz_mat_expr B, Fmpz_mat_expr X) .. cpp:function:: Ltuple_expr solve_fflu(Fmpz_mat_expr B, Fmpz_mat_expr X) ``ltupleref(w, M, D) = solve(B, X)`` has the same effect as ``w = fmpz_mat_solve(m, d, b, x)``, where ``m, d, b, x`` are the underlying C objects corresponding to ``M, D, B, X``. Similarly for the oth.. cpp:functions. .. cpp:function::Ltuple_expr solve_bound(Fmpz_mat_expr B, Fmpz_mat_expr X) Row reduction ------------------------------------------------------------------------------- Beware that compared to the C interface, the flintxx row reduction interface changes some argument orders. This is to facilitate default arguments. .. cpp:function:: slong find_pivot_any(Fmpz_mat_expr, slong, slong, slong) See ``fmpz_mat_find_pivot_any``. .. cpp:function:: Ltuple_expr fflu(Fmpz_mat_expr A, permxx* perm = 0, bool rankcheck = false) See ``fmpz_mat_fflu``. .. cpp:function:: Ltuple_expr rref(Fmpz_mat_expr A) See ``fmpz_mat_rref``. Modular gaussian elimination ------------------------------------------------------------------------------- .. cpp:function:: slong Fmpz_mat_target::set_rref_mod(Fmpz_expr n, permxx* perm = 0) See ``fmpz_mat_rref_mod``. Nullspace ------------------------------------------------------------------------------- .. cpp:function:: Ltuple_expr nullspace(Fmpz_mat_expr A) ``ltupleref(n, B) = nullspace(A)`` has the same effect as ``n = fmpz_mat_nullspace(b, a)``, where ``b, a`` are the underlying ``fmpz_mat_t`` corresponding to ``B, A``. Polynomials over the integers (``fmpz_polyxx``) =============================================================================== C++ particulars ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_expr::unary operation() const The following una.. cpp:functions are made available as member functions: ``derivative``, ``primitive_part``, ``sqr``, ``sqr_classical``, ``sqr_karatsuba``, ``sqr_KS``, ``sqrt``, ``sqrt_classical``, ``content``, ``height``, ``bound_roots``, ``twonorm``. .. cpp:function:: Fmpz_poly_expr::binary operation(??) const The following bina.. cpp:functions are made available as member functions: ``compose_divconquer``, ``compose_horner``, ``div_basecase``, ``div_divconquer``, ``divexact``, ``divrem``, ``divrem_basecase``, ``divrem_divconquer``, ``div_root``, ``evaluate_divconquer``, ``evaluate_horner``, ``fdiv_2exp``, ``gcd``, ``gcd_heuristic``, ``gcd_modular``, ``gcd_subresultant``, ``inv_series``, ``inv_series_newton``, ``lcm``, ``mul_2exp``, ``mul_classical``, ``mul_karatsuba``, ``mul_KS``, ``mulmid_classical``, ``mul_SS``, ``shift_left``, ``shift_right``, ``pow``, ``pow_addchains``, ``pow_binexp``, ``pow_binomial``, ``pow_multinomial``, ``pseudo_div``, ``pseudo_divrem``, ``pseudo_divrem_basecase``, ``pseudo_divrem_cohen``, ``pseudo_divrem_divconquer``, ``pseudo_rem``, ``pseudo_rem_cohen``, ``resultant``, ``reverse``, ``revert_series``, ``revert_series_lagrange``, ``revert_series_lagrange_fast``, ``revert_series_newton``, ``smod``, ``sqrlow``, ``sqrlow_classical``, ``sqrlow_karatsuba_n``, ``sqrlow_KS``, ``taylor_shift``, ``taylor_shift_horner``, ``taylor_shift_divconquer``, ``tdiv``, ``tdiv_2exp``, ``xgcd``, ``xgcd_modular``, ``divides``. .. cpp:function:: Fmpz_poly_expr::ternary operation(??, ??) const The following terna.. cpp:functions are made available as member functions: ``compose_series``, ``compose_series_brent_kung``, ``compose_horner``, ``div_series``, ``mulhigh_classical``, ``mulhigh_karatsuba_n``, ``mulhigh_n``, ``mullow``, ``mullow_classical``, ``mullow_karatsuba_n``, ``mullow_KS``, ``mullow_SS``, ``pow_trunc``. .. cpp:function:: Fmpz_poly_expr Fmpz_poly_expr::operator()(Fmpz_poly_expr) const .. cpp:function:: Fmpz_poly_expr Fmpz_poly_expr::operator()(Fmpz_expr) const Overloaded ``operator()`` for evaluation or composition. Memory management ------------------------------------------------------------------------------- .. cpp:function:: fmpz_polyxx::fmpz_polyxx() .. cpp:function:: fmpz_polyxx::fmpz_polyxx(slong alloc) See ``fmpz_poly_init2``. .. cpp:function:: fmpz_polyxx::fmpz_polyxx(const char* str) See ``fmpz_poly_set_str``. .. cpp:function:: void Fmpz_poly_target realloc(slong alloc) .. cpp:function:: void Fmpz_poly_target::fit_length(slong len) .. cpp:function:: void Fmpz_poly_target::_normalise() .. cpp:function:: void Fmpz_poly_target::_set_length(slong len) Polynomial parameters ------------------------------------------------------------------------------- .. cpp:function:: slong Fmpz_poly_expr::length() const .. cpp:function:: slong Fmpz_poly_expr::degree() const Assignment and basic manipulation ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_target Fmpz_poly_target::operator=(T:is_integer) .. cpp:function:: Fmpz_poly_target Fmpz_poly_target::operator=(Fmpz_expr) .. cpp:function:: Fmpz_poly_target Fmpz_poly_target::operator=(const char*) .. cpp:function:: std::string Fmpz_poly_expr::to_string() const .. cpp:function:: std::string Fmpz_poly_expr::pretty(const char* x) const See ``fmpz_poly_get_str_pretty``. .. cpp:function:: void Fmpz_poly_target::set_zero() .. cpp:function:: void Fmpz_poly_target::set_one() .. cpp:function:: static fmpz_polyxx fmpz_polyxx::zero() .. cpp:function:: static fmpz_polyxx fmpz_polyxx::one() .. cpp:function:: void Fmpz_poly_target::zero_coeffs(slong i, slong j) .. cpp:function:: Fmpz_poly_expr reverse(Fmpz_poly_expr, T:fits_into_slong) .. cpp:function:: void Fmpz_poly_target::truncate(slong) Randomisation ------------------------------------------------------------------------------- .. cpp:function:: static fmpz_polyxx fmpz_polyxx::randtest(frandxx& state, slong len, mp_bitcnt_t bits) .. cpp:function:: static fmpz_polyxx fmpz_polyxx::randtest_unsigned(frandxx& state, slong len, mp_bitcnt_t bits) .. cpp:function:: static fmpz_polyxx fmpz_polyxx::randtest_not_zero(frandxx& state, slong len, mp_bitcnt_t bits) See ``fmpz_poly_randtest`` etc. Getting and setting coefficients ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_expr Fmpz_poly_expr::get_coeff(slong n) Obtain coefficient $n$ of the polynomial. It is valid to call this with $n$ greater than the degree, in which case zero is returned. .. cpp:function:: void Fmpz_poly_target::set_coeff(slong n, Fmpz_expr) .. cpp:function:: void Fmpz_poly_target::set_coeff(slong n, T:is_integer) .. cpp:function:: ?? Fmpz_poly_expr::coeff(slong n) const Unified coefficient access for coefficient $n$. The result is undefined if $n$ is greater than the degree of the polynomial (or negative). If the leading coefficient of the polynomial is set to zero in this way, a call to ``_normalise`` is necessary. .. cpp:function:: ?? Fmpz_poly_expr::lead() const Unified coefficient access for the leading coefficient. The result is undefined if the length of the polynomial is zero. If this is used to set the leading coefficient to zero, call to ``_normalise`` is necessary. Comparison ------------------------------------------------------------------------------- As usual, ``fmpz_polyxx`` can be compared using ``operator==``. Additionally, the followi.. cpp:functions are provided. .. cpp:function:: bool Fmpz_poly_expr::is_one() const .. cpp:function:: bool Fmpz_poly_expr::is_zero() const .. cpp:function:: bool Fmpz_poly_expr::is_unit() const Addition and subtraction ------------------------------------------------------------------------------- The overloaded operators ``+ -`` can be used for addition, subtraction and negation. Scalar multiplication and division ------------------------------------------------------------------------------- The overloaded operators ``* /`` can be used for scalar multiplication and division, and the operator \code{\%} for remaindering. For finer control, the followi.. cpp:functions are provided. .. cpp:function:: Fmpz_poly_expr mul_2exp(Fmpz_poly_expr, T:is_unsigned_integer) .. cpp:function:: Fmpz_poly_expr fdiv_2exp(Fmpz_poly_expr, T:is_unsigned_integer) .. cpp:function:: Fmpz_poly_expr tdiv(Fmpz_poly_expr, Fmpz_expr) .. cpp:function:: Fmpz_poly_expr tdiv(Fmpz_poly_expr, T:is_integer) .. cpp:function:: Fmpz_poly_expr divexact(Fmpz_poly_expr, Fmpz_expr) .. cpp:function:: Fmpz_poly_expr divexact(Fmpz_poly_expr, T:is_integer) .. cpp:function:: Fmpz_poly_expr smod(Fmpz_poly_expr, Fmpz_expr) See ``fmpz_poly_scalar_smod_fmpz``. Bit packing ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_expr bit_pack(Fmpz_poly_expr, T:fits_into_mp_bitcnt_t) .. cpp:function:: static Fmpz_poly_expr fmpz_polyxx::bit_unpack(Fmpz_expr, T:fits_into_mp_bitcnt_t) .. cpp:function:: static Fmpz_poly_expr fmpz_polyxx::bit_unpack_unsigned(Fmpz_expr, traits::fits_into_mp_bitcnt_t) Multiplication ------------------------------------------------------------------------------- The overloaded operator ``*`` can also be used for poly-poly multiplication. Additionally, the followi.. cpp:functions are provided. .. cpp:function:: Fmpz_poly_expr mul_classical(Fmpz_poly_expr, Fmpz_poly_expr) .. cpp:function:: Fmpz_poly_expr mulmid_classical(Fmpz_poly_expr, Fmpz_poly_expr) .. cpp:function:: Fmpz_poly_expr mul_karatsuba(Fmpz_poly_expr, Fmpz_poly_expr) .. cpp:function:: Fmpz_poly_expr mul_SS(Fmpz_poly_expr, Fmpz_poly_expr) .. cpp:function:: Fmpz_poly_expr mul_KS(Fmpz_poly_expr, Fmpz_poly_expr) .. cpp:function:: Fmpz_poly_expr mullow(Fmpz_poly_expr, Fmpz_poly_expr, slong) .. cpp:function:: Fmpz_poly_expr mullow_classical(Fmpz_poly_expr, Fmpz_poly_expr, slong) .. cpp:function:: Fmpz_poly_expr mullow_karatsuba_n(Fmpz_poly_expr, Fmpz_poly_expr, slong) .. cpp:function:: Fmpz_poly_expr mullow_KS(Fmpz_poly_expr, Fmpz_poly_expr, slong) .. cpp:function:: Fmpz_poly_expr mullow_SS(Fmpz_poly_expr, Fmpz_poly_expr, slong) .. cpp:function:: Fmpz_poly_expr mulhigh_n(Fmpz_poly_expr, Fmpz_poly_expr, slong) .. cpp:function:: Fmpz_poly_expr mulhigh_classical(Fmpz_poly_expr, Fmpz_poly_expr, slong) .. cpp:function:: Fmpz_poly_expr mulhigh_karatsuba_n(Fmpz_poly_expr, Fmpz_poly_expr, slong) Squaring ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_expr sqr(Fmpz_poly_expr) .. cpp:function:: Fmpz_poly_expr sqr_KS(Fmpz_poly_expr) .. cpp:function:: Fmpz_poly_expr sqr_karatsuba(Fmpz_poly_expr) .. cpp:function:: Fmpz_poly_expr sqr_classical(Fmpz_poly_expr) .. cpp:function:: Fmpz_poly_expr sqrlow(Fmpz_poly_expr, T:fits_into_slong n) .. cpp:function:: Fmpz_poly_expr sqrlow_classical(Fmpz_poly_expr, T:fits_into_slong n) .. cpp:function:: Fmpz_poly_expr sqrlow_KS(Fmpz_poly_expr, T:fits_into_slong n) .. cpp:function:: Fmpz_poly_expr sqrlow_karatsuba_n(Fmpz_poly_expr, T:fits_into_slong n) Powering ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_expr pow(Fmpz_poly_expr, T:is_unsigned_integer) .. cpp:function:: Fmpz_poly_expr pow_multinomial(Fmpz_poly_expr, T:is_unsigned_integer) .. cpp:function:: Fmpz_poly_expr pow_binomial(Fmpz_poly_expr, T:is_unsigned_integer) .. cpp:function:: Fmpz_poly_expr pow_binexp(Fmpz_poly_expr, T:is_unsigned_integer) .. cpp:function:: Fmpz_poly_expr pow_addchains(Fmpz_poly_expr, T:is_unsigned_integer) .. cpp:function:: Fmpz_poly_expr pow_trunc(Fmpz_poly_expr, ulong e, slong n) Shifting ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_expr shift_left(Fmpz_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpz_poly_expr shift_right(Fmpz_poly_expr, T:fits_into_slong) Bit sizes and norms ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_expr height(Fmpz_poly_expr) .. cpp:function:: Fmpz_expr twonorm(Fmpz_poly_expr) .. cpp:function:: ulong Fmpz_poly_expr::max_limbs() const .. cpp:function:: slong Fmpz_poly_expr::max_bits() const Greatest common divisor ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_expr gcd(Fmpz_poly_expr, Fmpz_poly_expr) .. cpp:function:: Fmpz_poly_expr gcd_subresultant(Fmpz_poly_expr, Fmpz_poly_expr) .. cpp:function:: Fmpz_poly_expr gcd_heuristic(Fmpz_poly_expr, Fmpz_poly_expr) .. cpp:function:: Fmpz_poly_expr gcd_modular(Fmpz_poly_expr, Fmpz_poly_expr) .. cpp:function:: Fmpz_poly_expr lcm(Fmpz_poly_expr, Fmpz_poly_expr) .. cpp:function:: Ltuple_expr xgcd(Fmpz_poly_expr f, Fmpz_poly_expr g) .. cpp:function:: Ltuple_expr xgcd_modular(Fmpz_poly_expr f, Fmpz_poly_expr g) ``ltupleref(N, Q, R) = xgcd(F, G)`` has the same effect as ``fmpz_poly_xgcd(n, q, r, f, g)`` where ``n, q, r, f, g`` are the underlying C objects. .. cpp:function:: Fmpz_expr resultant(Fmpz_poly_expr) Gaussian content ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_expr content(Fmpz_poly_expr) .. cpp:function:: Fmpz_poly_expr primitive_part(Fmpz_poly_expr) Square-free ------------------------------------------------------------------------------- .. cpp:function:: bool Fmpz_poly_expr::is_squarefree() const Euclidean division ------------------------------------------------------------------------------- The overloaded operators ``/ %`` can be used for euclidean division and remainder. Additionally, the followi.. cpp:functions are provided. .. cpp:function:: Fmpz_poly_expr div_basecase(Fmpz_poly_expr, Fmpz_poly_expr) .. cpp:function:: Fmpz_poly_expr div_divconquer(Fmpz_poly_expr, Fmpz_poly_expr) .. cpp:function:: Fmpz_poly_expr rem_basecase(Fmpz_poly_expr, Fmpz_poly_expr) .. cpp:function:: Ltuple_expr divrem(Fmpz_poly_expr A, Fmpz_poly_expr B) .. cpp:function:: Ltuple_expr divrem_basecase(Fmpz_poly_expr A, Fmpz_poly_expr B) .. cpp:function:: Ltuple_expr divrem_divconquer(Fmpz_poly_expr A, Fmpz_poly_expr B) ``ltupleref(Q, R) = divrem(A, B)`` has the same effect as ``fmpz_poly_divrem(q, r, a, b)``, where ``q, r, a, b`` are the underlying ``fmpz_poly_t`` corresponding to ``Q, R, A, B``. .. cpp:function:: Fmpz_poly_expr div_root(Fmpz_poly_expr, Fmpz_expr) Divisibility testing ------------------------------------------------------------------------------- .. cpp:function:: Ltuple_expr divides(Fmpz_poly_expr A, Fmpz_poly_expr B) ``ltupleref(d, Q) = divides(A, B)`` sets ``d`` to ``true`` and ``Q`` to ``A/B`` if ``B`` divides ``A``, and else sets ``d`` to ``false``. See ``fmpz_poly_divides``. Power series division ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_expr inv_series_newton(Fmpz_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpz_poly_expr inv_series(Fmpz_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpz_poly_expr div_series(Fmpz_poly_expr, Fmpz_poly_expr, slong n) Pseudo division ------------------------------------------------------------------------------- .. cpp:function:: Ltuple_expr pseudo_divrem(Fmpz_poly_expr A, Fmpz_poly_expr B) .. cpp:function:: Ltuple_expr pseudo_divrem_basecase(Fmpz_poly_expr A, Fmpz_poly_expr B) .. cpp:function:: Ltuple_expr pseudo_divrem_divconquer(Fmpz_poly_expr A, Fmpz_poly_expr B) ``ltupleref(Q, R, d) = pseudo_divrem(A, B)`` has the same effect as\\ ``fmpz_poly_pseudo_divrem(q, r, &d, a, b)``, where ``q, r, a, b`` are the underlying ``fmpz_poly_t`` corresponding to ``Q, R, A, B``. .. cpp:function:: Ltuple_expr pseudo_divrem_cohen(Fmpz_poly_expr A, Fmpz_poly_expr B) ``ltupleref(Q, R) = pseudo_divrem_cohen(A, B)`` has the same effect as\\ ``fmpz_poly_pseudo_divrem_cohen(q, r, a, b)``, where ``q, r, a, b`` are the underlying ``fmpz_poly_t`` corresponding to ``Q, R, A, B``. .. cpp:function:: Ltuple_expr pseudo_div(Fmpz_poly_expr A, Fmpz_poly_expr B) .. cpp:function:: Ltuple_expr pseudo_rem(Fmpz_poly_expr A, Fmpz_poly_expr B) ``ltupleref(Q, d) = pseudo_div(A, B)`` has the same effect as ``fmpz_poly_pseudo_div(q, &d, a, b)``, where ``q, a, b`` are the underlying ``fmpz_poly_t`` corresponding to ``Q, A, B``. .. cpp:function:: Fmpz_poly_expr pseudorem_cohen(Fmpz_poly_expr, Fmpz_poly_expr) Derivative ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_expr derivative(Fmpz_poly_expr) Evaluation ------------------------------------------------------------------------------- The overloaded ``operator()`` can be used for evaluation. Additionally, the followi.. cpp:functions are provided. .. cpp:function:: Fmpz_expr evaluate(Fmpz_poly_expr, Fmpz_expr) .. cpp:function:: Fmpz_vec_expr evaluate(Fmpz_poly_expr, Fmpz_vec_expr) .. cpp:function:: Fmpz_expr evaluate_horner(Fmpz_poly_expr, Fmpz_expr) .. cpp:function:: Fmpz_expr evaluate_divconquer(Fmpz_poly_expr, Fmpz_expr) .. cpp:function:: mp_limb_t evaluate_mod(Fmpz_poly_expr p, mp_limb_t x, mp_limb_t n) Interpolation ------------------------------------------------------------------------------- .. cpp:function:: static Fmpz_poly_expr fmpz_polyxx::interpolate(Fmpz_vec_expr xs, Fmpz_vec_expr ys) See ``fmpz_poly_interpolate_fmpz_vec``. Composition. ------------------------------------------------------------------------------- The overloaded ``operator()`` can be used for composition. Additionally, the followi.. cpp:functions are provided. .. cpp:function:: Fmpz_poly_expr compose(Fmpz_poly_expr, Fmpz_poly_expr) .. cpp:function:: Fmpz_poly_expr compose_horner(Fmpz_poly_expr, Fmpz_poly_expr) .. cpp:function:: Fmpz_poly_expr compose_divconquer(Fmpz_poly_expr, Fmpz_poly_expr) Taylor shift ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_expr taylor_shift(Fmpz_poly_expr, Fmpz_expr) .. cpp:function:: Fmpz_poly_expr taylor_shift_horner(Fmpz_poly_expr, Fmpz_expr) .. cpp:function:: Fmpz_poly_expr taylor_shift_divconquer(Fmpz_poly_expr, Fmpz_expr) Power series composition ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_expr compose_series(Fmpz_poly_expr, Fmpz_poly_expr, slong) .. cpp:function:: Fmpz_poly_expr compose_series_horner(Fmpz_poly_expr, Fmpz_poly_expr, slong) .. cpp:function:: Fmpz_poly_expr compose_series_brent_kung(Fmpz_poly_expr, Fmpz_poly_expr, slong) Power series reversion ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_expr revert_series(Fmpz_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpz_poly_expr revert_series_newton(Fmpz_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpz_poly_expr revert_series_lagrange(Fmpz_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpz_poly_expr revert_series_lagrange_fast(Fmpz_poly_expr, T:fits_into_slong) Square root ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_expr sqrt(Fmpz_poly_expr p) .. cpp:function:: Fmpz_poly_expr sqrt_classical(Fmpz_poly_expr p) Compute the square root of ``p``, provided ``p`` is a perfect square. Else raise ``flint_exception``. See ``fmpz_poly_sqrt``. Signature ------------------------------------------------------------------------------- .. cpp:function:: void Fmpz_poly_expr::signature(slong& r1, slong& r2) const See ``fmpz_poly_signature``. Hensel lifting ------------------------------------------------------------------------------- .. cpp:function:: Ltuple_expr hensel_lift(Fmpz_poly_expr f, Fmpz_poly_expr g, Fmpz_poly_expr h, Fmpz_poly_expr a, Fmpz_poly_expr b, Fmpz_expr p, Fmpz_expr p1) .. cpp:function:: Ltuple_expr hensel_lift_without_inverse(Fmpz_poly_expr f, Fmpz_poly_expr g, Fmpz_poly_expr h, Fmpz_poly_expr a, Fmpz_poly_expr b, Fmpz_expr p, Fmpz_expr p1) .. cpp:function:: Ltuple_expr hensel_lift_only_inverse(Fmpz_poly_expr G, Fmpz_poly_expr H, Fmpz_poly_expr a, Fmpz_poly_expr b, Fmpz_expr p, Fmpz_expr p1) See ``fmpz_poly_hensel_lift`` etc. .. cpp:function:: fmpz_poly_factorxx::set_hensel_lift_once(Fmpz_poly_expr, const nmod_poly_factorxx&, slong) .. cpp:function:: fmpz_poly_factorxx hensel_lift_once(Fmpz_poly_expr, const nmod_poly_factorxx&, slong) See ``fmpz_poly_hensel_lift_once``. Note that these two .. cpp:functions are defined in the ``fmpz_factorxx`` module. Input and output ------------------------------------------------------------------------------- .. cpp:function:: print(Fmpz_poly_expr) .. cpp:function:: print(FILE*, Fmpz_poly_expr) .. cpp:function:: print_pretty(Fmpz_poly_expr, const char* var) .. cpp:function:: print_pretty(FILE*, Fmpz_poly_expr, const char* var) .. cpp:function:: read(Fmpz_poly_target) .. cpp:function:: read(FILE*, Fmpz_poly_target) .. cpp:function:: read_pretty(Fmpz_poly_target, const char* var) .. cpp:function:: read_pretty(FILE*, Fmpz_poly_target, const char* var) Modular reduction and reconstruction ------------------------------------------------------------------------------- For modular reduction, see ``nmod_polyxx::reduce``. .. cpp:function:: Fmpz_poly_expr Fmpz_poly_expr::CRT(Fmpz_expr, Nmod_poly_expr, bool) .. cpp:function:: Fmpz_poly_expr CRT(Fmpz_poly_expr, Fmpz_expr, Nmod_poly_expr, bool) See ``fmpz_poly_CRT_ui``. Products ------------------------------------------------------------------------------- .. cpp:function:: static Fmpz_poly_expr fmpz_polyxx::product_roots(Fmpz_vec_expr xs) See ``fmpz_poly_product_roots_fmpz_vec``. Roots ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_expr bound_roots(Fmpz_poly_expr p) Factorisation of polynomials over the integers (``fmpz_poly_factorxx``) =============================================================================== Miscellaneous ------------------------------------------------------------------------------- .. cpp:function:: bool fmpz_poly_factorxx::operator==(const fmpz_poly_factorxx&) Compare two factorisations. .. cpp:function:: ulong fmpz_poly_factorxx::size() const Return the number of stored factors. .. cpp:function:: slong fmpz_poly_factorxx::exp(slong i) const .. cpp:function:: slong& fmpz_poly_factorxx::exp(slong i) Obtain the exponent of the ith factor. .. cpp:function:: fmpz_polyxx_srcref fmpz_poly_factorxx::p(slong i) const .. cpp:function:: fmpz_polyxx_ref fmpz_poly_factorxx::p(slong i) Obtain the ith factor. .. cpp:function:: fmpzxx_srcref fmpz_poly_factorxx::content() const .. cpp:function:: fmpzxx_ref fmpz_poly_factorxx::content() Obtain the content of the factorised polynomial. Memory management ------------------------------------------------------------------------------- .. cpp:function:: fmpz_poly_factorxx::fmpz_poly_factorxx() .. cpp:function:: explicit fmpz_poly_factorxx::fmpz_poly_factorxx(slong alloc) Initialise an empty factorisation. .. cpp:function:: fmpz_poly_factorxx::fmpz_poly_factorxx(const fmpz_poly_factorxx& o) Copy a factorisation. .. cpp:function:: void fmpz_poly_factorxx::realloc(slong a) .. cpp:function:: void fmpz_poly_factorxx::fit_length(slong a) Manipulating factors ------------------------------------------------------------------------------- .. cpp:function:: void fmpz_poly_factorxx::insert(Fmpz_poly_expr p, slong e) .. cpp:function:: void fmpz_poly_factorxx::concat(const fmpz_poly_factorxx&) Factoring algorithms ------------------------------------------------------------------------------- .. cpp:function:: void fmpz_poly_factorxx::set_factor_squarefree(Fmpz_poly_expr p) .. cpp:function:: void fmpz_poly_factorxx::set_factor_zassenhaus(Fmpz_poly_expr p) .. cpp:function:: void fmpz_poly_factorxx::set_factor_zassenhaus_recombination(const fmpz_poly_factorxx& lifted_fac, Fmpz_poly_expr F, Fmpz_expr P, slong exp) .. cpp:function:: fmpz_poly_factorxx::factor_squarefree(Fmpz_poly_expr) .. cpp:function:: fmpz_poly_factorxx::factor_zassenhaus(Fmpz_poly_expr) Rationals (``fmpq``) =============================================================================== C++ particulars ------------------------------------------------------------------------------- .. cpp:function:: ?? Fmpq_expr::num() const .. cpp:function:: ?? Fmpq_expr::den() const Unified coefficient access to numerator and denominator. If this is used to modify the object, a call to ``canonicalise()`` may be necessary. Memory management ------------------------------------------------------------------------------- .. cpp:function:: fmpqxx::fmqxx() Initialize to zero. .. cpp:function:: fmpqxx::fmpqxx(Fmpz_src num, Fmpz_src den) .. cpp:function:: fmpqxx::fmpqxx(T:fits_into_slong num, U:is_unsigned_integer den) Initialize from numerator ``num`` and denominator ``den``. Canonicalisation ------------------------------------------------------------------------------- .. cpp:function:: void Fmpq_target::canonicalise() .. cpp:function:: bool Fmpq_src::is_canonical() const Basic assignment ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_expr Fmpq_expr::abs() const .. cpp:function:: Fmpq_expr abs(Fmpq_expr) .. cpp:function:: void Fmpq_target::set_zero() .. cpp:function:: void Fmpq_target::set_one() .. cpp:function:: static fmpqxx fmpqxx::zero() .. cpp:function:: static fmpqxx fmpqxx::one() Comparison ------------------------------------------------------------------------------- The overloaded relational operators can be used for comparison. Additionally, we have the followi.. cpp:functions. .. cpp:function:: bool Fmpq_expr::is_zero() const .. cpp:function:: bool Fmpq_expr::is_one() const .. cpp:function:: int Fmpq_expr::sgn() const .. cpp:function:: mp_bitcnt_t Fmpq_expr::height_bits() const .. cpp:function:: Fmpz_expr Fmpq_expr::height() const .. cpp:function:: mp_bitcnt_t height_bits(Fmpq_expr) .. cpp:function:: Fmpq_expr height(Fmpq_expr) Conversion ------------------------------------------------------------------------------- Conversion can be done using the assignment operator, and through the followi.. cpp:functions. .. cpp:function:: static fmpqxx fmpqxx::frac(const T& t, const U& u) Same as ``fmpqxx res;res.set_frac(t, u)``. .. cpp:function:: static fmpqxx fmpqxx::integer(const T& t) Same as ``fmpqxx res;res.set_integer(t)``. .. cpp:function:: void Fmpq_target::set_frac(const T& t, const U& u) ``f.set_frac(t, u)`` has the same effect as ``f.num() = t;f.den() = u;f.canonicalise()``. .. cpp:function:: void Fmpq_target::set_integer(const T& t) ``f.set_integer(t)`` has the same effect as ``f.num() = t;f.den() = 1u``; .. cpp:function:: std::string Fmpq_expr::to_string(int base = 10) const Input and output ------------------------------------------------------------------------------- .. cpp:function:: int print(Fmpq_expr) .. cpp:function:: int print(FILE*, Fmpq_expr) Random number generation ------------------------------------------------------------------------------- .. cpp:function:: static fmpqxx fmpqxx::randbits(frandxx& state) .. cpp:function:: static fmpqxx fmpqxx::randtest(frandxx& state) .. cpp:function:: static fmpqxx fmpqxx::randtest_not_zero(frandxx& state) Arithmetic ------------------------------------------------------------------------------- The overloaded operators ``+ - * /`` can be used for arithmetic. Additionally, we provide the followi.. cpp:functions. .. cpp:function:: Fmpq_expr Fmpq_expr::inv() const .. cpp:function:: Fmpq_expr Fmpq_expr::pow(T:fits_into_slong) const .. cpp:function:: Fmpq_expr inv(Fmpq_expr) .. cpp:function:: Fmpq_expr pow(Fmpq_expr, T:fits_into_slong) .. cpp:function:: Fmpq_expr operator<<(Fmpq_expr, T:is_integer) .. cpp:function:: Fmpq_expr operator>>(Fmpq_expr, T:is_integer) Shift operators are overloaded. See ``fmpq_div_2exp`` and ``fmpq_mul_2exp``. Modular reduction and rational reconstruction ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_expr operator%(Fmpq_expr, Fmpz_expr) See ``fmpq_mod_fmpz``. The modular reduction operator may raise a ``flint_exception`` if modular inversion is not possible. .. cpp:function:: static Fmpq_expr fmpqxx::reconstruct(Fmpz_expr a, Fmpz_expr m, Fmpz_expr N, Fmpz_expr D) .. cpp:function:: static Fmpq_expr fmpqxx::reconstruct(Fmpz_expr a, Fmpz_expr m) Rational reconstruction. May raise a ``flint_exception`` if reconstruction is not possible. See ``fmpq_reconstruct_fmpz`` and ``fmpq_reconstruct_fmpz2``. Rational enumeration ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_expr Fmpq_expr::next_minimal() const .. cpp:function:: Fmpq_expr Fmpq_expr::next_signed_minimal() const .. cpp:function:: Fmpq_expr Fmpq_expr::next_calkin_wilf() const .. cpp:function:: Fmpq_expr Fmpq_expr::next_signed_calkin_wilf() const Continued fractions ------------------------------------------------------------------------------- .. cpp:function:: slong Fmpq_expr::cfrac_bound() const .. cpp:function:: template void Fmpq_target::set_cfrac(const Vec& v, slong n) Set value to a partial fraction expansion. The same conventions apply to ``v`` as in the constructor. .. cpp:function:: template static fmpqxx fmpqxx::from_cfrac(const Vec& v, slong n) Initialize from a partial fraction expansion. ``v`` must be an instance of a class which provides a method ``_array()`` that returns (a pointer to) an array of ``fmpz``. One such class is ``fmpz_vecxx``. The array must have size (at least) ``n``. Matrices over the rationals (``fmpq_matxx``) =============================================================================== The class ``fmpq_matxx`` wraps ``fmpq_mat_t``. Like ``fmpz_matxx``, many operations on ``fmpq_matxx`` do not support aliasing. The details can be found in the documentation of ``fmpq_mat_t``. Since ``fmpq_matxx`` does not use temporary merging, evaluation of subexpressions never creates new aliases. .. cpp:function:: Fmpq_mat_expr::unary operation() const The following una.. cpp:functions are made available as member functions: ``inv``, ``transpose``, ``det``, ``trace``, ``numden_entrywise``, ``numden_rowwise``, ``numden_colwise``, ``numden_matwise``, ``num_rowwise``. .. cpp:function:: Fmpq_mat_expr::binary operation(??) const The following bina.. cpp:functions are made available as member functions: ``solve_dixon``, ``solve_fraction_free``, ``mul_cleared``, ``mul_direct``. .. cpp:function:: Fmpq_mat_expr operator?(??, ??) Arithmetic operators ``+ - * /`` are overloaded when provided by ``fmpq_mat_t``. .. cpp:function:: Fmpq_mat_expr operator-(Fmpq_mat_expr) The unary negation operator is overloaded. .. cpp:function:: Fmpq_mat_target Fmpq_mat_target::operator=(Fmpz_mat_expr) See ``fmpq_mat_set_fmpz_mat``. Memory management ------------------------------------------------------------------------------- .. cpp:function:: fmpq_matxx::fmpq_matxx(slong m, slong n) See ``fmpq_mat_init``. Input and output ------------------------------------------------------------------------------- .. cpp:function:: int print(Fmpq_mat_expr) Entry access ------------------------------------------------------------------------------- .. cpp:function:: ?? Fmpq_mat_expr::at(slong, slong) const Unified coefficient access to the entries of the matrix. Basic assignment ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_mat_expr transpose(Fmpq_poly_mat_expr) .. cpp:function:: void Fmpq_mat_target::set_zero() .. cpp:function:: void Fmpq_mat_target::set_one() .. cpp:function:: static fmpq_matxx fmpq_matxx::zero(slong rows, slong cols) .. cpp:function:: static fmpq_matxx fmpq_matxx::one(slong rows, slong cols) Random matrix generation ------------------------------------------------------------------------------- .. cpp:function:: void Fmpq_mat_target::set_randtest(frandxx& state, slong len, mp_bitcnt_t) .. cpp:function:: static fmpq_matxx fmpq_matxx::randtest(slong rows, slong cols, frandxx& state, slong len, mp_bitcnt_t) .. cpp:function:: void Fmpq_mat_target::set_randtest_unsigned(frandxx& state, slong len, mp_bitcnt_t) .. cpp:function:: static fmpq_matxx fmpq_matxx::randtest_unsigned(slong rows, slong cols, frandxx& state, slong len, mp_bitcnt_t) Special matrices ------------------------------------------------------------------------------- .. cpp:function:: void Fmpq_target::set_hilbert_matrix() .. cpp:function:: Fmpq_mat_expr hilbert_matrix(slong m, slong n) Basic properties ------------------------------------------------------------------------------- .. cpp:function:: bool Fmpq_mat_expr::is_zero() const .. cpp:function:: bool Fmpq_mat_expr::is_empty() const .. cpp:function:: bool Fmpq_mat_expr::is_square() const .. cpp:function:: bool Fmpq_mat_expr::is_integral() const Integer matrix conversion ------------------------------------------------------------------------------- .. cpp:function:: static fmpq_matxx fmpq_matxx::frac(Fmpz_mat_expr, Fmpz_expr) .. cpp:function:: void Fmpq_mat_target::set_frac(Fmpz_mat_expr, Fmpz_expr) See ``fmpq_mat_set_fmpz_mat_div_fmpz``. .. cpp:function:: static fmpq_matxx fmpq_matxx::integer_matrix(Fmpz_mat_expr) See ``fmpq_mat_set_fmpz_mat``. .. cpp:function:: Fmpz_mat_expr num_rowwise(Fmpq_mat_expr) This has the effect of calling ``fmpq_mat_get_fmpz_mat_rowwise`` with second argument ``NULL``. .. cpp:function:: Ltuple_expr numden_entrywise(Fmpq_mat_expr) See ``fmpq_mat_get_fmpz_mat_entrywise``. .. cpp:function:: Ltuple_expr numden_matwise(Fmpq_mat_expr) See ``fmpq_mat_get_fmpz_mat_matwise``. .. cpp:function:: Ltuple_expr numden_rowwise(Fmpq_mat_expr) See ``fmpq_mat_get_fmpz_mat_rowwise``. .. cpp:function:: Ltuple_expr numden_colwise(Fmpq_mat_expr) See ``fmpq_mat_get_fmpz_mat_colwise``. Modular reduction and rational reconstruction ------------------------------------------------------------------------------- To reduce an ``fmpq_matxx`` modulo an ``fmpzxx`` to get an ``fmpz_matxx``, see ``fmpz_matxx::reduce``. .. cpp:function:: static fmpq_matxx fmpq_matxx::reconstruct(Fmpz_mat_expr, Fmpz_expr) See ``fmpq_mat_set_fmpz_mat_mod_fmpz``. Matrix multiplication ------------------------------------------------------------------------------- The overloaded ``operator*`` can be used for matrix multiplication. Finer control can be obtained using the followi.. cpp:functions. .. cpp:function:: Fmpq_mat_expr mul_direct(Fmpq_mat_expr, Fmpq_mat_expr) .. cpp:function:: Fmpq_mat_expr mul_cleared(Fmpq_mat_expr, Fmpq_mat_expr) Trace ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_expr trace(Fmpq_mat_expr) Determinant ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_expr det(Fmpq_mat_expr) Nonsingular solving ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_mat_expr solve_dixon(Fmpq_mat_expr B, Fmpq_mat_expr X) .. cpp:function:: Fmpq_mat_expr solve_fraction_free(Fmpq_mat_expr B, Fmpq_mat_expr X) See ``fmpq_mat_solve_dixon`` and ``fmpq_mat_solve_fraction_free``. Raises ``flint_exception`` if $B$ is singular. Inverse ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_mat_expr inv(Fmpq_mat_expr A) Compute the inverse of the square matrix $A$. Raises ``flint_exception`` if $A$ is singular. The modulus is required to be prime. Echelon form ------------------------------------------------------------------------------- .. cpp:function:: bool Fmpq_mat_target::pivot(slong r, slong c, permxx* perm = 0) See ``fmpq_mat_pivot``. .. cpp:function:: Ltuple_expr rref(Fmpq_mat_expr) .. cpp:function:: Ltuple_expr rref_classical(Fmpq_mat_expr) .. cpp:function:: Ltuple_expr rref_fraction_free(Fmpq_mat_expr) See ``fmpq_mat_rref`` etc. Polynomials over the rationals (``fmpq_poly``) =============================================================================== C++ particulars ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_poly_expr Fmpq_poly_expr::operator()(Fmpq_poly_expr) const .. cpp:function:: Fmpq_poly_expr Fmpq_poly_expr::operator()(Fmpq_expr) const Overloaded ``operator()`` for evaluation or composition. .. cpp:function:: Fmpq_poly_expr::unary operation() const The following una.. cpp:functions are made available as member functions: ``derivative``, ``integral``, ``inv``, ``make_monic``, ``primitive_part``, ``content``. .. cpp:function:: Fmpq_poly_expr::binary operation(??) const The following bina.. cpp:functions are made available as member functions: ``asinh_series``, ``asin_series``, ``atanh_series``, ``atan_series``, ``cosh_series``, ``cos_series``, ``divrem``, ``exp_series``, ``gcd``, ``inv_series``, ``inv_series_newton``, ``lcm``, ``log_series``, ``pow``, ``resultant``, ``reverse``, ``revert_series``, ``revert_series_lagrange``, ``revert_series_lagrange_fast``, ``revert_series_newton``, ``sinh_series``, ``tanh_series``, ``tan_series``, ``xgcd``, ``rescale``,\\ ``shift_left``, ``shift_right``. .. cpp:function:: Fmpq_poly_expr::ternary operation(??, ??) const The following terna.. cpp:functions are made available as member functions: ``compose_series``, ``compose_series_brent_kung``, ``compose_series_horner``, ``div_series``, ``mullow``. Memory management ------------------------------------------------------------------------------- .. cpp:function:: fmpq_polyxx::fmpq_polyxx() .. cpp:function:: fmpq_polyxx::fmpq_polyxx(slong alloc) See ``fmpq_poly_init2``. .. cpp:function:: fmpq_polyxx::fmpq_polyxx(const char* str) See ``fmpq_poly_set_str``. .. cpp:function:: void Fmpq_poly_target realloc(slong alloc) .. cpp:function:: void Fmpq_poly_target::fit_length(slong len) .. cpp:function:: void Fmpq_poly_target::_normalise() .. cpp:function:: void Fmpq_poly_target::_set_length(slong len) .. cpp:function:: void Fmpq_poly_target::canonicalise() .. cpp:function:: bool Fmpq_poly_src::is_canonical() const Polynomial parameters ------------------------------------------------------------------------------- .. cpp:function:: slong Fmpq_poly_expr::length() const .. cpp:function:: slong Fmpq_poly_expr::degree() const Accessing the numerator and denominator ------------------------------------------------------------------------------- .. cpp:function:: fmpqxx_ref Fmpq_poly_target::get_coeff_numref(slong n) .. cpp:function:: fmpqxx_srcref Fmpq_poly_src::get_coeff_numref(slong n) const Obtain a reference to the numerator of coefficient $n$. The result is undefined if $n$ is greater than the degree of the polynomial (or negative). If this is used to modify the object, a call to ``canonicalise()`` may be necessary. (No unified access, see ``get_coeff``.) .. cpp:function:: ?? Fmpq_poly_expr::den() const Unified coefficient access to the denominator of the polynomial. If this is used to modify the object, a call to ``canonicalise()`` may be necessary. Random testing ------------------------------------------------------------------------------- .. cpp:function:: static fmpq_polyxx fmpq_polyxx::randtest(frandxx& state, slong len, mp_bitcnt_t bits) .. cpp:function:: static fmpq_polyxx fmpq_polyxx::randtest_unsigned(frandxx& state, slong len, mp_bitcnt_t bits) .. cpp:function:: static fmpq_polyxx fmpq_polyxx::randtest_not_zero(frandxx& state, slong len, mp_bitcnt_t bits) See ``fmpq_poly_randtest`` etc. Assignment ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_poly_target Fmpq_poly_target::operator=(T:is_integer) .. cpp:function:: Fmpq_poly_target Fmpq_poly_target::operator=(Fmpq_expr) .. cpp:function:: Fmpq_poly_target Fmpq_poly_target::operator=(Fmpz_expr) .. cpp:function:: Fmpq_poly_target Fmpq_poly_target::operator=(Fmpz_poly_expr) .. cpp:function:: Fmpq_poly_target Fmpq_poly_target::operator=(const char*) .. cpp:function:: void Fmpq_poly_target::set_zero() .. cpp:function:: void Fmpq_poly_target::set_one() .. cpp:function:: static fmpq_polyxx fmpq_polyxx::zero() .. cpp:function:: static fmpq_polyxx fmpq_polyxx::one() .. cpp:function:: Fmpq_poly_expr inv(Fmpq_poly_expr) .. cpp:function:: static fmpq_polyxx fmpq_polyxx::get_slice(Fmpq_poly_expr, slong i, slong j) .. cpp:function:: void Fmpq_poly_target::truncate(slong) .. cpp:function:: Fmpq_poly_expr reverse(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: std::string Fmpq_poly_expr::pretty(const char* x) const See ``fmpq_poly_get_str_pretty``. .. cpp:function:: std::string Fmpq_poly_expr::to_string() const Getting and setting coefficients ------------------------------------------------------------------------------- .. cpp:function:: Fmpqxx_expr Fmpq_poly_expr::get_coeff(slong n) const .. cpp:function:: void Fmpq_poly_target::set_coeff(slong n, Fmpz_expr) .. cpp:function:: void Fmpq_poly_target::set_coeff(slong n, Fmpq_expr) .. cpp:function:: void Fmpq_poly_target::set_coeff(slong n, T:is_integer) Comparison ------------------------------------------------------------------------------- The overloaded operators ``== != >= >`` etc. can be used for comparison. Additionally, we have the followi.. cpp:functions. .. cpp:function:: bool Fmpq_poly_expr::is_one() const .. cpp:function:: bool Fmpq_poly_expr::is_zero() const Arithmetic ------------------------------------------------------------------------------- The overloaded operators ``* / + -`` can be used for both polynomial-polynomial and polynomial-scalar arithmetic. Additionally, we provide the followi.. cpp:functions. .. cpp:function:: Fmpq_poly_expr mullow(Fmpq_poly_expr, Fmpq_poly_expr, slong) Powering ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_poly_expr pow(Fmpq_poly_expr, T:is_unsigned_integer) Shifting ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_poly_expr shift_left(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpq_poly_expr shift_right(Fmpq_poly_expr, T:fits_into_slong) Euclidean division ------------------------------------------------------------------------------- The overloaded operators ``/ %`` can be used for euclidean division and remainder. Additionally, we have the followi.. cpp:functions. .. cpp:function:: Ltuple_expr divrem(Fmpq_poly_expr A, Fmpq_poly_expr B) ``ltupleref(Q, R) = divrem(A, B)`` has the same effect as ``fmpq_poly_divrem(q, r, a, b)`` where ``q, r, a, b`` are the underlying ``fmpq_poly_t`` corresponding to ``Q, R, A, B``. Power series division ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_poly_expr inv_series_newton(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpq_poly_expr inv_series(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpq_poly_expr div_series(Fmpq_poly_expr, Fmpq_poly_expr, slong n) Greatest common divisor ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_poly_expr gcd(Fmpq_poly_expr, Fmpq_poly_expr) .. cpp:function:: Fmpq_poly_expr lcm(Fmpq_poly_expr, Fmpq_poly_expr) .. cpp:function:: Ltuple_expr xgcd(Fmpq_poly_expr f, Fmpq_poly_expr g) ``ltupleref(G, S, T) = xgcd(A, B)`` has the same effect as ``fmpq_poly_xgcd(g, s, t, a, b)``, where ``g, s, t, a, b`` denote the underlying ``fmpq_poly_t`` corresponding to ``G, S, T, A, B``. .. cpp:function:: Fmpq_expr resultant(Fmpq_poly_expr) Derivative and integral ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_poly_expr derivative(Fmpq_poly_expr) .. cpp:function:: Fmpq_poly_expr integral(Fmpq_poly_expr) Square roots ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_poly_expr sqrt_series(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpq_poly_expr invsqrt_series(Fmpq_poly_expr, T:fits_into_slong) Transcendent.. cpp:functions ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_poly_expr exp_series(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpq_poly_expr log_series(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpq_poly_expr atan_series(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpq_poly_expr atanh_series(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpq_poly_expr asin_series(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpq_poly_expr asinh_series(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpq_poly_expr tan_series(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpq_poly_expr sin_series(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpq_poly_expr cos_series(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpq_poly_expr sinh_series(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpq_poly_expr cosh_series(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpq_poly_expr tanh_series(Fmpq_poly_expr, T:fits_into_slong) Evaluation ------------------------------------------------------------------------------- The overloaded ``operator()`` can be used for evaluation. Additionally we have the following. .. cpp:function:: Fmpq_expr evaluate(Fmpq_poly_expr, Fmpq_expr) .. cpp:function:: Fmpq_expr evaluate(Fmpq_poly_expr, Fmpz_expr) Interpolation ------------------------------------------------------------------------------- .. cpp:function:: static Fmpq_poly_expr fmpq_polyxx::interpolate(Fmpz_vec_expr xs, Fmpz_vec_expr ys) See ``fmpq_poly_interpolate_fmpq_vec``. Composition ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_poly_expr compose(Fmpq_poly_expr, Fmpq_poly_expr) .. cpp:function:: Fmpq_poly_expr rescale(Fmpq_poly_expr, Fmpq_expr) Power series composition ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_poly_expr compose_series(Fmpq_poly_expr, Fmpq_poly_expr, slong) .. cpp:function:: Fmpq_poly_expr compose_series_horner(Fmpq_poly_expr, Fmpq_poly_expr, slong) .. cpp:function:: Fmpq_poly_expr compose_series_brent_kung(Fmpq_poly_expr, Fmpq_poly_expr, slong) Power series reversion ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_poly_expr revert_series(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpq_poly_expr revert_series_newton(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpq_poly_expr revert_series_lagrange(Fmpq_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpq_poly_expr revert_series_lagrange_fast(Fmpq_poly_expr, T:fits_into_slong) Gaussian content ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_expr content(Fmpq_poly_expr) .. cpp:function:: Fmpq_poly_expr primitive_part(Fmpq_poly_expr) .. cpp:function:: bool Fmpq_poly_expr::is_monic() const .. cpp:function:: Fmpq_poly_expr make_monic(Fmpq_poly_expr) Square-free ------------------------------------------------------------------------------- .. cpp:function:: bool Fmpq_poly_expr::is_squarefree() const Input and output ------------------------------------------------------------------------------- .. cpp:function:: print(Fmpq_poly_expr) .. cpp:function:: print(FILE*, Fmpq_poly_expr) .. cpp:function:: print_pretty(Fmpq_poly_expr, const char* var) .. cpp:function:: print_pretty(FILE*, Fmpq_poly_expr, const char* var) .. cpp:function:: read(Fmpq_poly_target) .. cpp:function:: read(FILE*, Fmpq_poly_target) Ration.. cpp:functions (``fmpz_poly_q``) =============================================================================== Memory management ------------------------------------------------------------------------------- .. cpp:function:: fmpz_poly_qxx::fmpz_poly_qxx() .. cpp:function:: fmpz_poly_qxx::fmpz_poly_qxx(const char*) See ``fmpz_poly_q_set_str``. .. cpp:function:: void Fmpz_poly_q_target::canonicalise() .. cpp:function:: bool Fmpz_poly_q_src::is_canonical() const .. cpp:function:: ?? Fmpz_poly_q_expr::num() const .. cpp:function:: ?? Fmpz_poly_q_expr::den() const Unified coefficient access to the numerator or denominator of the rational .. cpp:function. If this is used for modification, a call to ``canonicalise()`` may be necessary. Randomisation ------------------------------------------------------------------------------- .. cpp:function:: static fmpz_poly_qxx fmpz_poly_qxx::randtest(frandxx& state, slong len1, mp_bitcnt_t bits1, slong len2, mp_bitcnt_t bits2) .. cpp:function:: static fmpz_poly_qxx fmpz_poly_qxx::randtest_not_zero(frandxx& state, slong len1, mp_bitcnt_t bits1, slong len2, mp_bitcnt_t bits2) See ``fmpz_poly_q_randtest`` etc. Assignment ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_q_target Fmpz_poly_q_target::operator=(T:fits_into_slong) .. cpp:function:: void Fmpz_poly_q_target::set_zero() .. cpp:function:: void Fmpz_poly_q_target::set_one() .. cpp:function:: static fmpz_poly_qxx fmpz_poly_qxx::zero() .. cpp:function:: static fmpz_poly_qxx fmpz_poly_qxx::one() .. cpp:function:: Fmpz_poly_q_expr inv(Fmpz_poly_q_expr) .. cpp:function:: Fmpz_poly_q_expr Fmpz_poly_q_expr::inv() const Comparison ------------------------------------------------------------------------------- The overloaded operator ``==`` can be used for comparison. Additionally, we have the followi.. cpp:functions. .. cpp:function:: bool Fmpz_poly_q_expr::is_one() const .. cpp:function:: bool Fmpz_poly_q_expr::is_zero() const Powering ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_q_expr pow(Fmpz_poly_q_expr, T:is_unsigned_integer) .. cpp:function:: Fmpz_poly_q_expr Fmpz_poly_q_expr::pow(T:is_unsigned_integer) const Derivative ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_q_expr Fmpz_poly_q_expr::derivative() const .. cpp:function:: Fmpz_poly_q_expr derivative(Fmpz_poly_q_expr) Input and output ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_q_target Fmpz_poly_q_target::operator=(const char*) See ``fmpz_poly_q_set_str``. .. cpp:function:: std::string Fmpz_poly_q_expr::to_string() const See ``fmpz_poly_q_get_str``. .. cpp:function:: std::string Fmpz_poly_q_expr::pretty(const char* x) const See ``fmpz_poly_q_get_str_pretty``. .. cpp:function:: int print(Fmpz_poly_q_expr) .. cpp:function:: int print_pretty(Fmpz_poly_q_expr, const char* var) Matrices of polynomials over the integers (``fmpz_poly_mat``) =============================================================================== The class ``fmpz_poly_matxx`` wraps ``fmpz_poly_mat_t``, and so represents matrices with coefficients in $\mathbf{Z}[X]$. Its usage is similar to ``fmpz_matxx`` in most regards. .. cpp:function:: Fmpz_poly_mat_expr::unary operation() const The following una.. cpp:functions are made available as member functions: ``det``, ``det_fflu``, ``det_interpolate``, ``trace``, ``sqr``, ``sqr_classical``, ``sqr_KS``, ``transpose``. .. cpp:function:: Fmpz_poly_mat_expr::binary operation(??) const The following bina.. cpp:functions are made available as member functions: ``solve``, ``solve_fflu``, ``mul_classical``, ``mul_interpolate``, ``mul_KS``, ``pow``, ``sqrlow``. .. cpp:function:: Fmpz_poly_mat_expr::three operation(??) const The following threea.. cpp:functions are made available as member functions: ``mullow``, ``pow_trunc``. .. cpp:function:: Fmpz_mat_expr Fmpz_poly_mat_expr::operator()(Fmpz_expr) const ``operator()`` is overloaded for matrix evaluation. .. cpp:function:: Fmpz_poly_mat_expr operator?(??, ??) Arithmetic operators ``+ - *`` are overloaded when provided by ``fmpz_poly_mat_t``. .. cpp:function:: Fmpz_poly_mat_expr operator-(Fmpz_poly_mat_expr) The unary negation operator is overloaded. Input and output ------------------------------------------------------------------------------- .. cpp:function:: int print_pretty(Fmpz_poly_mat_expr, const char* x) Basic properties ------------------------------------------------------------------------------- .. cpp:function:: slong Fmpz_poly_mat_expr::rows() const .. cpp:function:: slong Fmpz_poly_mat_expr::cols() const Obtain the number of rows/columns in this matrix. The.. cpp:functions never cause evaluation (the matrix size is computed from the operations in the expression template and the size of the input matrices). Basic assignment and manipulation ------------------------------------------------------------------------------- .. cpp:function:: ?? Fmpz_poly_mat_expr::at(T:fits_into_slong, U:fits_into_slong) const Unified coefficient access to the matrix entries. Standard matrices ------------------------------------------------------------------------------- .. cpp:function:: void Fmpz_poly_mat_target::set_zero() .. cpp:function:: void Fmpz_poly_mat_target::set_one() .. cpp:function:: static fmpz_poly_matxx fmpz_poly_matxx::zero(slong rows, slong cols) .. cpp:function:: static fmpz_poly_matxx fmpz_poly_matxx::one(slong rows, slong cols) Random matrix generation ------------------------------------------------------------------------------- .. cpp:function:: void Fmpz_poly_mat_target::set_randtest(frandxx& state, slong len, mp_bitcnt_t) .. cpp:function:: void Fmpz_poly_mat_target::set_randtest_unsigned(frandxx& state, slong len, mp_bitcnt_t) .. cpp:function:: void Fmpz_poly_mat_target::set_randtest_sparse(frandxx& state, slong len, mp_bitcnt_t, float) .. cpp:function:: static fmpz_poly_matxx fmpz_poly_matxx::randtest(slong rows, slong cols, frandxx&, slong len, mp_bitcnt_t) .. cpp:function:: static fmpz_poly_matxx fmpz_poly_matxx::randtest_unsigned(slong rows, slong cols, frandxx&, slong len, mp_bitcnt_t) .. cpp:function:: static fmpz_poly_matxx fmpz_poly_matxx::randtest_sparse(slong rows, slong cols, frandxx&, slong len, mp_bitcnt_t, float density) See ``fmpz_poly_mat_randtest`` etc. Basic comparison and properties ------------------------------------------------------------------------------- .. cpp:function:: bool Fmpz_poly_mat_expr::is_zero() const .. cpp:function:: bool Fmpz_poly_mat_expr::is_one() const .. cpp:function:: bool Fmpz_poly_mat_expr::is_empty() const .. cpp:function:: bool Fmpz_poly_mat_expr::is_square() const Norms ------------------------------------------------------------------------------- .. cpp:function:: slong Fmpz_poly_mat_expr::max_length() const .. cpp:function:: slong Fmpz_poly_mat_expr::max_bits() const Transpose ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_mat_expr transpose(Fmpz_poly_mat_expr) Arithmetic ------------------------------------------------------------------------------- Basic arithmetic is most easily done using the overloaded operators ``+ * -``. Finer control can be obtained using the followi.. cpp:functions. .. cpp:function:: Fmpz_mat_expr mul_classical(Fmpz_mat_expr, Fmpz_mat_expr) .. cpp:function:: Fmpz_mat_expr mul_KS(Fmpz_mat_expr, Fmpz_mat_expr) .. cpp:function:: Fmpz_poly_mat_expr mullow(Fmpz_poly_mat_expr, Fmpz_poly_mat_expr, slong) .. cpp:function:: Fmpz_poly_mat_expr sqr(Fmpz_poly_mat_expr) .. cpp:function:: Fmpz_poly_mat_expr sqr_KS(Fmpz_poly_mat_expr) .. cpp:function:: Fmpz_poly_mat_expr sqr_classical(Fmpz_poly_mat_expr) .. cpp:function:: Fmpz_poly_mat_expr sqrlow(Fmpz_poly_mat_expr, T:fits_into_slong n) .. cpp:function:: Fmpz_poly_mat_expr pow(Fmpz_poly_mat_expr, T:is_unsigned_integer) .. cpp:function:: Fmpz_poly_mat_expr pow_trunc(Fmpz_poly_mat_expr, T:is_unsigned_integer, T:fits_into_slong) .. cpp:function:: Fmpz_poly_mat_expr prod(Fmpz_poly_mat_vec_expr) Row reduction ------------------------------------------------------------------------------- Beware that compared to the C interface, the flintxx row reduction interface changes some argument orders. This is to facilitate default arguments. .. cpp:function:: slong find_pivot_any(Fmpz_poly_mat_expr, slong, slong, slong) See ``fmpz_poly_mat_find_pivot_any``. .. cpp:function:: slong find_pivot_partial(Fmpz_poly_mat_expr, slong, slong, slong) See ``fmpz_poly_mat_find_pivot_partial``. .. cpp:function:: Ltuple_expr fflu(Fmpz_poly_mat_expr A, permxx* perm = 0, bool rankcheck = false) See ``fmpz_poly_mat_fflu``. .. cpp:function:: Ltuple_expr rref(Fmpz_poly_mat_expr A) See ``fmpz_poly_mat_rref``. Trace ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_expr trace(Fmpz_poly_mat_expr) Determinant and rank ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_expr det(Fmpz_poly_mat_expr) .. cpp:function:: Fmpz_poly_expr det_fflu(Fmpz_poly_mat_expr) .. cpp:function:: Fmpz_poly_expr det_interpolate(Fmpz_poly_mat_expr) .. cpp:function:: slong rank(Fmpz_poly_mat_expr) Inverse ------------------------------------------------------------------------------- .. cpp:function:: Ltuple_expr inv(Fmpz_poly_mat_expr) ``ltupleref(b, M, D) = inv(A)`` has the same effect as ``b = fmpz_poly_mat_inv(m, d, a)``, where ``m, d, a`` are the underlying C objects corresponding to ``M, D, A``. Nullspace ------------------------------------------------------------------------------- .. cpp:function:: Ltuple_expr nullspace(Fmpz_poly_mat_expr A) ``ltupleref(n, B) = nullspace(A)`` has the same effect as\\ ``n = fmpz_poly_mat_nullspace(b, a)``, where ``b, a`` are the underlying ``fmpz_poly_mat_t`` corresponding to ``B, A``. Solving ------------------------------------------------------------------------------- .. cpp:function:: Ltuple_expr solve(Fmpz_poly_mat_expr B, Fmpz_poly_mat_expr X) .. cpp:function:: Ltuple_expr solve_fflu(Fmpz_poly_mat_expr B, Fmpz_poly_mat_expr X) .. cpp:function:: Ltuple_expr solve_fflu_precomp(const permxx&, Fmpz_poly_mat_expr B, Fmpz_poly_mat_expr FFLU, Fmpz_poly_mat_expr X) ``ltupleref(w, M, D) = solve(B, X)`` has the same effect as\\ ``w = fmpz_poly_mat_solve(m, d, b, x)``, where ``m, d, b, x`` are the underlying C objects corresponding to ``M, D, B, X``. Similarly for the oth.. cpp:functions. Integers mod `n` (``nmod``) =============================================================================== The class ``nmodxx`` encapsulates the use of ``mp_limb_t`` together with ``nmod_t`` for doing arithmetic modulo a word-sized integer. It is defined in ``nmod_vecxx.h``. The C++ equivalent to ``nmod_t`` is ``nmodxx_ctx``. There is a reference version ``nmodxx_ctx_srcref``. The C++ equivalent to ``mp_limb_t`` in this context is ``nmodxx``. Immediate ``nmodxx`` expressions store both an ``mp_limb_t`` and an ``nmodxx_ctx_srcref``. The most common ways to construct ``nmodxx`` are using the static member functions ``nmodxx::red`` and ``nmodxx::make_nored``. For convenience, ``operator%`` is overloaded with right hand side ``nmodxx_ctx`` (or ``nmodxx_ctx_srcref``) to call ``nmodxx::red``. Just like when ``mp_limb_t`` is passed to ``nmod_t`` operations, the limb stored in ``nmodxx`` is assumed to be reduced, and under this assumption, all computations yield reduced data. It is assumed that any expression of ``nmodxx`` involves only one modulus, so that all contexts are interchangeable. Miscellaneous ------------------------------------------------------------------------------- .. cpp:function:: explicit nmodxx_ctx::nmodxx_ctx(mp_limb_t n) Initialise a new context for operations modulo $n$. .. cpp:function:: nmodxx_ctx_srcref::nmodxx_ctx_srcref(const nmodxx_ctx&) Initialise a reference to an ``nmodxx_ctx``. .. cpp:function:: static nmodxx_ctx_srcref::make(const nmod_t& nm) Initialise a reference pointing to an ``nmod_t``. .. cpp:function:: const nmod_t& nmodxx_ctx::_nmod() const .. cpp:function:: const nmod_t& nmodxx_ctx_srcref::_nmod() const Obtain a reference to the underlying ``nmod_t``. .. cpp:function:: mp_limb_t nmodxx_ctx::n() const .. cpp:function:: mp_limb_t nmodxx_ctx_srcref::n() const Obtain the modulus stored in this context. .. cpp:function:: nmodxx::nmodxx(nmodxx_ctx_srcref ctx) Initialise an ``nmodxx`` to zero. .. cpp:function:: static nmodxx nmodxx::make_nored(mp_limb_t n, nmodxx_ctx_srcref ctx) Initialise an ``nmodxx`` to $n$, performing no reductions. .. cpp:function:: static nmodxx nmodxx::red(mp_limb_t n, nmodxx_ctx_srcref ctx) .. cpp:function:: static nmodxx nmodxx::red(Fmpz_expr n, nmodxx_ctx_srcref ctx) .. cpp:function:: static nmodxx nmodxx::red(Fmpq_expr n, nmodxx_ctx_srcref ctx) Initialise an ``nmodxx`` to the reduction of $n$. .. cpp:function:: static nmodxx_ref nmodxx_ref::make(mp_limb_t& l, nmodxx_ctx_srcref c) .. cpp:function:: static nmodxx_srcref nmodxx_srcref::make(const mp_limb_t&, nmodxx_ctx_srcref) Obtain a flintxx reference object pointing to ``l``, which is interpreted as a limb reduced modulo ``c``. .. cpp:function:: void Nmod_target::reduce() Reduce the stored limb. .. cpp:function:: void Nmod_target::set_nored(mp_limb_t n) Set the stored limb to $n$. .. cpp:function:: std::string Nmod_expr::to_string() const Convert self into a string of the form "a mod b". .. cpp:function:: mp_limb_t Nmod_expr::to() const Obtain the stored limb. .. cpp:function:: nmodxx_ctx_srcref Nmod_expr::estimate_ctx() const Obtain the context of any immediate subexpression. (By our homogeneity assumptions, the result of this operation does not depend on the subexpression chosen.) .. cpp:function:: Nmod_expr Nmod_expr::inv() const .. cpp:function:: Nmod_expr Nmod_expr::pow(T:is_unsigned_integer) const .. cpp:function:: Nmod_expr operator??(Nmod_expr, Nmod_expr) Arithmetic operators ``+ - * /`` are overloaded for nmod expressions. .. cpp:function:: Nmod_expr operator-(Nmod_expr) .. cpp:function:: Nmod_expr pow(Nmod_expr, T:is_unsigned_integer) .. cpp:function:: Nmod_expr inv(Nmod_expr) Polynomials over integers mod `n` (``nmod_polyxx``) =============================================================================== The class ``nmod_polyxx`` wraps ``nmod_poly_t``. Like ``nmodxx``, instances of ``nmod_polyxx`` always have an associated ``nmodxx_ctx`` storing the operating modulus. No expression may involve more than one modulus at a time. In order to reduce convert a ``fmpz_polyxx`` or ``fmpq_polyxx`` to ``nmod_polyxx``, see the ``reduce`` method of ``fmpz_polyxx`` or ``fmpq_polyxx``, respectively. .. cpp:function:: nmodxx_ctx_srcref Nmod_poly_expr::estimate_ctx() const Obtain the relevant context. This never causes evaluation. .. cpp:function:: Nmod_poly_expr::unary operation() const The following una.. cpp:functions are made available as member functions: ``derivative``, ``integral``, ``make_monic``, ``sqrt``. .. cpp:function:: Nmod_poly_expr::binary operation() const The following bina.. cpp:functions are made available as member functions:\\ ``compose_divconquer``, ``compose_horner``, ``div_basecase``,\\ ``div_divconquer``, ``div_newton``, ``divrem``,\\ ``divrem_basecase``, ``divrem_divconquer``,\\ ``divrem_newton``, ``div_root``, ``evaluate_fast``,\\ ``evaluate_iter``, ``gcd``, ``gcd_euclidean``, ``gcd_hgcd``,\\ ``inv_series``, ``inv_series_basecase``, ``inv_series_newton``,\\ ``invsqrt_series``, ``mul_classical``, ``mul_KS``,\\ ``shift_left``, ``shift_right``, ``pow``,\\ ``pow_binexp``, ``rem_basecase``, ``resultant``,\\ ``resultant_euclidean``, ``reverse``, ``revert_series``,\\ ``revert_series_lagrange``, ``revert_series_lagrange_fast``,\\ ``revert_series_newton``, ``sqrt_series``, ``taylor_shift``,\\ ``taylor_shift_convolution``, ``taylor_shift_horner``, ``xgcd``,\\ ``xgcd_euclidean``, ``xgcd_hgcd``, ``log_series``,\\ ``exp_series``, ``exp_series_basecase``, ``atan_series``,\\ ``atanh_series``, ``asin_series``, ``asinh_series``,\\ ``sin_series``, ``cos_series``, ``tan_series``,\\ ``sinh_series``, ``cosh_series``, ``tanh_series``. .. cpp:function:: Nmod_poly_expr Nmod_poly_expr::inflate(T:is_unsigned_integer) const ``See inflate``. .. cpp:function:: Nmod_poly_expr Nmod_poly_expr::deflate(T:is_unsigned_integer) const ``See deflate``. .. cpp:function:: Nmod_poly_expr::ternary operation(??, ??) const The following terna.. cpp:functions are made available as member functions:\\ ``compose_mod``, ``compose_mod_horner``,\\ ``compose_series_brent_kung``, ``compose_series``,\\ ``compose_series_brent_kung``, ``compose_series_divconquer``,\\ ``compose_series_horner``, ``div_newton_n_preinv``,\\ ``divrem_newton_n_preinv``, ``div_series``, ``mulhigh``,\\ ``mulhigh_classical``, ``mullow``, ``mullow_classical``,\\ ``mullow_KS``, ``mulmod``, ``powmod_binexp``, ``pow_trunc``,\\ ``pow_trunc_binexp``. .. cpp:function:: Nmod_poly_expr::fourary operation(??, ??, ??) const The followi.. cpp:functions of four arguments are made available as memb.. cpp:functions: ``compose_mod_brent_kung_preinv``, ``mulmod_preinv``, ``powmod_binexp_preinv``. .. cpp:function:: Nmod_poly_expr Nmod_poly_expr::operator()(Nmod_poly_expr) const .. cpp:function:: Nmod_expr Nmod_poly_expr::operator()(Nmod_expr) const .. cpp:function:: Nmod_vec_expr Nmod_poly_expr::operator()(Nmod_vec_expr) const The ``operator()`` is overloaded for evaluation or composition, depending on the argument. .. cpp:function:: Nmod_poly_expr operator?(??, ??) Arithmetic operators ``+ - * / %`` are overloaded when provided by ``nmod_poly_t``. .. cpp:function:: Nmod_poly_expr operator-(Nmod_poly_expr) The unary negation operator is overloaded. .. cpp:function:: Nmod_poly_target Nmod_poly_target::operator=(const char*) See ``nmod_poly_set_str``. Raises ``flint_exception`` if the string is malformed. Conversion ------------------------------------------------------------------------------- .. cpp:function:: static nmod_polyxx nmod_polyxx::reduce(Fmpz_mod_poly_expr, nmodxx_ctx_srcref) .. cpp:function:: static nmod_polyxx nmod_polyxx::reduce(Fmpq_mod_poly_expr, nmodxx_ctx_srcref) .. cpp:function:: static nmod_polyxx nmod_polyxx::reduce(Fmpz_mod_poly_expr, mp_limb_t) .. cpp:function:: static nmod_polyxx nmod_polyxx::reduce(Fmpq_mod_poly_expr, mp_limb_t) See ``fmpz_poly_get_nmod_poly``. .. cpp:function:: static nmod_polyxx nmod_polyxx::from_ground(Nmod_expr e) .. cpp:function:: static nmod_polyxx nmod_polyxx::from_ground(mp_limb_t e, nmodxx_ctx_srcref c) Consider $e \in \mathbf{Z}/n\mathbf{Z}$ as an element of $\mathbf{Z}/n\mathbf{Z}[X]$. Input and output ------------------------------------------------------------------------------- .. cpp:function:: print(Nmod_poly_expr) .. cpp:function:: print(FILE*, Nmod_poly_expr) .. cpp:function:: read(Nmod_poly_target) .. cpp:function:: read(FILE*, Nmod_poly_target) Memory management ------------------------------------------------------------------------------- .. cpp:function:: nmod_polyxx::nmod_polyxx(mp_limb_t modulus) .. cpp:function:: nmod_polyxx::nmod_polyxx(mp_limb_t modulus, slong alloc) .. cpp:function:: nmod_polyxx::nmod_polyxx(nmodxx_ctx_srcref ctx) .. cpp:function:: nmod_polyxx::nmod_polyxx(nmodxx_ctx_srcref ctx, slong alloc) Instantiate ``nmod_polyxx`` relative to some modulus. If the second argument is provided, space is allocated for ``alloc`` coefficients. .. cpp:function:: nmod_polyxx::nmod_polyxx(const char* str) Instantiate ``nmod_polyxx`` from a string representation. The modulus is parsed (second integer in the string) and the polynomial is initialised with this modulus, then ``nmod_poly_set_str`` is called. Raises ``flint_exception`` if the string is malformed. .. cpp:function:: static nmod_polyxx nmod_polyxx::zero(mp_limb_t n) .. cpp:function:: static nmod_polyxx nmod_polyxx::one(mp_limb_t n) .. cpp:function:: void Nmod_poly_target realloc(slong alloc) .. cpp:function:: void Nmod_poly_target::fit_length(slong len) .. cpp:function:: void Nmod_poly_target::_normalise() Polynomial properties ------------------------------------------------------------------------------- .. cpp:function:: slong Nmod_poly_expr::length() const .. cpp:function:: slong Nmod_poly_expr::degree() const .. cpp:function:: slong Nmod_poly_expr::max_bits() const .. cpp:function:: mp_limb_t Nmod_poly_expr::modulus() const Assignment and basic manipulation ------------------------------------------------------------------------------- .. cpp:function:: void Nmod_poly_target::truncate(slong) .. cpp:function:: void Nmod_poly_target::set_zero() .. cpp:function:: void Nmod_poly_target::set_one() .. cpp:function:: Nmod_poly_expr reverse(Nmod_poly_expr, T:fits_into_slong) Randomisation ------------------------------------------------------------------------------- .. cpp:function:: void Nmod_target::set_randtest(frandxx& state, slong len) .. cpp:function:: void Nmod_target::set_randtest_irreducible(frandxx& state, slong len) .. cpp:function:: static nmod_polyxx nmod_polyxx::randtest(mp_limb_t n, frandxx& state, slong len) .. cpp:function:: static nmod_polyxx nmod_polyxx::randtest_irreducible(mp_limb_t n, frandxx& state, slong len) Getting and setting coefficients ------------------------------------------------------------------------------- .. cpp:function:: Nmodxx_expr Nmod_poly_expr::get_coeff(slong n) const .. cpp:function:: void Nmod_target::set_coeff(slong i, Nmodxx_expr) .. cpp:function:: void Nmod_target::set_coeff(slong i, mp_limb_t) Input and output ------------------------------------------------------------------------------- .. cpp:function:: std::string Nmod_poly_expr::to_string() const .. cpp:function:: std::ostream& operator<<(std::ostream&, Nmod_poly_expr) Output to streams is done by first converting to string. Comparison ------------------------------------------------------------------------------- .. cpp:function:: bool Nmod_poly_expr::is_one() const .. cpp:function:: bool Nmod_poly_expr::is_zero() const .. cpp:function:: bool operator==(Nmod_poly_expr, Nmod_poly_expr) Scalar multiplication and division ------------------------------------------------------------------------------- Scalar multiplication is provided via overloaded ``operator*``. Additionally, the followi.. cpp:functions are implemented: .. cpp:function:: Nmod_poly_expr make_monic(Nmod_poly_expr) Bit packing and unpacking ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_expr Nmod_poly_expr::bit_pack(T:fits_into_mp_bitcnt_t) const .. cpp:function:: static nmod_polyxx nmod_polyxx::bit_unpack(Fmpz_expr, T:fits_into_mp_bitcnt_t) const Multiplication ------------------------------------------------------------------------------- Basic multiplication is provided via overloaded ``operator*``. Finer control can be obtained using the followi.. cpp:functions. .. cpp:function:: Nmod_poly_expr mul_classical(Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Nmod_poly_expr mul_KS(Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Nmod_poly_expr mullow(Nmod_poly_expr, Nmod_poly_expr, slong) .. cpp:function:: Nmod_poly_expr mullow_classical(Nmod_poly_expr, Nmod_poly_expr, slong) .. cpp:function:: Nmod_poly_expr mullow_KS(Nmod_poly_expr, Nmod_poly_expr, slong) .. cpp:function:: Nmod_poly_expr mulhigh(Nmod_poly_expr, Nmod_poly_expr, slong) .. cpp:function:: Nmod_poly_expr mulhigh_classical(Nmod_poly_expr, Nmod_poly_expr, slong) .. cpp:function:: Nmod_poly_expr mulmod(Nmod_poly_expr, Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Nmod_poly_expr mulmod_preinv(Nmod_poly_expr, Nmod_poly_expr, Nmod_poly_expr, Nmod_poly_expr) Powering ------------------------------------------------------------------------------- .. cpp:function:: Nmod_poly_expr pow(Nmod_poly_expr, T:is_unsigned_integer) .. cpp:function:: Nmod_poly_expr pow_binexp(Nmod_poly_expr, T:is_unsigned_integer) .. cpp:function:: Nmod_poly_expr pow_trunc(Nmod_poly_expr, T:is_unsigned_integer, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr pow_trunc_binexp(Nmod_poly_expr, T:is_unsigned_integer, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr powmod_binexp(Nmod_poly_expr, T:is_unsigned_integer, Nmod_poly_expr) .. cpp:function:: Nmod_poly_expr powmod_binexp_preinv(Nmod_poly_expr, T:is_unsigned_integer, Nmod_poly_expr, Nmod_poly_expr) Division ------------------------------------------------------------------------------- Basic division and remainder is provided by overloaded ``operator/`` and ``operator%``. Finer control can be obtained using the following functions. .. cpp:function:: Ltuple_expr divrem(Nmod_poly_expr A, Nmod_poly_expr B) .. cpp:function:: Ltuple_expr divrem_basecase(Nmod_poly_expr A, Nmod_poly_expr B) .. cpp:function:: Ltuple_expr divrem_divconquer(Nmod_poly_expr A, Nmod_poly_expr B) .. cpp:function:: Ltuple_expr divrem_newton(Nmod_poly_expr A, Nmod_poly_expr B) .. cpp:function:: Ltuple_expr divrem_newton_n_preinv(Nmod_poly_expr A, Nmod_poly_expr B) .. cpp:function:: Nmod_poly_expr div_basecase(Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Nmod_poly_expr div_divconquer(Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Nmod_poly_expr div_newton(Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Nmod_poly_expr div_newton_n_preinv(Nmod_poly_expr, Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Nmod_poly_expr rem_basecase(Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Nmod_poly_expr inv_series(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr inv_series_basecase(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr inv_series_newton(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr div_series(Nmod_poly_expr, Nmod_poly_expr, slong n) .. cpp:function:: Nmod_poly_expr div_root(Nmod_poly_expr, Nmod_expr) Derivative and integral ------------------------------------------------------------------------------- .. cpp:function:: Nmod_poly_expr derivative(Nmod_poly_expr) .. cpp:function:: Nmod_poly_expr integral(Nmod_poly_expr) Evaluation ------------------------------------------------------------------------------- Basic evaluation and multipoint evaluation can be achieved using the overloaded ``operator()``. Finer control can be obtained using the followi.. cpp:functions. .. cpp:function:: Nmod_expr evaluate(Nmod_poly_expr, Nmod_expr) .. cpp:function:: Nmod_vec_expr evaluate(Nmod_poly_expr, Nmod_vec_expr) .. cpp:function:: Nmod_vec_expr evaluate_fast(Nmod_poly_expr, Nmod_vec_expr) .. cpp:function:: Nmod_vec_expr evaluate_iter(Nmod_poly_expr, Nmod_vec_expr) Interpolation ------------------------------------------------------------------------------- .. cpp:function:: static Nmod_poly_expr fmpz_polyxx::interpolate(Nmod_vec_expr xs, Nmod_vec_expr ys) .. cpp:function:: static Nmod_poly_expr fmpz_polyxx::interpolate_barycentric(Nmod_vec_expr xs, Nmod_vec_expr ys) .. cpp:function:: static Nmod_poly_expr fmpz_polyxx::interpolate_fast(Nmod_vec_expr xs, Nmod_vec_expr ys) .. cpp:function:: static Nmod_poly_expr fmpz_polyxx::interpolate_newton(Nmod_vec_expr xs, Nmod_vec_expr ys) Composition ------------------------------------------------------------------------------- Basic composition can be achieved with the overloaded ``operator()``. Finer control can be obtained using the followi.. cpp:functions. .. cpp:function:: Nmod_poly_expr compose(Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Nmod_poly_expr compose_horner(Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Nmod_poly_expr compose_divconquer(Nmod_poly_expr, Nmod_poly_expr) Taylor Shift ------------------------------------------------------------------------------- .. cpp:function:: Nmod_poly_expr taylor_shift(Nmod_poly_expr, Nmod_expr) .. cpp:function:: Nmod_poly_expr taylor_shift_horner(Nmod_poly_expr, Nmod_expr) .. cpp:function:: Nmod_poly_expr taylor_shift_convolution(Nmod_poly_expr, Nmod_expr) Modular composition ------------------------------------------------------------------------------- .. cpp:function:: Nmod_poly_expr compose_mod(Nmod_poly_expr, Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Nmod_poly_expr compose_mod_horner(Nmod_poly_expr, Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Nmod_poly_expr compose_mod_divconquer(Nmod_poly_expr, Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Nmod_poly_expr compose_mod_brent_kung(Nmod_poly_expr, Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Nmod_poly_expr compose_mod_brent_kung_preinv(Nmod_poly_expr, Nmod_poly_expr, Nmod_poly_expr, Nmod_poly_expr) Greatest common divisor ------------------------------------------------------------------------------- .. cpp:function:: Nmod_poly_expr gcd(Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Nmod_poly_expr gcd_euclidean(Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Nmod_poly_expr gcd_hgcd(Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Ltuple_expr xgcd(Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Ltuple_expr xgcd_euclidean(Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Ltuple_expr xgcd_hgcd(Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Nmod_expr resultant(Nmod_poly_expr, Nmod_poly_expr) .. cpp:function:: Nmod_expr resultant_euclidean(Nmod_poly_expr, Nmod_poly_expr) Power series composition ------------------------------------------------------------------------------- .. cpp:function:: Nmod_poly_expr compose_series(Nmod_poly_expr, Nmod_poly_expr, slong) .. cpp:function:: Nmod_poly_expr compose_series_horner(Nmod_poly_expr, Nmod_poly_expr, slong) .. cpp:function:: Nmod_poly_expr compose_series_brent_kung(Nmod_poly_expr, Nmod_poly_expr, slong) .. cpp:function:: Nmod_poly_expr compose_series_divconquer(Nmod_poly_expr, Nmod_poly_expr, slong) Power series reversion ------------------------------------------------------------------------------- .. cpp:function:: Nmod_poly_expr revert_series(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr revert_series_newton(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr revert_series_lagrange(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr revert_series_lagrange_fast(Nmod_poly_expr, T:fits_into_slong) Square roots ------------------------------------------------------------------------------- .. cpp:function:: Nmod_poly_expr sqrt_series(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr invsqrt_series(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr sqrt_series(Nmod_poly_expr p) Compute the square root of $p$. Raises ``flint_exception`` if $p$ is not a perfect square. Transcendent.. cpp:functions ------------------------------------------------------------------------------- .. cpp:function:: Nmod_poly_expr exp_series(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr log_series(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr atan_series(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr atanh_series(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr asin_series(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr asinh_series(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr tan_series(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr sin_series(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr cos_series(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr sinh_series(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr cosh_series(Nmod_poly_expr, T:fits_into_slong) .. cpp:function:: Nmod_poly_expr tanh_series(Nmod_poly_expr, T:fits_into_slong) Products ------------------------------------------------------------------------------- .. cpp:function:: static Nmod_poly_expr fmpz_polyxx::product_roots(Nmod_vec_expr xs) Inflation and deflation ------------------------------------------------------------------------------- .. cpp:function:: Nmod_poly_expr inflate(Nmod_poly_expr, T:is_unsigned_integer) .. cpp:function:: Nmod_poly_expr deflate(Nmod_poly_expr, T:is_unsigned_integer) .. cpp:function:: slong Nmod_poly_expr::deflation() const Factorisation ------------------------------------------------------------------------------- .. cpp:function:: bool Nmod_poly_expr::is_squarefree() const .. cpp:function:: bool Nmod_poly_expr::is_irreducible() const .. cpp:function:: slong Nmod_poly_target::remove(Nmod_poly_expr) .. cpp:function:: nmod_poly_factorxx::nmod_poly_factorxx() Initialise an empty factorisation. .. cpp:function:: nmod_poly_factorxx::nmod_poly_factorxx(const nmod_poly_factorxx& o) Copy a factorisation. .. cpp:function:: bool nmod_poly_factorxx::operator==(const nmod_poly_factorxx&) Compare two factorisations. .. cpp:function:: ulong nmod_poly_factorxx::size() const Return the number of stored factors. .. cpp:function:: slong nmod_poly_factorxx::exp(slong i) const .. cpp:function:: slong& nmod_poly_factorxx::exp(slong i) Obtain the exponent of the ith factor. .. cpp:function:: nmod_polyxx_srcref nmod_poly_factorxx::p(slong i) const .. cpp:function:: nmod_polyxx_ref nmod_poly_factorxx::p(slong i) Obtain the ith factor. .. cpp:function:: void nmod_poly_factorxx::realloc(slong a) .. cpp:function:: void nmod_poly_factorxx::fit_length(slong a) .. cpp:function:: void nmod_poly_factorxx::insert(Nmod_poly_expr p, slong e) .. cpp:function:: void nmod_poly_factorxx::concat(const nmod_poly_factorxx&) .. cpp:function:: void nmod_poly_factorxx::set_factor(Nmod_poly_expr) .. cpp:function:: void nmod_poly_factorxx::set_factor_cantor_zassenhaus(Nmod_poly_expr) .. cpp:function:: void nmod_poly_factorxx::set_factor_berlekamp(Nmod_poly_expr) .. cpp:function:: void nmod_poly_factorxx::set_factor_kaltofen_shoup(Nmod_poly_expr) .. cpp:function:: void nmod_poly_factorxx::set_factor_with_cantor_zassenhaus(Nmod_poly_expr) .. cpp:function:: void nmod_poly_factorxx::set_factor_with_berlekamp(Nmod_poly_expr) .. cpp:function:: void nmod_poly_factorxx::set_factor_with_kaltofen_shoup(Nmod_poly_expr) .. cpp:function:: void nmod_poly_factorxx::set_factor_squarefree(Nmod_poly_expr) Factorise a polynomial and store its factors. See ``nmod_poly_factor`` etc. .. cpp:function:: void nmod_poly_factorxx::set_factor_equal_deg_probab(frandxx&, Nmod_poly_expr, slong) .. cpp:function:: void nmod_poly_factorxx::set_factor_equal_deg(Nmod_poly_expr, slong) See ``nmod_poly_factor_equal_deg_prob`` and ``nmod_poly_factor_equal_deg``. .. cpp:function:: void nmod_poly_factorxx::set_factor_distinct_deg(Nmod_poly_expr p, std::vector& degs) See ``nmod_poly_factor_distinct_deg``. Note that ``degs`` must have sufficient size to hold all factors. The size of ``degs`` is not modified. .. cpp:function:: nmod_poly_factorxx factor(Nmod_poly_expr) .. cpp:function:: nmod_poly_factorxx factor_cantor_zassenhaus(Nmod_poly_expr) .. cpp:function:: nmod_poly_factorxx factor_berlekamp(Nmod_poly_expr) .. cpp:function:: nmod_poly_factorxx factor_kaltofen_shoup(Nmod_poly_expr) .. cpp:function:: nmod_poly_factorxx factor_with_cantor_zassenhaus(Nmod_poly_expr) .. cpp:function:: nmod_poly_factorxx factor_with_berlekamp(Nmod_poly_expr) .. cpp:function:: nmod_poly_factorxx factor_with_kaltofen_shoup(Nmod_poly_expr) .. cpp:function:: nmod_poly_factorxx factor_squarefree(Nmod_poly_expr) Matrices of integers mod `n` (``nmod_mat``) =============================================================================== The class ``nmod_matxx`` wraps ``nmod_mat_t``. Like ``nmodxx``, instances of ``nmod_matxx`` always have an associated ``nmodxx_ctx`` storing the operating modulus. No expression may involve more than one modulus at a time. Like ``fmpz_matxx``, many operations on ``nmod_matxx`` do not support aliasing. The details can be found in the documentation of ``nmod_mat_t``. Since ``nmod_matxx`` does not use temporary merging, evaluation of subexpressions never creates new aliases. =============================================================================== .. cpp:function:: nmodxx_ctx_srcref Nmod_mat_expr::estimate_ctx() const Obtain the relevant context. This never causes evaluation. .. cpp:function:: Nmod_mat_expr::unary operation() const The following una.. cpp:functions are made available as member functions: ``inv``, ``transpose``, ``trace``, ``det``. .. cpp:function:: Nmod_mat_expr::binary operation(??) const The following bina.. cpp:functions are made available as member functions: ``solve``, ``mul_classical``, ``mul_strassen``. .. cpp:function:: Nmod_mat_expr::ternary operation(??, ??) const The following terna.. cpp:functions are made available as member functions: ``solve_tril``, ``solve_tril_recursive``, ``solve_tril_classical``, ``solve_triu``, ``solve_triu_recursive``, ``solve_triu_classical``. .. cpp:function:: Nmod_mat_expr operator?(??, ??) Arithmetic operators ``+ - *`` are overloaded when provided by ``nmod_mat_t``. .. cpp:function:: Nmod_mat_expr operator-(Nmod_mat_expr) The unary negation operator is overloaded. Conversion ------------------------------------------------------------------------------- .. cpp:function:: static nmod_matxx::reduce(Fmpz_mat_expr, mp_limb_t modulus) See ``fmpz_mat_get_nmod_mat``. Input and output ------------------------------------------------------------------------------- .. cpp:function:: int print(Nmod_mat_expr) Memory management ------------------------------------------------------------------------------- .. cpp:function:: nmod_matxx::nmod_matxx(slong m, slong n, mp_limb_t modulus) See ``nmod_mat_init``. Basic properties and manipulation ------------------------------------------------------------------------------- .. cpp:function:: ?? Nmod_mat_expr::at(T:fits_into_slong, U:fits_into_slong) const Unified coefficient access to the matrix entries. .. cpp:function:: slong Nmod_mat_expr::rows() const .. cpp:function:: slong Nmod_mat_expr::cols() const Obtain the number of rows/columns in this matrix. The.. cpp:functions never cause evaluation (the matrix size is computed from the operations in the expression template and the size of the input matrices). .. cpp:function:: bool Nmod_mat_expr::is_zero() const .. cpp:function:: bool Nmod_mat_expr::is_empty() const .. cpp:function:: bool Nmod_mat_expr::is_square() const .. cpp:function:: mp_limb_t Nmod_mat_expr::modulus() const .. cpp:function:: void Nmod_mat_target::set_zero() .. cpp:function:: static nmod_matxx nmod_matxx::zero(slong rows, slong cols, mp_limb_t modulus) See ``nmod_mat_zero``. Random matrix generation ------------------------------------------------------------------------------- .. cpp:function:: void Nmod_mat_target::set_randtest(frandxx&) .. cpp:function:: void Nmod_mat_target::set_randfull(frandxx&) .. cpp:function:: void Nmod_mat_target::set_randrank(frandxx&, slong rank) .. cpp:function:: void Nmod_mat_target::set_randtril(frandxx&, bool unit) .. cpp:function:: void Nmod_mat_target::set_randtriu(frandxx&, bool unit) See ``nmod_mat_randtest`` etc. .. cpp:function:: static nmod_matxx nmod_matxx::randtest(slong rows, slong cols, mp_limb_t M, frandxx&) .. cpp:function:: static nmod_matxx nmod_matxx::randfull(slong rows, slong cols, mp_limb_t M, frandxx&) .. cpp:function:: static nmod_matxx nmod_matxx::randrank(slong rows, slong cols, mp_limb_t M, frandxx&, slong rank) .. cpp:function:: static nmod_matxx nmod_matxx::randtril(slong rows, slong cols, mp_limb_t M, frandxx&, bool unit) .. cpp:function:: static nmod_matxx nmod_matxx::randtriu(slong rows, slong cols, mp_limb_t M, frandxx&, bool unit) Static versions of the above. .. cpp:function:: int Nmod_mat_target::set_randpermdiag(frandxx&, const Vec& v) ``M.set_randpermdiag(Rand, V)`` has the same effect as ``nmod_mat_randpermdiag(m, rand, V._array(), V.size())``, where ``m`` and ``rand`` are the underlying C structs corresponding to ``M`` and ``Rand``. One possibility for Vec is ``nmod_vecxx``. .. cpp:function:: void Nmod_target::apply_randops(frandxx&, slong count) See ``nmod_mat_randops``. Transpose ------------------------------------------------------------------------------- .. cpp:function:: Nmod_mat_expr transpose(Nmod_mat_expr) Matrix multiplication ------------------------------------------------------------------------------- The overloaded ``operator*`` can be used for both matrix-matrix and matrix-scalar multiplication. Finer control can be obtained with the following functions. .. cpp:function:: Nmod_mat_expr mul_classical(Nmod_mat_expr, Nmod_mat_expr) .. cpp:function:: Nmod_mat_expr mul_strassen(Nmod_mat_expr, Nmod_mat_expr) Trace ------------------------------------------------------------------------------- .. cpp:function:: Nmod_expr trace(Nmod_mat_expr) Determinant and rank ------------------------------------------------------------------------------- .. cpp:function:: Nmod_expr det(Nmod_mat_expr) .. cpp:function:: slong rank(Nmod_mat_expr) Inverse ------------------------------------------------------------------------------- .. cpp:function:: Nmod_mat_expr inv(Nmod_mat_expr A) Compute the inverse of the square matrix $A$. Raises ``flint_exception`` if $A$ is singular. The modulus is required to be prime. Triangular solving ------------------------------------------------------------------------------- .. cpp:function:: Nmod_mat_expr solve_triu(Nmod_mat_expr, Nmod_mat_expr, bool unit) .. cpp:function:: Nmod_mat_expr solve_triu_classical(Nmod_mat_expr, Nmod_mat_expr, bool unit) .. cpp:function:: Nmod_mat_expr solve_triu_recursive(Nmod_mat_expr, Nmod_mat_expr, bool unit) .. cpp:function:: Nmod_mat_expr solve_tril(Nmod_mat_expr, Nmod_mat_expr, bool unit) .. cpp:function:: Nmod_mat_expr solve_tril_classical(Nmod_mat_expr, Nmod_mat_expr, bool unit) .. cpp:function:: Nmod_mat_expr solve_tril_recursive(Nmod_mat_expr, Nmod_mat_expr, bool unit) Non-singular square solving ------------------------------------------------------------------------------- .. cpp:function:: Nmod_mat_expr solve(Nmod_mat_expr B, Nmod_mat_expr X) .. cpp:function:: Nmod_vec_expr solve(Nmod_mat_expr B, Nmod_vec_expr X) See ``nmod_mat_solve`` and ``nmod_mat_solve_vec``. Raises ``flint_exception`` if $B$ is singular. LU decomposition ------------------------------------------------------------------------------- .. cpp:function:: Tuple Nmod_mat_target::set_lu(bool rank_check = false) .. cpp:function:: Tuple Nmod_mat_target::set_lu_classical(bool rank_check = false) .. cpp:function:: Tuple Nmod_mat_target::set_lu_recursive(bool rank_check = false) See ``nmod_mat_lu`` etc. Reduced row echelon form ------------------------------------------------------------------------------- .. cpp:function:: void Nmod_mat_target::set_rref() Nullspace ------------------------------------------------------------------------------- .. cpp:function:: Ltuple_expr nullspace(Nmod_mat_expr) Matrices of polynomials over integers mod `n` (``nmod_poly_matxx``) =============================================================================== The class ``nmod_poly_matxx`` wraps ``nmod_poly_mat_t``. Like ``nmod_matxx``, instances of ``nmod_poly_matxx`` always have an associated ``nmodxx_ctx`` storing the operating modulus. No expression may involve more than one modulus at a time. Contrary to ``nmod_poly_mat_t``, it is \emph{not} valid to use instances of ``nmod_poly_matxx`` with zero rows or columns. Like ``fmpz_matxx``, many operations on ``nmod_poly_matxx`` do not support aliasing. The details can be found in the documentation of ``nmod_poly_mat_t``. Since ``nmod_poly_matxx`` does not use temporary merging, evaluation of subexpressions never creates new aliases. Miscellaneous ------------------------------------------------------------------------------- .. cpp:function:: nmodxx_ctx_srcref Nmod_poly_mat_expr::estimate_ctx() const Obtain the relevant context. This never causes evaluation. .. cpp:function:: Nmod_poly_mat_expr::unary operation() const The following una.. cpp:functions are made available as member functions: ``det``, ``det_fflu``, ``det_interpolate``, ``trace``, ``sqr``, ``sqr_classical``, ``sqr_interpolate``, ``sqr_KS``, ``transpose``. .. cpp:function:: Nmod_poly_mat_expr::binary operation(??) const The following bina.. cpp:functions are made available as member functions: ``solve``, ``solve_fflu``, ``mul_classical``, ``mul_interpolate``, ``mul_KS``, ``pow``. .. cpp:function:: Nmod_mat_expr Nmod_poly_mat_expr::operator()(Nmod_expr) const ``operator()`` is overloaded for matrix evaluation. .. cpp:function:: Nmod_poly_mat_expr operator?(??, ??) Arithmetic operators ``+ - *`` are overloaded when provided by ``nmod_poly_mat_t``. .. cpp:function:: Nmod_poly_mat_expr operator-(Nmod_poly_mat_expr) The unary negation operator is overloaded. Input and output ------------------------------------------------------------------------------- .. cpp:function:: int print_pretty(Nmod_poly_mat_expr, const char*) Memory management ------------------------------------------------------------------------------- .. cpp:function:: nmod_poly_matxx::nmod_poly_matxx(slong m, slong n, mp_limb_t modulus) See ``nmod_poly_mat_init``. Basic assignment and manipulation ------------------------------------------------------------------------------- .. cpp:function:: ?? Nmod_poly_mat_expr::at(T:fits_into_slong, U:fits_into_slong) const Unified coefficient access to the matrix entries. Standard matrices ------------------------------------------------------------------------------- .. cpp:function:: static nmod_poly_matxx nmod_poly_matxx::zero(slong rows, slong cols, mp_limb_t n) .. cpp:function:: static nmod_poly_matxx nmod_poly_matxx::one(slong rows, slong cols, mp_limb_t n) .. cpp:function:: void Nmod_poly_mat_target::set_zero() .. cpp:function:: void Nmod_poly_mat_target::set_one() Random matrix generation ------------------------------------------------------------------------------- .. cpp:function:: void Nmod_poly_mat_target::set_randtest(frandxx&, slong) .. cpp:function:: void Nmod_poly_mat_target::set_randtest_sparse(frandxx&, slong, float) .. cpp:function:: static nmod_poly_matxx nmod_poly_matxx::randtest(slong rows, slong cols, mp_limb_t n, slong len) .. cpp:function:: static nmod_poly_matxx nmod_poly_matxx::randtest_sparse(slong rows, slong cols, mp_limb_t n, slong len, float density) See ``nmod_poly_mat_randtest`` etc. Basic comparison and properties ------------------------------------------------------------------------------- .. cpp:function:: slong Nmod_poly_mat_expr::rows() const .. cpp:function:: slong Nmod_poly_mat_expr::cols() const Obtain the number of rows/columns in this matrix. The.. cpp:functions never cause evaluation (the matrix size is computed from the operations in the expression template and the size of the input matrices). .. cpp:function:: bool Nmod_poly_mat_expr::is_zero() const .. cpp:function:: bool Nmod_poly_mat_expr::is_one() const .. cpp:function:: bool Nmod_poly_mat_expr::is_empty() const .. cpp:function:: bool Nmod_poly_mat_expr::is_square() const .. cpp:function:: mp_limb_t Nmod_poly_mat_expr::modulus() const Norms ------------------------------------------------------------------------------- .. cpp:function:: slong Nmod_poly_mat_expr::max_length() const Arithmetic ------------------------------------------------------------------------------- The overloaded operators ``+ - *`` can be used for both matrix-matrix and matrix-scalar multiplication, and matrix-matrix addition/subtraction. Finer control can be obtained with the followi.. cpp:functions. .. cpp:function:: Nmod_poly_mat_expr mul_classical(Nmod_poly_mat_expr, Nmod_poly_mat_expr) .. cpp:function:: Nmod_poly_mat_expr mul_interpolate(Nmod_poly_mat_expr, Nmod_poly_mat_expr) Row reduction ------------------------------------------------------------------------------- Beware that compared to the C interface, the flintxx row reduction interface changes some argument orders. This is to facilitate default arguments. .. cpp:function:: slong find_pivot_any(Nmod_poly_mat_expr, slong, slong, slong) See ``nmod_poly_mat_find_pivot_any``. .. cpp:function:: slong find_pivot_partial(Nmod_poly_mat_expr, slong, slong, slong) See ``nmod_poly_mat_find_pivot_partial``. .. cpp:function:: Ltuple_expr fflu(Nmod_poly_mat_expr A, permxx* perm = 0, bool rankcheck = false) See ``nmod_poly_mat_fflu``. .. cpp:function:: Ltuple_expr rref(Nmod_poly_mat_expr A) See ``nmod_poly_mat_rref``. Transpose ------------------------------------------------------------------------------- .. cpp:function:: Nmod_poly_mat_expr transpose(Nmod_poly_mat_expr A) Compute the transpose of $A$. Trace ------------------------------------------------------------------------------- .. cpp:function:: Nmod_poly_expr trace(Nmod_poly_mat_expr) Determinant and rank ------------------------------------------------------------------------------- .. cpp:function:: Nmod_poly_expr det(Nmod_poly_mat_expr) .. cpp:function:: Nmod_poly_expr det_fflu(Nmod_poly_mat_expr) .. cpp:function:: Nmod_poly_expr det_interpolate(Nmod_poly_mat_expr) .. cpp:function:: slong rank(Nmod_poly_mat_expr) Inverse ------------------------------------------------------------------------------- .. cpp:function:: Ltuple_expr inv(Nmod_poly_mat_expr A) ``ltupleref(worked, M, P) = inv(A)`` has the same effect as ``worked = nmod_poly_mat_inv(m, p, a)``, where ``m, p, a`` are the C structs underlying ``M, P, A``. Nullspace ------------------------------------------------------------------------------- .. cpp:function:: Ltuple_expr nullspace(Nmod_poly_mat_expr) Solving ------------------------------------------------------------------------------- .. cpp:function:: Ltuple_expr solve(Nmod_poly_mat_expr, Nmod_poly_mat_expr) .. cpp:function:: Ltuple_expr solve_fflu(Nmod_poly_mat_expr, Nmod_poly_mat_expr) .. cpp:function:: Ltuple_expr solve_fflu_precomp(const permxx&, Nmod_poly_mat_expr B, Nmod_poly_mat_expr FFLU, Nmod_poly_mat_expr X) ``ltupleref(worked, M, P) = solve(A, X)`` has the same effect as ``worked = nmod_poly_mat_solve(m, p, a, x)``, where ``m, p, a, x`` are the C structs underlying ``M, P, A, X``. Polynomials over integers mod `n` (``fmpz_mod_poly``) =============================================================================== .. cpp:function:: Fmpz_mod_poly_expr::unary operation() const The following una.. cpp:functions are made available as member functions: ``derivative``, ``integral``, ``make_monic``, ``sqr``. .. cpp:function:: Fmpz_mod_poly_expr::binary operation() const The following bina.. cpp:functions are made available as member functions:\\ ``compose_divconquer``, ``compose_horner``, ``div_basecase``,\\ ``div_divconquer``, ``div_newton``, ``divrem``,\\ ``divrem_basecase``, ``divrem_divconquer``,\\ ``divrem``, ``divrem_f``,\\ ``gcd``, ``gcd_euclidean``, ``gcd_euclidean_f``, ``gcd_f``,\\ ``gcdinv``, ``invmod``, ``inv_series_newton``,\\ ``shift_left``, ``shift_right``, ``pow``,\\ ``rem_basecase``, ``xgcd``, ``xgcd_euclidean``. .. cpp:function:: Fmpz_mod_poly_expr::ternary operation(??, ??) const The following terna.. cpp:functions are made available as member functions:\\ ``compose_mod``, ``compose_mod_horner``,\\ ``compose_series_brent_kung``, ``mullow``,\\ ``mulmod``, ``powmod_binexp``, ``pow_trunc``,\\ ``pow_trunc_binexp``. .. cpp:function:: Fmpz_mod_poly_expr Fmpz_mod_poly_expr::operator()(Fmpz_mod_poly_expr) const .. cpp:function:: Fmpz_mod_expr Fmpz_mod_poly_expr::operator()(Fmpz_mod_expr) const The ``operator()`` is overloaded for evaluation or composition, depending on the argument. .. cpp:function:: Fmpz_mod_poly_expr operator?(??, ??) Arithmetic operators ``+ - * %`` are overloaded when provided by ``nmod_poly_t``. .. cpp:function:: Fmpz_mod_poly_expr operator-(Fmpz_mod_poly_expr) The unary negation operator is overloaded. Input and output ------------------------------------------------------------------------------- .. cpp:function:: print(Fmpz_mod_poly_expr) .. cpp:function:: print(FILE*, Fmpz_mod_poly_expr) .. cpp:function:: print_pretty(Fmpz_mod_poly_expr, const char* var) .. cpp:function:: print_pretty(FILE*, Fmpz_mod_poly_expr, const char* var) .. cpp:function:: read(Fmpz_mod_poly_target) .. cpp:function:: read(FILE*, Fmpz_mod_poly_target) Memory management ------------------------------------------------------------------------------- .. cpp:function:: fmpz_mod_polyxx::fmpz_mod_polyxx(Fmpz_expr n) .. cpp:function:: fmpz_mod_polyxx::fmpz_mod_polyxx(Fmpz_expr n, slong alloc) .. cpp:function:: void Fmpz_mod_poly_target realloc(slong alloc) .. cpp:function:: void Fmpz_mod_poly_target::fit_length(slong len) .. cpp:function:: void Fmpz_mod_poly_target::_normalise() .. cpp:function:: void Fmpz_mod_poly_target::truncate(slong) Randomisation ------------------------------------------------------------------------------- .. cpp:function:: void Fmpz_mod_poly_mat_target::set_randtest(frandxx&, slong) .. cpp:function:: void Fmpz_mod_poly_mat_target::set_randtest_irreducible(frandxx&, slong) .. cpp:function:: void Fmpz_mod_poly_mat_target::set_randtest_not_zero(frandxx&, slong) See ``fmpz_mod_poly_randtest``, etc. .. cpp:function:: static fmpz_mod_polyxx fmpz_mod_polyxx::randtest(Fmpz_expr, frandx&, slong) .. cpp:function:: static fmpz_mod_polyxx fmpz_mod_polyxx::randtest_not_zero(Fmpz_expr, frandx&, slong) .. cpp:function:: static fmpz_mod_polyxx fmpz_mod_polyxx::randtest_irreducible(Fmpz_expr, frandx&, slong) Static versions of the above. Attributes ------------------------------------------------------------------------------- .. cpp:function:: fmpzxx_srcref Fmpz_mod_poly_mat_expr::modulus() const Obtain the relevant modulus. This never causes evaluation. .. cpp:function:: slong Fmpz_mod_poly_expr::length() const .. cpp:function:: slong Fmpz_mod_poly_expr::degree() const .. cpp:function:: ?? Fmpz_mod_poly_expr::lead() const Unified coefficient access for the leading coefficient. The result is undefined if the length of the polynomial is zero. Assignment and swap ------------------------------------------------------------------------------- .. cpp:function:: void Fmpz_mod_poly_target::zero_coeffs(slong i, slong j) .. cpp:function:: void Fmpz_mod_poly_target::set_zero() .. cpp:function:: static fmpz_mod_polyxx fmpz_mod_polyxx::zero(Fmpz_expr m) Conversion ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_mod_poly_target Fmpz_mod_poly_target::operator=(T:is_unsigned_integer) .. cpp:function:: Fmpz_mod_poly_target Fmpz_mod_poly_target::operator=(Fmpz_expr) .. cpp:function:: Fmpz_mod_poly_target Fmpz_mod_poly_target::operator=(Fmpz_poly_expr) See ``fmpz_mod_poly_set_ui``, ``fmpz_mod_poly_set_fmpz`` and ``fmpz_mod_poly_set_fmpz_poly``. .. cpp:function:: Fmpz_poly_expr Fmpz_mod_poly_expr::to() const Comparison ------------------------------------------------------------------------------- .. cpp:function:: bool Fmpz_mod_poly_expr::is_zero() const Getting and setting coefficients ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_expr Fmpz_mod_poly_expr::get_coeff(slong n) const .. cpp:function:: void Fmpz_mod_target::set_coeff(slong i, Fmpz_expr) .. cpp:function:: void Fmpz_mod_target::set_coeff(slong i, T:is_unsigned_integer) Shifting ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_mod_poly_expr shift_left(Fmpz_mod_poly_expr, T:fits_into_slong) .. cpp:function:: Fmpz_mod_poly_expr shift_right(Fmpz_mod_poly_expr, T:fits_into_slong) Multiplication ------------------------------------------------------------------------------- The overloaded ``operator*`` can be used for both poly-poly and poly-scalar multiplication. Finer control can be obtained using the followi.. cpp:functions. .. cpp:function:: Fmpz_mod_poly_expr mullow(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr, slong) .. cpp:function:: Fmpz_mod_poly_expr sqr(Fmpz_mod_poly_expr) .. cpp:function:: Fmpz_mod_poly_expr mulmod(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr, Fmpz_mod_poly_expr) Powering ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_mod_poly_expr pow(Fmpz_mod_poly_expr, T:is_unsigned_integer) .. cpp:function:: Fmpz_mod_poly_expr pow_binexp(Fmpz_mod_poly_expr, T:is_unsigned_integer) .. cpp:function:: Fmpz_mod_poly_expr pow_trunc(Fmpz_mod_poly_expr, T:is_unsigned_integer, T:fits_into_slong) .. cpp:function:: Fmpz_mod_poly_expr pow_trunc_binexp(Fmpz_mod_poly_expr, T:is_unsigned_integer, T:fits_into_slong) .. cpp:function:: Fmpz_mod_poly_expr powmod_binexp(Fmpz_mod_poly_expr, T:is_unsigned_integer, Fmpz_mod_poly_expr) .. cpp:function:: Fmpz_mod_poly_expr powmod_binexp(Fmpz_mod_poly_expr, Fmpz_expr, Fmpz_mod_poly_expr) Division ------------------------------------------------------------------------------- The overloaded operators ``/ %`` can be used for division and remainder. Finer control can be obtained using the followi.. cpp:functions. .. cpp:function:: Ltuple_expr divrem(Fmpz_mod_poly_expr A, Fmpz_mod_poly_expr B) .. cpp:function:: Ltuple_expr divrem_basecase(Fmpz_mod_poly_expr A, Fmpz_mod_poly_expr B) .. cpp:function:: Ltuple_expr divrem_divconquer(Fmpz_mod_poly_expr A, Fmpz_mod_poly_expr B) .. cpp:function:: Ltuple_expr divrem_f(Fmpz_mod_poly_expr A, Fmpz_mod_poly_expr B) .. cpp:function:: Fmpz_mod_poly_expr div_basecase(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr) .. cpp:function:: Fmpz_mod_poly_expr rem_basecase(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr) .. cpp:function:: Fmpz_mod_poly_expr rem(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr) .. cpp:function:: slong Fmpz_mod_poly_target::remove(Fmpz_mod_poly_expr) Power series inversion ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_mod_poly_expr inv_series_newton(Fmpz_mod_poly_expr, T:fits_into_slong) Greatest common divisor ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_mod_poly_expr gcd(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr) .. cpp:function:: Fmpz_mod_poly_expr gcd_euclidean(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr) .. cpp:function:: Ltuple_expr xgcd(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr) .. cpp:function:: Ltuple_expr xgcd_euclidean(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr) .. cpp:function:: Ltuple_expr gcdinv(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr) .. cpp:function:: Ltuple_expr gcd_f(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr) .. cpp:function:: Ltuple_expr gcd_euclidean_f(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr) .. cpp:function:: Fmpz_mod_poly_expr invmod(Fmpz_mod_poly_expr f, Fmpz_mod_poly_expr g) See ``fmpz_mod_poly_invmod``. Raises ``flint_exception`` if $f$ and $g$ are not coprime. Derivative ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_mod_poly_expr derivative(Fmpz_mod_poly_expr) Evaluation ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_mod_expr evaluate(Fmpz_mod_poly_expr, Fmpz_mod_expr) Composition ------------------------------------------------------------------------------- Basic composition can be achieved with the overloaded ``operator()``. Finer control can be obtained using the followi.. cpp:functions. .. cpp:function:: Fmpz_mod_poly_expr compose(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr) .. cpp:function:: Fmpz_mod_poly_expr compose_horner(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr) .. cpp:function:: Fmpz_mod_poly_expr compose_divconquer(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr) Modular composition ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_mod_poly_expr compose_mod(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr, Fmpz_mod_poly_expr) .. cpp:function:: Fmpz_mod_poly_expr compose_mod_horner(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr, Fmpz_mod_poly_expr) .. cpp:function:: Fmpz_mod_poly_expr compose_mod_divconquer(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr, Fmpz_mod_poly_expr) .. cpp:function:: Fmpz_mod_poly_expr compose_mod_brent_kung(Fmpz_mod_poly_expr, Fmpz_mod_poly_expr, Fmpz_mod_poly_expr) Radix conversion ------------------------------------------------------------------------------- .. cpp:function:: fmpz_mod_poly_radixxx::fmpz_mod_poly_radixxx(Fmpz_poly_expr, slong deg) Initialise temporary data for radix conversion. See ``fmpz_mod_poly_radix_init``. .. cpp:function:: Fmpz_mod_poly_vec_expr Fmpz_mod_poly_expr::radix(const fmpz_mod_poly_radxxx&) .. cpp:function:: Fmpz_mod_poly_vec_expr radix(Fmpz_mod_poly_expr F, const fmpz_mod_poly_radxxx&) Perform radix conversion. See ``fmpz_mod_poly_radix``. Note that computing the output vector size requires knowing the degree of ``F``. In the current implementation, this will result in evaluating ``F`` twice. In order to avoid this, pass in ``F`` in evaluated form, or do not form expressions requiring temporaries. Factoring polynomials over the integers mod `n` (``fmpz_mod_poly_factor``) =============================================================================== .. cpp:function:: bool Fmpz_mod_poly_expr::is_squarefree() const .. cpp:function:: bool Fmpz_mod_poly_expr::is_irreducible() const .. cpp:function:: bool Fmpz_mod_poly_expr::is_irreducible_ddf() const .. cpp:function:: bool Fmpz_mod_poly_expr::is_irreducible_rabin() const .. cpp:function:: slong Fmpz_mod_poly_target::remove(Fmpz_mod_poly_expr) .. cpp:function:: fmpz_mod_poly_factorxx::nmod_poly_factorxx() Initialise an empty factorisation. .. cpp:function:: fmpz_mod_poly_factorxx::nmod_poly_factorxx(const nmod_poly_factorxx& o) Copy a factorisation. .. cpp:function:: bool fmpz_mod_poly_factorxx::operator==(const nmod_poly_factorxx&) Compare two factorisations. .. cpp:function:: ulong fmpz_mod_poly_factorxx::size() const Return the number of stored factors. .. cpp:function:: slong fmpz_mod_poly_factorxx::exp(slong i) const .. cpp:function:: slong& fmpz_mod_poly_factorxx::exp(slong i) Obtain the exponent of the ith factor. .. cpp:function:: fmpz_mod_polyxx_srcref nmod_poly_factorxx::p(slong i) const .. cpp:function:: fmpz_mod_polyxx_ref nmod_poly_factorxx::p(slong i) Obtain the ith factor. .. cpp:function:: void fmpz_mod_poly_factorxx::realloc(slong a) .. cpp:function:: void fmpz_mod_poly_factorxx::fit_length(slong a) .. cpp:function:: void fmpz_mod_poly_factorxx::insert(Fmpz_mod_poly_expr p, slong e) .. cpp:function:: void fmpz_mod_poly_factorxx::concat(const nmod_poly_factorxx&) .. cpp:function:: void fmpz_mod_poly_factorxx::set_factor(Fmpz_mod_poly_expr) .. cpp:function:: void fmpz_mod_poly_factorxx::set_factor_cantor_zassenhaus(Fmpz_mod_poly_expr) .. cpp:function:: void fmpz_mod_poly_factorxx::set_factor_berlekamp(Fmpz_mod_poly_expr) .. cpp:function:: void fmpz_mod_poly_factorxx::set_factor_kaltofen_shoup(Fmpz_mod_poly_expr) .. cpp:function:: void fmpz_mod_poly_factorxx::set_factor_squarefree(Fmpz_mod_poly_expr) Factorise a polynomial and store its factors. See ``fmpz_mod_poly_factor`` etc. .. cpp:function:: void fmpz_mod_poly_factorxx::set_factor_equal_deg_probab(frandxx&, Fmpz_mod_poly_expr, slong) .. cpp:function:: void fmpz_mod_poly_factorxx::set_factor_equal_deg(Fmpz_mod_poly_expr, slong) See ``fmpz_mod_poly_factor_equal_deg_prob`` and ``fmpz_mod_poly_factor_equal_deg``. .. cpp:function:: void fmpz_mod_poly_factorxx::set_factor_distinct_deg(Fmpz_mod_poly_expr p, std::vector& degs) See ``fmpz_mod_poly_factor_distinct_deg``. Note that ``degs`` must have sufficient size to hold all factors. The size of ``degs`` is not modified. .. cpp:function:: fmpz_mod_poly_factorxx factor(Fmpz_mod_poly_expr) .. cpp:function:: fmpz_mod_poly_factorxx factor_cantor_zassenhaus(Fmpz_mod_poly_expr) .. cpp:function:: fmpz_mod_poly_factorxx factor_berlekamp(Fmpz_mod_poly_expr) .. cpp:function:: fmpz_mod_poly_factorxx factor_kaltofen_shoup(Fmpz_mod_poly_expr) .. cpp:function:: fmpz_mod_poly_factorxx factor_squarefree(Fmpz_mod_poly_expr) P-adics (``padic``) =============================================================================== The type ``padicxx`` wraps the C interface ``padic_t``, and the type ``padicxx_ctx`` wraps ``padic_ctx_t``. Evaluating composite expressions requires temporary objects, which must be initialised to a certain precision and with a certain context. The padicxx library employs the following rules: - In any compound expression, there must only be one context involved. - Temporary objects are initialised to the maximum precision of any subexpression. In most use cases, all objects in a compound expression have the same precision, and so temporary expressions are evaluated to this precision. If you need temporary subexpressions to be evaluated to higher precision, the ``toN`` method can be used on immediates to increase their effective precision, thus (potentially) increasing the precision of intermediates. Context ------------------------------------------------------------------------------- .. cpp:function:: padicxx_ctx::padicxx_ctx(Fmpz_src p, slong min, slong max, padic_print_mode mode) Initialize a padic context. See ``padic_ctx_init``. .. cpp:function:: padic_ctx_t& padicxx_ctx::_ctx() const Obtain a reference to the underlying C data structure. Note that this reference is mutable even if the instance of ``padicxx_ctx`` it is obtained from is not. This is because the context contains data which is not user-visible, and the.. cpp:functions change them. If this is called on a constant instance of ``padicxx_ctx``, you must ensure that no user-visible state is changed. .. cpp:function:: padic_print_mode& padicxx_ctx::mode() .. cpp:function:: padic_print_mode padicxx_ctx::mode() const C++ particulars ------------------------------------------------------------------------------- .. cpp:function:: padicxx_ctx_srcref Padic_src::get_ctx() const .. cpp:function:: padic_ctx_t& Padic_src::_ctx() const Obtain a reference to the context of this instance. .. cpp:function:: padicxx_ctx_srcref Padic_expr::estimate_ctx() const Obtain a reference to a context occurring in a subexpression. As per the first rule in the introduction to this section, all such contexts are the same by definition. .. cpp:function:: Padic_expr::unary operation() const The following una.. cpp:functions are made available as member functions: ``exp``, ``exp_balanced``, ``exp_rectangular``, ``inv``, ``log``, ``log_balanced``, ``log_satoh``, ``sqrt``, ``teichmuller``. .. cpp:function:: Padic_expr Padic_expr::pow(T:fits_into_slong) const .. cpp:function:: padicxx_srcref Padic_src::toN(sslong N) const Obtain a new version of the operand, with changed effective precision. Input and output ------------------------------------------------------------------------------- .. cpp:function:: int print(Padic_expr) .. cpp:function:: int print(FILE*, Padic_expr) Data structures ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_expr Padic_expr::unit() const See ``padic_unit``. .. cpp:function:: slong Padic_expr::val() const .. cpp:function:: slong& Padic_target::val() .. cpp:function:: slong Padic_expr::prec() const .. cpp:function:: slong& Padic_target::prec() Obtain the precision of this instance. See ``padic_prec``. Note that this never requires evaluation. Memory management ------------------------------------------------------------------------------- .. cpp:function:: padicxx::padicxx(padicxx_ctx_srcref) Initialize padic number to default precision. See ``padic_init``. .. cpp:function:: padicxx::padicxx(padicxx_ctx_srcref c, slong N) Initialize padic number to precision $N$. See ``padic_init2``. .. cpp:function:: void Padic_target::reduce() See ``padic_reduce``. Randomisation ------------------------------------------------------------------------------- .. cpp:function:: static padicxx padicxx::randtest(frandxx& state, padicxx_ctx_srcref ctx, slong prec = PADIC_DEFAULT_PREC) .. cpp:function:: static padicxx padicxx::randtest_int(frandxx& state, padicxx_ctx_srcref ctx, slong prec = PADIC_DEFAULT_PREC) .. cpp:function:: static padicxx padicxx::randtest_not_zero(frandxx& state, padicxx_ctx_srcref ctx, slong prec = PADIC_DEFAULT_PREC) Obtain a random padic number of precision ``prec``. See ``padic_randtest``, ``padic_randtest_int`` and ``padic_randtest_not_zero``. Conversion ------------------------------------------------------------------------------- .. cpp:function:: Padic_target Padic_target::operator=(T:is_integer) .. cpp:function:: Padic_target Padic_target::operator=(Fmpz_expr) .. cpp:function:: Padic_target Padic_target::operator=(Fmpq_expr) .. cpp:function:: padicxx padicxx::from_QQ(Fmpq_expr, padicxx_ctx_srcref) .. cpp:function:: padicxx padicxx::from_QQ(Fmpz_expr, padicxx_ctx_srcref) .. cpp:function:: padicxx padicxx::from_QQ(T:is_integer, padicxx_ctx_srcref) .. cpp:function:: padicxx padicxx::from_QQ(Fmpq_expr, padicxx_ctx_srcref, sslong N) .. cpp:function:: padicxx padicxx::from_QQ(Fmpz_expr, padicxx_ctx_srcref, sslong N) .. cpp:function:: padicxx padicxx::from_QQ(T:is_integer, padicxx_ctx_srcref, sslong N) .. cpp:function:: void Padic_target::set_zero() .. cpp:function:: void Padic_target::set_one() .. cpp:function:: padicxx padicxx::zero(padicxx_ctx_srcref) .. cpp:function:: padicxx padicxx::zero(padicxx_ctx_srcref, sslong N) .. cpp:function:: padicxx padicxx::one(padicxx_ctx_srcref) .. cpp:function:: padicxx padicxx::one(padicxx_ctx_srcref, sslong N) .. cpp:function:: bool Padic_expr::is_zero() const .. cpp:function:: bool Padic_expr::is_one() const .. cpp:function:: fmpzxx Padic_expr::to() const Convert self to ``fmpzxx``, if possible. See ``padic_get_fmpz``. .. cpp:function:: fmpqxx Padic_expr::to() const Convert self to ``fmpqxx``. See ``padic_get_fmpz``. .. cpp:function:: std::string Fmpz_expr::to_string() const Arithmetic operations ------------------------------------------------------------------------------- The overloaded operators ``+ - * / << >>`` can be used for arithmetic operations, provided these are implemented for ``padic_t``. .. cpp:function:: Padic_expr inv(Padic_expr) .. cpp:function:: Padic_expr sqrt(Padic_expr) Compute square root. May raise ``flint_exception`` if no square root exists. See ``padic_sqrt``. .. cpp:function:: Padic_expr pow(Padic_expr, T:fits_into_slong) Exponential ------------------------------------------------------------------------------- .. cpp:function:: Padic_expr exp(Padic_expr) .. cpp:function:: Padic_expr exp_rectangular(Padic_expr) .. cpp:function:: Padic_expr exp_balanced(Padic_expr) Compute the exponenti.. cpp:function. These may raise ``flint_exception`` if the series do not converge. Logarithm ------------------------------------------------------------------------------- .. cpp:function:: Padic_expr log(Padic_expr) .. cpp:function:: Padic_expr log_rectangular(Padic_expr) .. cpp:function:: Padic_expr log_balanced(Padic_expr) .. cpp:function:: Padic_expr log_satoh(Padic_expr) Compute the logarit.. cpp:function. These may raise ``flint_exception`` if the series do not converge. Polynomials over the `p`-adics (``padic_poly``) =============================================================================== The type ``padic_polyxx`` wraps ``padic_poly``. Like ``padicxx``, every instance of ``padic_polyxx`` contains a reference to a context ``padicxx_ctx``, and stores its own precision. The same rules regarding temporary expressions apply to ``padic_polyxx`` as to ``padicxx``. C++ particulars ------------------------------------------------------------------------------- .. cpp:function:: padicxx_ctx_srcref Padic_poly_src::get_ctx() const .. cpp:function:: padic_ctx_t& Padic_poly_src::_ctx() const Obtain a reference to the context of this instance. .. cpp:function:: padicxx_ctx_srcref Padic_poly_expr::estimate_ctx() const Obtain a reference to a context occurring in a subexpression. .. cpp:function:: Padic_poly_expr::unary operation() const The following una.. cpp:functions are made available as member functions: ``derivative``. .. cpp:function:: Padic_poly_expr::binary operation() const The following bina.. cpp:functions are made available as member functions: ``pow``, ``compose_pow``, ``inv_series``, ``shift_left``, ``shift_right``. .. cpp:function:: padic_polyxx_srcref Padic_poly_src::toN(sslong N) const Obtain a new version of the operand, with changed effective precision. Input and output ------------------------------------------------------------------------------- .. cpp:function:: int print(Padic_expr) .. cpp:function:: int print(FILE*, Padic_expr) .. cpp:function:: int print_pretty(Padic_expr, const char*) .. cpp:function:: int print_pretty(FILE*, Padic_expr, const char*) Memory management ------------------------------------------------------------------------------- .. cpp:function:: padic_polyxx::padic_polyxx(padicxx_ctx_srcref) Initialise to zero. See ``padic_poly_init``. .. cpp:function:: padic_polyxx::padic_polyxx(padicxx_ctx_srcref, slong prec, slong alloc = 0) See ``padic_poly_init2``. .. cpp:function:: void Padic_poly_target realloc(slong alloc) .. cpp:function:: void Padic_poly_target::fit_length(slong len) .. cpp:function:: void Padic_poly_target::canonicalise() .. cpp:function:: void Padic_poly_target::reduce() .. cpp:function:: void Padic_poly_target::truncate(slong) Polynomial parameters ------------------------------------------------------------------------------- .. cpp:function:: slong Padic_poly_expr::length() const .. cpp:function:: slong Padic_poly_expr::degree() const .. cpp:function:: slong Padic_expr::val() const .. cpp:function:: slong& Padic_target::val() .. cpp:function:: slong Padic_expr::prec() const .. cpp:function:: slong& Padic_target::prec() Randomisation ------------------------------------------------------------------------------- .. cpp:function:: static padic_polyxx padic_polyxx::randtest(frandxx& state, padicxx_ctx_srcref ctx, slong len, slong prec = PADIC_DEFAULT_PREC) .. cpp:function:: static padic_polyxx padic_polyxx::randtest_val(frandxx& state, padicxx_ctx_srcref ctx, slong len, slong val, slong prec = PADIC_DEFAULT_PREC) .. cpp:function:: static padic_polyxx padic_polyxx::randtest_not_zero(frandxx& state, slong len, padicxx_ctx_srcref ctx, slong prec = PADIC_DEFAULT_PREC) Assignment and basic manipulation ------------------------------------------------------------------------------- The overloaded ``operator=`` can be used for assignments. Additionally, we provide the followi.. cpp:functions. .. cpp:function:: padic_polyxx padic_polyxx::from_QQ(T:is_integer, padicxx_ctx_srcref, sslong N) .. cpp:function:: padic_polyxx padic_polyxx::from_QQ(Fmpz_expr, padicxx_ctx_srcref, sslong N) .. cpp:function:: padic_polyxx padic_polyxx::from_QQ(Fmpq_expr, padicxx_ctx_srcref, sslong N) .. cpp:function:: padic_polyxx padic_polyxx::from_QQ(T:is_integer, padicxx_ctx_srcref) .. cpp:function:: padic_polyxx padic_polyxx::from_QQ(Fmpz_expr, padicxx_ctx_srcref) .. cpp:function:: padic_polyxx padic_polyxx::from_QQ(Fmpq_expr, padicxx_ctx_srcref) .. cpp:function:: padic_polyxx padic_polyxx::from_QQX(Fmpz_poly_expr, padicxx_ctx_srcref, sslong N) .. cpp:function:: padic_polyxx padic_polyxx::from_QQX(Fmpq_poly_expr, padicxx_ctx_srcref, sslong N) .. cpp:function:: padic_polyxx padic_polyxx::from_QQX(Fmpz_poly_expr, padicxx_ctx_srcref) .. cpp:function:: padic_polyxx padic_polyxx::from_QQX(Fmpz_poly_expr, padicxx_ctx_srcref) .. cpp:function:: padic_polyxx padic_polyxx::from_ground(Padic_expr) .. cpp:function:: fmpz_polyxx Padic_poly_expr::to() const Convert to an integer polynomial. Raises ``flint_exception`` if the polynomial is not p-adically integral. See ``padic_poly_get_fmpz_poly``. .. cpp:function:: fmpq_polyxx Padic_poly_expr::to() const See ``padic_poly_get_fmpq_poly``. .. cpp:function:: padic_polyxx padic_polyxx::zero(const padic_polyxx_ctx&) .. cpp:function:: padic_polyxx padic_polyxx::zero(const padic_polyxx_ctx&, sslong N) .. cpp:function:: padic_polyxx padic_polyxx::one(const padic_polyxx_ctx&) .. cpp:function:: padic_polyxx padic_polyxx::one(const padic_polyxx_ctx&, sslong N) Getting and setting coefficients ------------------------------------------------------------------------------- .. cpp:function:: Padic_expr Padic_poly_expr::get_coeff(slong n) const .. cpp:function:: void Padic_poly_target::set_coeff(slong i, Padic_expr) Comparison ------------------------------------------------------------------------------- The overloaded ``operator==`` can be used for comparison. .. cpp:function:: bool Padic_poly_expr::is_zero() const .. cpp:function:: bool Padic_poly_expr::is_one() const Arithmetic ------------------------------------------------------------------------------- The overloaded operators ``+ - *`` can be used for arithmetic. Powering ------------------------------------------------------------------------------- .. cpp:function:: Padic_poly_expr pow(Padic_poly_expr, T:fits_into_slong) Series inversion ------------------------------------------------------------------------------- .. cpp:function:: Padic_poly_expr inv_series_newton(Padic_poly_expr, T:fits_into_slong) Derivative ------------------------------------------------------------------------------- .. cpp:function:: Padic_poly_expr derivative(Padic_poly_expr) Shifting ------------------------------------------------------------------------------- .. cpp:function:: Padic_poly_expr shift_left(Padic_poly_expr, T:fits_into_slong) .. cpp:function:: Padic_poly_expr shift_right(Padic_poly_expr, T:fits_into_slong) Evaluation and composition ------------------------------------------------------------------------------- The overloaded ``operator()`` can be used for both evaluation and composition. .. cpp:function:: Padic_expr evaluate(Padic_poly_expr, Padic_expr) .. cpp:function:: Padic_poly_expr compose(Padic_poly_expr, Padic_poly_expr) .. cpp:function:: Padic_poly_expr compose_pow(Padic_poly_expr, T:fits_into_slong) Testing ------------------------------------------------------------------------------- .. cpp:function:: bool Padic_poly_src::is_canonical() const .. cpp:function:: bool Padic_poly_src::is_reduced() const Matrices of $p$-adics (``padic_mat``) =============================================================================== The type ``padic_matxx`` wraps ``padic_mat``. Like ``padicxx``, every instance of ``padic_matxx`` contains a reference to a context ``padicxx_ctx``, and stores its own precision. The same rules regarding temporary expressions apply to ``padic_matxx`` as to ``padicxx``. C++ particulars ------------------------------------------------------------------------------- .. cpp:function:: padicxx_ctx_srcref Padic_mat_src::get_ctx() const .. cpp:function:: padic_ctx_t& Padic_mat_src::_ctx() const Obtain a reference to the context of this instance. .. cpp:function:: padicxx_ctx_srcref Padic_mat_expr::estimate_ctx() const Obtain a reference to a context occurring in a subexpression. .. cpp:function:: padic_matxx_srcref Padic_mat_src::toN(sslong N) const Obtain a new version of the operand, with changed effective precision. .. cpp:function:: slong Padic_mat_expr::rows() const .. cpp:function:: slong Padic_mat_expr::cols() const Obtain the number of rows/columns of this matrix. This never evaluates. .. cpp:function:: slong Padic_mat_expr::val() const .. cpp:function:: slong& Padic_mat_target::val() .. cpp:function:: Padic_mat_expr Padic_mat_expr::transpose() const Input and output ------------------------------------------------------------------------------- .. cpp:function:: int print(Padic_mat_expr) .. cpp:function:: int print(FILE*, Padic_mat_expr) .. cpp:function:: int print_pretty(Padic_mat_expr) .. cpp:function:: int print_pretty(FILE*, Padic_mat_expr) Memory management ------------------------------------------------------------------------------- .. cpp:function:: padic_matxx::padic_matxx(padicxx_ctx_srcref, slong rows, slong cols) See ``padic_mat_init``. .. cpp:function:: padic_matxx::padic_matxx(padicxx_ctx_srcref, slong rows, slong cols, slong prec) See ``padic_mat_init2``. .. cpp:function:: void Padic_mat_target::canonicalise() .. cpp:function:: void Padic_mat_target::reduce() .. cpp:function:: bool Padic_mat_src::is_canonical() const .. cpp:function:: bool Padic_mat_src::is_reduced() const .. cpp:function:: bool Padic_mat_src::is_square() const .. cpp:function:: bool Padic_mat_src::is_empty() const Basic assignment ------------------------------------------------------------------------------- Overloaded ``operator=`` can be used for assignment. .. cpp:function:: void Padic_mat_target::set_zero() .. cpp:function:: void Padic_mat_target::set_one() .. cpp:function:: padic_matxx padic_matxx::zero(padicxx_ctx_srcref) .. cpp:function:: padic_matxx padic_matxx::zero(padicxx_ctx_srcref, sslong N) .. cpp:function:: padic_matxx padic_matxx::one(padicxx_ctx_srcref) .. cpp:function:: padic_matxx padic_matxx::one(padicxx_ctx_srcref, sslong N) Conversion ------------------------------------------------------------------------------- Converting from a ``fmpq_matxx`` can be done using ``operator=``, or the followi.. cpp:functions. .. cpp:function:: padic_matxx padic_matxx::from_QQ(Fmpq_mat_expr, padicxx_ctx_srcref) .. cpp:function:: fmpq_matxx Padic_mat_expr::to() const Entries ------------------------------------------------------------------------------- .. cpp:function:: ?? Padic_mat_expr::at(slong i, slong j) Unified coefficient access to the underlying integer matrix. See ``padic_mat_entry``. .. cpp:function:: Fmpz_expr Padic_mat_expr::get_entry(slong i, slong j) .. cpp:function:: void Padic_mat_target::set_entry(slong i, slong j, Padic_expr) Comparison ------------------------------------------------------------------------------- Overloaded ``operator==`` can be used for comparison. .. cpp:function:: bool Padic_mat_expr::is_zero() const Random matrix generation ------------------------------------------------------------------------------- .. cpp:function:: static padic_polyxx padic_polyxx::randtest(slong rows, slong cols, frandxx& state, padicxx_ctx_srcref ctx, slong prec = PADIC_DEFAULT_PREC) Transpose ------------------------------------------------------------------------------- .. cpp:function:: Padic_mat_expr transpose(Padic_mat_expr) Arithmetic ------------------------------------------------------------------------------- Overloaded operators ``+ - * /`` can be used for arithmetic. Q-adics (``qadic``) =============================================================================== The type ``qadicxx`` wraps the C interface ``qadic_t``, and the type ``qadicxx_ctx`` wraps ``qadic_ctx_t``. Evaluating composite expressions requires temporary objects, which must be initialised to a certain precision and with a certain context. The same rules apply as for ``padicxx``. Context ------------------------------------------------------------------------------- .. cpp:function:: qadicxx_ctx::qadicxx_ctx(Fmpz_src p, sslong min, slong max, padic_print_mode mode, const char* var = "x") Initialize a qadic context. See ``qadic_ctx_init_conway``. .. cpp:function:: qadic_ctx_t& qadicxx_ctx::_ctx() const Obtain a reference to the underlying C data structure. Note that this reference is mutable even if the instance of ``qadicxx_ctx`` it is obtained from is not. This is because the context contains data which is not user-visible, and the.. cpp:functions change them. If this is called on a constant instance of ``qadicxx_ctx``, you must ensure that no user-visible state is changed. .. cpp:function:: padicxx_ctx_srcref qadicxx_ctx::pctx() const Obtain a reference to the underlying padic context. C++ particulars ------------------------------------------------------------------------------- .. cpp:function:: padicxx_ctx_srcref Qadic_src::get_ctx() const .. cpp:function:: const qadicxx_ctx& Qadic_src::get_qctx() const .. cpp:function:: qadic_ctx_t& Qadic_src::_ctx() const Obtain a reference to the context of this instance. .. cpp:function:: const qadicxx_ctx& Qadic_expr::estimate_ctx() const Obtain a reference to a context occurring in a subexpression. As per the first rule in the introduction to this section, all such contexts are the same by definition. .. cpp:function:: Qadic_expr::unary operation() const The following una.. cpp:functions are made available as member functions: ``exp``, ``exp_balanced``, ``exp_rectangular``, ``inv``, ``log``, ``log_balanced``, ``teichmuller``, ``trace``, ``norm``, ``norm_analytic``, ``norm_resultant``. .. cpp:function:: Qadic_expr Qadic_expr::pow(Fmpz_expr) const .. cpp:function:: Qadic_expr Qadic_expr::frobenius(T:fits_into_slong) const .. cpp:function:: qadicxx_srcref Qadic_src::toN(sslong N) const Obtain a new version of the operand, with changed effective precision. Data structures ------------------------------------------------------------------------------- .. cpp:function:: int print_pretty(Qadic_expr) .. cpp:function:: int print_pretty(FILE*, Qadic_expr) Data structures ------------------------------------------------------------------------------- .. cpp:function:: slong Qadic_expr::val() const .. cpp:function:: slong Qadic_expr::prec() const Obtain the precision of this instance. See ``qadic_prec``. Note that this never requires evaluation. Memory management ------------------------------------------------------------------------------- .. cpp:function:: qadicxx::qadicxx(const qadicxx_ctx&) Initialize qadic number to default precision. See ``qadic_init``. .. cpp:function:: qadicxx::qadicxx(const qadicxx_ctx& c, slong N) Initialize qadic number to precision $N$. See ``qadic_init2``. .. cpp:function:: void Qadic_target::reduce() See ``qadic_reduce``. Randomisation ------------------------------------------------------------------------------- .. cpp:function:: static qadicxx qadicxx::randtest(frandxx& state, const qadicxx_ctx& ctx, slong prec = PADIC_DEFAULT_PREC) .. cpp:function:: static qadicxx qadicxx::randtest_int(frandxx& state, slong val, const qadicxx_ctx& ctx, slong prec = PADIC_DEFAULT_PREC) .. cpp:function:: static qadicxx qadicxx::randtest_val(frandxx& state, const qadicxx_ctx& ctx, slong prec = PADIC_DEFAULT_PREC) .. cpp:function:: static qadicxx qadicxx::randtest_not_zero(frandxx& state, const qadicxx_ctx& ctx, slong prec = PADIC_DEFAULT_PREC) Obtain a random qadic number of precision ``prec``. See ``qadic_randtest``, ``qadic_randtest_int`` and ``qadic_randtest_not_zero``. Conversion ------------------------------------------------------------------------------- .. cpp:function:: Qadic_target Qadic_target::operator=(T:is_unsigned_integer) .. cpp:function:: Qadic_target Qadic_target::operator=(Padic_expr) .. cpp:function:: qadicxx qadicxx::from_ground(Padic_expr, const qadicxx_ctx&) .. cpp:function:: void Qadic_target::set_zero() .. cpp:function:: void Qadic_target::set_one() .. cpp:function:: void Qadic_target::set_gen(const qadicxx_ctx&) .. cpp:function:: qadicxx qadicxx::zero(const qadicxx_ctx&) .. cpp:function:: qadicxx qadicxx::zero(const qadicxx_ctx&, sslong N) .. cpp:function:: qadicxx qadicxx::one(const qadicxx_ctx&) .. cpp:function:: qadicxx qadicxx::one(const qadicxx_ctx&, sslong N) .. cpp:function:: qadicxx qadicxx::gen(const qadicxx_ctx&) .. cpp:function:: qadicxx qadicxx::gen(const qadicxx_ctx&, sslong N) .. cpp:function:: bool Qadic_expr::is_zero() const .. cpp:function:: bool Qadic_expr::is_one() const .. cpp:function:: padicxx Qadic_expr::to() const Convert self to ``padicxx``, if possible. See ``qadic_get_padic``. Arithmetic operations ------------------------------------------------------------------------------- The overloaded operators ``+ - * / << >>`` can be used for arithmetic operations, provided these are implemented for ``qadic_t``. .. cpp:function:: Qadic_expr inv(Qadic_expr) .. cpp:function:: Qadic_expr pow(Qadic_expr, Fmpz_expr) Exponential ------------------------------------------------------------------------------- .. cpp:function:: Qadic_expr exp(Qadic_expr) .. cpp:function:: Qadic_expr exp_rectangular(Qadic_expr) .. cpp:function:: Qadic_expr exp_balanced(Qadic_expr) Compute the exponenti.. cpp:function. These may raise ``flint_exception`` if the series do not converge. Logarithm ------------------------------------------------------------------------------- .. cpp:function:: Qadic_expr log(Qadic_expr) .. cpp:function:: Qadic_expr log_balanced(Qadic_expr) Compute the logarit.. cpp:function. These may raise ``flint_exception`` if the series do not converge. Speci.. cpp:functions ------------------------------------------------------------------------------- .. cpp:function:: Qadic_expr teichmuller(Qadic_expr) .. cpp:function:: Padic_expr trace(Qadic_expr) .. cpp:function:: Padic_expr norm(Qadic_expr) .. cpp:function:: Padic_expr norm_analytic(Qadic_expr) .. cpp:function:: Padic_expr norm_resultant(Qadic_expr) Arithmet.. cpp:functions (``arith``) =============================================================================== The ``arithxx`` module wraps the ``arith`` module, i.e. provides functions for computing number theoret.. cpp:functions. Primorials ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_expr primorial(T:fits_into_slong) Harmonic numbers ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_expr harmonic_number(T:fits_into_slong) Stirling numbers ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_expr stirling_number_1u(T:fits_into_slong, T:fits_into_slong) .. cpp:function:: Fmpz_expr stirling_number_1(T:fits_into_slong, T:fits_into_slong) .. cpp:function:: Fmpz_expr stirling_number_2(T:fits_into_slong, T:fits_into_slong) .. cpp:function:: Fmpz_vec_expr stirling_number_1u_vec(T:fits_into_slong, T:fits_into_slong) .. cpp:function:: Fmpz_vec_expr stirling_number_1_vec(T:fits_into_slong, T:fits_into_slong) .. cpp:function:: Fmpz_vec_expr stirling_number_2_vec(T:fits_into_slong, T:fits_into_slong) .. cpp:function:: Fmpz_vec_expr stirling_number_1u_vec_next(Fmpz_vec_expr v, T:fits_into_slong n) .. cpp:function:: Fmpz_vec_expr stirling_number_1_vec_next(Fmpz_vec_expr v, T:fits_into_slong n) .. cpp:function:: Fmpz_vec_expr stirling_number_2_vec_next(Fmpz_vec_expr v, T:fits_into_slong n) Given the vector $v$ of length $k$, compute the next vector of Stirling numbers. The size of the new vector is $k + 1$ if $k = n$, and else $k$. See ``arith_stirling_number_1u_vec_next`` etc. .. cpp:function:: Fmpz_mat_expr stirling_matrix_1u(T:fits_into_slong m, T:fits_into_slong) .. cpp:function:: Fmpz_mat_expr stirling_matrix_1(T:fits_into_slong m, T:fits_into_slong) .. cpp:function:: Fmpz_mat_expr stirling_matrix_2(T:fits_into_slong m, T:fits_into_slong) Compute an $m \times n$ Stirling matrix. See ``arith_stirling_matrix_1u`` etc. Bell numbers ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_expr bell_number(T:is_unsigned_integer) .. cpp:function:: Fmpz_expr bell_number_bsplit(T:is_unsigned_integer) .. cpp:function:: Fmpz_expr bell_number_multi_mod(T:is_unsigned_integer) .. cpp:function:: Fmpz_vec_expr bell_number_vec(T:is_unsigned_integer) .. cpp:function:: Fmpz_vec_expr bell_number_vec_recursive(T:is_unsigned_integer) .. cpp:function:: Fmpz_vec_expr bell_number_vec_multi_mod(T:is_unsigned_integer) .. cpp:function:: Nmod_expr bell_number_nmod(T:is_unsigned_integer, Nmodxx_ctx_src) .. cpp:function:: Nmod_vec_expr bell_number_nmod_vec(T:is_unsigned_integer, Nmodxx_ctx_src) .. cpp:function:: Nmod_vec_expr bell_number_nmod_vec_recursive(T:is_unsigned_integer, Nmodxx_ctx_src) .. cpp:function:: Nmod_vec_expr bell_number_nmod_vec_series(T:is_unsigned_integer, Nmodxx_ctx_src) .. cpp:function:: double bell_number_size(ulong n) Bernoulli numbers and polynomials ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_expr bernoulli_number(T:is_unsigned_integer) .. cpp:function:: Fmpq_vec_expr bernoulli_number_vec(T:fits_into_slong) .. cpp:function:: Fmpz_expr bernoulli_number_denom(T:is_unsigned_integer) .. cpp:function:: double bernoulli_number_size(ulong) .. cpp:function:: Fmpq_poly_expr bernoulli_polynomial(T:is_unsigned_integer) Euler numbers and polynomials ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_expr euler_number(T:is_unsigned_integer) .. cpp:function:: Fmpq_vec_expr euler_number_vec(T:fits_into_slong) .. cpp:function:: double euler_number_size(ulong) .. cpp:function:: Fmpq_poly_expr euler_polynomial(T:is_unsigned_integer) Legendre polynomials ------------------------------------------------------------------------------- .. cpp:function:: Fmpq_poly_expr legendre_polynomial(T:is_unsigned_integer) .. cpp:function:: Fmpz_poly_expr chebyshev_t_polynomial(T:is_unsigned_integer) .. cpp:function:: Fmpz_poly_expr chebyshev_u_polynomial(T:is_unsigned_integer) Multiplicati.. cpp:functions ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_expr euler_phi(Fmpz_expr) .. cpp:function:: int moebius_mu(Fmpz_expr) .. cpp:function:: Fmpz_expr divisor_sigma(Fmpz_expr, ulong) .. cpp:function:: Fmpz_poly_expr divisors(Fmpz_expr) .. cpp:function:: Fmpz_expr ramanujan_tau(Fmpz_expr) .. cpp:function:: Fmpz_poly_expr ramanujan_tau_series(T:fits_into_slong) Cyclotomic polynomials ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_expr cyclotomic_polynomial(T:is_unsigned_integer) .. cpp:function:: Fmpz_poly_expr cos_minpoly(T:is_unsigned_integer) Swinnerton-Dyer polynomials ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_poly_expr swinnerton_dyer_polynomial(T:is_unsigned_integer) Landau.. cpp:function ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_vec_expr landau_function_vec(T:is_unsigned_integer) Dedekind sums ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_expr dedekind_sum_naive(Fmpz_expr, Fmpz_expr) .. cpp:function:: Fmpz_expr dedekind_sum(Fmpz_expr, Fmpz_expr) Number of partitions ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_vec_expr number_of_partitions_vec(T:fits_into_slong) .. cpp:function:: Nmod_vec_expr number_of_partitions_nmod_vec(T:fits_into_slong) .. cpp:function:: Fmpz_expr number_of_partitions(T:is_unsigned_integer) Sums of squares ------------------------------------------------------------------------------- .. cpp:function:: Fmpz_expr sum_of_squares(T:is_unsigned_integer, Fmpz_expr) .. cpp:function:: Fmpz_vec_expr sum_of_squares(T:is_unsigned_integer, T:fits_into_slong)