Aerobus v1.2
Loading...
Searching...
No Matches
examples/modular_arithmetic.cpp

How to use aerobus::zpz to perform computations on rational fractions with coefficients in modular rings

#include <iostream>
#include "../src/aerobus.h"
using FIELD = aerobus::zpz<2>;
using POLYNOMIALS = aerobus::polynomial<FIELD>;
// x^3 + 2x^2 + 1, with coefficients in Z/2Z, actually x^3 + 1
// x^3 + 5x^2 + 7x + 11 with coefficients in Z/17Z, meaning actually x^3 + x^2 + 1
// P/Q in the field of fractions of polynomials
int main() {
const double v = F::eval<double>(1.0);
std::cout << "expected = " << 2.0/3.0 << std::endl;
std::cout << "value = " << v << std::endl;
return 0;
}
typename internal::FractionFieldImpl< Ring >::type FractionField
Fraction field of an euclidean domain, such as Q for Z.
Definition aerobus.h:2876
typename FractionField< Ring >::template val< v1, v2 > makefraction_t
helper type : the rational V1/V2 in the field of fractions of Ring
Definition aerobus.h:2950
typename polynomial< Ring >::template val< typename Ring::template inject_constant_t< xs >... > make_int_polynomial_t
make a polynomial with coefficients in Ring
Definition aerobus.h:3043
Definition aerobus.h:1807
congruence classes of integers modulo p (32 bits)
Definition aerobus.h:1607