algebramix_doc 0.3
crt_blocks_transformer< WL, WH, s, V > Struct Template Reference

#include <crt_blocks.hpp>

List of all members.

Public Types

Public Member Functions

Public Attributes


Detailed Description

template<typename WL, typename WH, nat s = Threshold(typename WH::base,crt_blocks_threshold), typename V = typename crt_blocks_variant_helper< typename WH::base >::CV>
struct mmx::crt_blocks_transformer< WL, WH, s, V >

Examples:

crt_test.cpp.

Definition at line 87 of file crt_blocks.hpp.


Member Typedef Documentation

typedef WL::base base

Definition at line 89 of file crt_blocks.hpp.

typedef WL::modulus_base modulus_base

Definition at line 91 of file crt_blocks.hpp.

typedef WL::modulus_base_variant modulus_base_variant

Definition at line 92 of file crt_blocks.hpp.

typedef WL::modulus_variant modulus_variant

Definition at line 90 of file crt_blocks.hpp.


Constructor & Destructor Documentation

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

Definition at line 121 of file crt_blocks.hpp.

References crt_blocks_transformer< WL, WH, s, V >::aux, crt_blocks_transformer< WL, WH, s, V >::H, crt_blocks_transformer< WL, WH, s, V >::high, crt_blocks_transformer< WL, WH, s, V >::low, crt_blocks_transformer< WL, WH, s, V >::m, mmx::N(), crt_blocks_transformer< WL, WH, s, V >::n, crt_blocks_transformer< WL, WH, s, V >::P, crt_blocks_transformer< WL, WH, s, V >::product(), mmx::range(), and crt_blocks_transformer< WL, WH, s, V >::setup.

                                                                      {
    n= N(p); m= (n + s - 1) / s; setup= !lazy;
    if (n == 0) { P= 1; H= 0; return; }
    low= mmx_new<WL*> (m);
    vector<Modulus> v (Modulus (), m);
    for (nat i= 0; i < m; i++) {
      low[i]= mmx_new<WL> (1, range (p, i * s, min (n, (i+1) * s)), lazy);
      v[i]= low[i] -> product ();
    }
    high= mmx_new<WH> (1, v, lazy);
    P= high -> product ();
    H= Crt::half (P);
    aux= mmx_new<C> (m); }
~crt_blocks_transformer ( ) [inline]

Definition at line 135 of file crt_blocks.hpp.

References crt_blocks_transformer< WL, WH, s, V >::aux, crt_blocks_transformer< WL, WH, s, V >::high, crt_blocks_transformer< WL, WH, s, V >::low, crt_blocks_transformer< WL, WH, s, V >::m, and crt_blocks_transformer< WL, WH, s, V >::n.

                                    {
    if (n == 0) return;
    for (nat i= 0; i < m; i++) mmx_delete<WL> (low[i], 1);
    mmx_delete<WL*> (low, m);
    mmx_delete<WH> (high, 1);
    mmx_delete<C> (aux, m); }

Member Function Documentation

C comodulus ( nat  i) const [inline]

Definition at line 152 of file crt_blocks.hpp.

References crt_blocks_transformer< WL, WH, s, V >::high, crt_blocks_transformer< WL, WH, s, V >::low, and crt_blocks_transformer< WL, WH, s, V >::n.

                                   {
    VERIFY (i < n, "index out of range");
    return high -> comodulus(i / s) * low[i / s] -> comodulus(i % s); }
void direct_transform ( I *  c,
const C &  a 
) [inline]
M operator[] ( nat  i) const [inline]

Definition at line 142 of file crt_blocks.hpp.

References crt_blocks_transformer< WL, WH, s, V >::low, and crt_blocks_transformer< WL, WH, s, V >::n.

                                    {
    VERIFY (i < n, "index out of range");
    return low[i / s]-> operator [] (i % s); }
Modulus product ( ) const [inline]
void setup_comoduli ( ) [inline]

Definition at line 111 of file crt_blocks.hpp.

Referenced by crt_blocks_transformer< WL, WH, s, V >::combine().

{}
nat size ( ) const [inline]

Definition at line 146 of file crt_blocks.hpp.

References crt_blocks_transformer< WL, WH, s, V >::n.

Referenced by mmx::N().

                           {
    return n; }

Member Data Documentation


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