45#ifndef __ADS_BinaryInteger
46 #define __ADS_BinaryInteger
68using Bits = std::vector< int >;
84inline Bits toBits( std::uint64_t x , std::size_t n = 0 );
157 long * mults =
nullptr );
173 long * mults =
nullptr );
189 long * mults =
nullptr );
207inline std::uint64_t
ahmes( std::uint64_t a , std::uint64_t b ,
208 long * steps =
nullptr );
218#include "ADS/numeric/impl/BinaryInteger.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The product of two polynomials of coefficients each, the vectors and from the constant one,...
Bits multiplyBinarySchool(const Bits &X, const Bits &Y, long *mults=nullptr)
the product by the method of the school, ; the products of two bits added to *mults,...
Bits carry(const std::vector< long > &c)
the coefficients , possibly larger than 1 or negative, made bits of the same value by the carries
std::vector< long > widen(const Bits &X)
the bits of as the coefficients of a polynomial in
Bits binaryAdd(const Bits &X, const Bits &Y)
the sum ,
std::uint64_t fromBits(const Bits &b)
the value of the bits, which must be at most 64
Bits multiplyBinaryFour(const Bits &X, const Bits &Y, long *mults=nullptr)
the product by four products of half size, ; the products of two bits added to *mults,...
Bits multiplyBinaryKaratsuba(const Bits &X, const Bits &Y, long *mults=nullptr)
the product by the three products of Karatsuba, ; the products of two bits added to *mults,...
Bits toBits(std::uint64_t x, std::size_t n=0)
the bits of , at least of them
std::uint64_t ahmes(std::uint64_t a, std::uint64_t b, long *steps=nullptr)
the product by the multiplication of Ahmes; the halvings added to *steps, if given
std::vector< int > Bits
the bits, the least significant first
Definition BinaryInteger.h:68