#include <basix/operators.hpp>
#include <basix/int.hpp>
#include <numerix/rational.hpp>
#include <numerix/modular.hpp>
Go to the source code of this file.
#define DECLARE_HELPER | ( | I | ) |
template<typename V, typename W> \ rational reconstruct (const modular<modulus<I,V>,W>& x) { \ typedef signed_of_helper<I>::type J; \ J n, d; \ bool b= reconstruct (n, d, *x, *get_modulus (x)); \ if (b) return rational (n) / rational (d); \ ERROR ("rational reconstruction failed"); } \ template<typename V, typename W> \ bool is_reconstructible (const modular<modulus<I,V>,W>& x, \ rational& r) { \ typedef signed_of_helper<I>::type J; \ J n, d; \ bool b= reconstruct (n, d, *x, *get_modulus (x)); \ if (!b) return false; \ r= rational (n) / rational (d); \ return true; }
Definition at line 1135 of file modular_int.hpp.
#define DECLARE_HELPER | ( | I | ) |
template<typename V, typename W> \ struct as_helper<modular<modulus<I,V>,W>, rational> { \ static inline modular<modulus<I,V>,W> \ cv (const rational& a) { \ return as<modular<modulus<I,V>,W> > (numerator (a)) \ / as<modular<modulus<I,V>,W> > (denominator (a)); } \ };
Definition at line 1135 of file modular_int.hpp.
#define DECLARE_HELPER | ( | I | ) |
UNARY_RETURN_TYPE(TMPLVW,lift_op,Modular(I),integer); \ UNARY_RETURN_TYPE(STMPL,project_op,I,modular<modulus<I> >); \ TMPLVW \ struct lift_helper<Modular(I)> { \ template<typename R> static inline void \ set_op (R&y, const Modular(I)& x) { \ set_as (y, *x); } \ static inline integer \ op (const Modular(I)& x) { \ return as<integer> (*x); } \ }; \ STMPL \ struct project_helper<I> { \ TMPLVW static inline void \ set_op (Modular(I)& y, const I& x) { \ y= Modular(I) (x); } \ static inline modular<modulus<I> > \ op (const I& x) { \ return modular<modulus<I> > (x); } \ };
Definition at line 1135 of file modular_int.hpp.
#define Modular | ( | I | ) | modular<modulus<I,V>,W> |
Definition at line 1069 of file modular_int.hpp.
#define TMPL template<typename C> |
Hereafter C must be a genuine C/C++ int type, signed or not. If C has bit-size k and if m <= k is the maximum number of bits allowed for the modulus then the modulus 0 actually stands for 2^m.
Definition at line 527 of file modular_int.hpp.
#define TMPL template<typename C, typename M> |
Hereafter C must be a genuine C/C++ int type, signed or not. If C has bit-size k and if m <= k is the maximum number of bits allowed for the modulus then the modulus 0 actually stands for 2^m.
Definition at line 527 of file modular_int.hpp.
#define TMPLVW template<typename V, typename W> |
Definition at line 1068 of file modular_int.hpp.
#define Variant modulus_int_preinverse |
Definition at line 1016 of file modular_int.hpp.