algebramix_doc 0.3
fft_prime_sequence_int< s > Struct Template Reference

#include <crt_int.hpp>

List of all members.

Static Public Member Functions


Detailed Description

template<nat s>
struct mmx::fft_prime_sequence_int< s >

Examples:

crt_test.cpp.

Definition at line 195 of file crt_int.hpp.


Member Function Documentation

static bool extend ( vector< modulus< C, V > > &  v,
nat  n 
) [inline, static]

Definition at line 209 of file crt_int.hpp.

References mmx::C, mmx::is_prime(), M, mmx::N(), and mmx::value().

                                           {
    // construct prime moduli of s bits exactly,
    // starting with those which have a maximal number of
    // primitive 2^k-th roots of unity
    typedef modulus<C,V> M;
    const nat b= V::template maximum_size_helper<C>::value;
    ASSERT (s <= b, "bitsize overflow");
    ASSERT (b <= 8 * sizeof (nat), "bitsize overflow");
    if (s < 2 && n > 0) return false;
    const C m= 1 + MMX_SAFE_LEFT_SHIFT_INT (C, 1, (s-1));
    const C l= MMX_SAFE_LEFT_SHIFT_INT (C, 1, s);
    for (nat i= N(v); i < n; i++) {
      C j= i == 0 ? m : (bit_reverse (* v[i-1], s) + 2), k;
      for (; j <= l - 1 && j >= m; j += 2)
        if (is_prime (k= bit_reverse (j, s))) break;
      if (j > l - 1 || j < m) return false;
      v << M(k); }
    return true; }

The documentation for this struct was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines