algebramix_doc 0.3
crt_dicho_transformer< C, S, V > Struct Template Reference

#include <crt_dicho.hpp>

List of all members.

Public Member Functions


Detailed Description

template<typename C, typename S = std_crt_dicho<C>, typename V = typename crt_dicho_variant_helper< C >::CV>
struct mmx::crt_dicho_transformer< C, S, V >

Examples:

crt_test.cpp.

Definition at line 110 of file crt_dicho.hpp.


Constructor & Destructor Documentation

crt_dicho_transformer ( const vector< M > &  p,
bool  lazy = true 
) [inline]

Definition at line 164 of file crt_dicho.hpp.

References mmx::N(), mmx::seg(), and crt_dicho_transformer< C, S, V >::setup_inverse().

    : tree(NULL), k(NULL) {
    setup_direct (seg (p), N(p));
    aux= mmx_new<C> (n);
    if (! lazy) setup_inverse (); }
~crt_dicho_transformer ( ) [inline]

Definition at line 170 of file crt_dicho.hpp.

                                   {
    if (n == 0) return;
    mmx_delete<M> (p, n);
    mmx_delete<C> (aux, n);
    for (nat i= 0; i < depth; i++)
      mmx_delete<Modulus> (tree[i], k[i]);
    mmx_delete<Modulus*> (tree, depth);
    mmx_delete<nat> (k, depth);
    if (m != NULL) mmx_delete<C> (m, n); }

Member Function Documentation

void combine ( C a,
const I *  c 
) [inline]

Definition at line 198 of file crt_dicho.hpp.

                                         {
    Crt::combine (a, c, tree, k, depth, n, aux); }
C comodulus ( nat  i) const [inline]

Definition at line 190 of file crt_dicho.hpp.

                                   {
    VERIFY (i < n, "index out of range");
    return *P / m[i]; }
void direct_transform ( I *  c,
const C a 
) const [inline]

Definition at line 194 of file crt_dicho.hpp.

References mmx::C.

                                                        {
    C b= Crt::encode (a, P);
    Crt::direct (c, b, tree, k, depth, n, aux); }
void inverse_transform ( C a,
const I *  c 
) [inline]

Definition at line 201 of file crt_dicho.hpp.

References crt_dicho_transformer< C, S, V >::setup_inverse().

                                                   {
    setup_inverse ();
    Crt::inverse (a, c, tree, k, depth, m, n, P, aux);
    a= Crt::decode (a, P, H); }
M operator[] ( nat  i) const [inline]

Definition at line 180 of file crt_dicho.hpp.

                                    {
    VERIFY (i < n, "index out of range");
    return p[i]; }
Modulus product ( ) const [inline]

Definition at line 187 of file crt_dicho.hpp.

                                  {
    return P; }
void setup_inverse ( ) [inline]

Definition at line 153 of file crt_dicho.hpp.

References mmx::C.

Referenced by crt_dicho_transformer< C, S, V >::crt_dicho_transformer(), and crt_dicho_transformer< C, S, V >::inverse_transform().

                               {
    typedef implementation<vector_linear,vector_naive> Vec;
    if (n == 0 || m != NULL) return;
    m= mmx_new<C> (n);
    C c;
    Vec::set (m, C(1), n);
    Crt::up (c, m, tree, k, depth, n);
    Crt::down (m, c, tree, k, depth, n);
    for (nat i= 0; i < n; i++)
      inv_mod (m[i], tree[0][i]); }
nat size ( ) const [inline]

Definition at line 184 of file crt_dicho.hpp.

Referenced by mmx::N().

                           {
    return n; }

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