numerix_doc 0.4
modulus_integer_naive Struct Reference

#include <modular_integer.hpp>

Inheritance diagram for modulus_integer_naive:
modulus_encoding_integer_naive< modulus_div_naive< modulus_inv_integer_naive< modulus_mul_naive< modulus_add_integer_naive< modulus_reduction_naive< modulus_normalization_integer_naive > > > > > > modulus_div_naive< modulus_inv_integer_naive< modulus_mul_naive< modulus_add_integer_naive< modulus_reduction_naive< modulus_normalization_integer_naive > > > > > modulus_inv_integer_naive< modulus_mul_naive< modulus_add_integer_naive< modulus_reduction_naive< modulus_normalization_integer_naive > > > > modulus_mul_naive< modulus_add_integer_naive< modulus_reduction_naive< modulus_normalization_integer_naive > > > modulus_add_integer_naive< modulus_reduction_naive< modulus_normalization_integer_naive > > modulus_reduction_naive< modulus_normalization_integer_naive > modulus_normalization_integer_naive

List of all members.

Static Public Member Functions


Detailed Description

Definition at line 153 of file modular_integer.hpp.


Member Function Documentation

static void add_mod ( C &  dest,
const C &  s,
const M &  m 
) [inline, static, inherited]

Definition at line 62 of file modular_integer.hpp.

                                            {
    dest += s;
    if (dest >= m.p) dest -= m.p; }
static void add_mod ( C &  dest,
const C &  s,
const M &  m,
C &  carry 
) [inline, static, inherited]

Definition at line 67 of file modular_integer.hpp.

                                                      {
    VERIFY (carry == 0 || carry == 1, "unexpected large carry");
    dest += s + carry;
    if (dest >= m.p) { dest -= m.p; carry= 1; } else carry= 0; }
static void add_mod ( C &  dest,
const C &  s1,
const C &  s2,
const M &  m 
) [inline, static, inherited]

Definition at line 73 of file modular_integer.hpp.

References modulus_add_integer_naive< V >::add_mod().

                                                          {
    dest = s1;
    add_mod (dest, s2, m); }
static void add_mod ( C &  dest,
const C &  s1,
const C &  s2,
const M &  m,
C &  carry 
) [inline, static, inherited]

Definition at line 78 of file modular_integer.hpp.

References modulus_add_integer_naive< V >::add_mod().

                                                                    {
    dest = s1;
    add_mod (dest, s2, m, carry); }
static void decode_mod ( C &  dest,
const C &  s,
const M &  m 
) [inline, static, inherited]

Definition at line 148 of file modular_integer.hpp.

                                               {
    (void) m;
    dest = s; }
static void div_mod ( C &  dest,
const C &  s1,
const C &  s2,
const M &  m 
) [inline, static, inherited]

Definition at line 174 of file modulus_naive.hpp.

References mmx::C, mmx::inv_mod(), and mmx::mul_mod().

                                                          {
    C t;
    V::inv_mod (t, s2, m);
    V::mul_mod (dest, s1, t, m); }
static void div_mod ( C &  dest,
const C &  s,
const M &  m 
) [inline, static, inherited]

Definition at line 168 of file modulus_naive.hpp.

References mmx::C, mmx::inv_mod(), and mmx::mul_mod().

                                            {
    C t = s;
    V::inv_mod (t, m);
    V::mul_mod (dest, t, m); }
static void encode_mod ( C &  dest,
const C &  s,
const M &  m 
) [inline, static, inherited]

Definition at line 137 of file modular_integer.hpp.

References mmx::reduce_mod().

                                               {
    if (s < 0 && m.p != 0) {
      dest = - s;
      V::reduce_mod (dest, m);
      dest = m.p - dest;
    }
    else
      dest = s;
      V::reduce_mod (dest, m);
  }
static void inv_mod ( C &  a,
const M &  m 
) [inline, static, inherited]

Definition at line 117 of file modular_integer.hpp.

                             {
    if (m.p == 0) {
      if (a == 1 || a == -1)
        return;
      else
        ERROR ("inv_mod: argument is not invertible");  
    }
    a = invert_modulo (a, m.p);
    if (a == 0 && m.p != 1)
      ERROR ("inv_mod: argument is not invertible"); }
static void inv_mod ( C &  dest,
const C &  s,
const M &  m 
) [inline, static, inherited]

Definition at line 129 of file modular_integer.hpp.

References modulus_inv_integer_naive< V >::inv_mod().

                                            {
    dest = s;
    inv_mod (dest, m); }
static void mul_mod ( C &  dest,
const C &  s,
const M &  m,
C &  carry 
) [inline, static, inherited]

Definition at line 134 of file modulus_naive.hpp.

                                                      {
    dest *= s;
    dest += carry;
    V::reduce_mod (dest, m, carry); }
static void mul_mod ( C &  dest,
const C &  s1,
const C &  s2,
const M &  m 
) [inline, static, inherited]

Definition at line 140 of file modulus_naive.hpp.

                                                          {
    V::reduce_mod (dest, s1 * s2, m); }
static void mul_mod ( C &  dest,
const C &  s1,
const C &  s2,
const M &  m,
C &  carry 
) [inline, static, inherited]

Definition at line 144 of file modulus_naive.hpp.

                                                                    {
    V::reduce_mod (dest, s1 * s2 + carry, m, carry); }
static void mul_mod ( C &  dest,
const C &  s,
const M &  m 
) [inline, static, inherited]

Definition at line 129 of file modulus_naive.hpp.

                                            {
    dest *= s;
    V::reduce_mod (dest, m); }
static void neg_mod ( C &  dest,
const M &  m 
) [inline, static, inherited]

Definition at line 42 of file modular_integer.hpp.

                                {
    if (dest != 0) dest = m.p - dest; }
static void neg_mod ( C &  dest,
const M &  m,
C &  carry 
) [inline, static, inherited]

Definition at line 46 of file modular_integer.hpp.

                                          {
    VERIFY (carry == 0 || carry == 1, "unexpected large carry");
    if (dest != 0 || carry != 0) { dest= m.p - dest - carry; carry= 1; } }
static void neg_mod ( C &  dest,
const C &  s,
const M &  m 
) [inline, static, inherited]

Definition at line 51 of file modular_integer.hpp.

                                            {
    if (s != 0) dest = m.p - s; else dest = s;
 }
static void neg_mod ( C &  dest,
const C &  s,
const M &  m,
C &  carry 
) [inline, static, inherited]

Definition at line 56 of file modular_integer.hpp.

                                                      {
    VERIFY (carry == 0 || carry == 1, "unexpected large carry");
    if (s != 0 || carry != 0) { dest= m.p - s - carry; carry= 1; }
    else dest= 0; }
static bool normalize ( C p) [inline, static, inherited]

Definition at line 32 of file modular_integer.hpp.

                   {
    if (p < 0) p = -p;
    return true;
  }
static void reduce_mod ( C &  dest,
const C &  s,
const M &  m 
) [inline, static, inherited]

Definition at line 47 of file modulus_naive.hpp.

                                               {
    if (m.p != 0) dest = rem (s, m.p); else dest = s; }
static void reduce_mod ( C &  dest,
const M &  m 
) [inline, static, inherited]

Definition at line 34 of file modulus_naive.hpp.

                                   {
    if (m.p != 0) dest = rem (dest, m.p); }
static void reduce_mod ( C &  dest,
const C &  s,
const M &  m,
C &  carry 
) [inline, static, inherited]

Definition at line 51 of file modulus_naive.hpp.

                                                         {
    if (m.p != 0) {
      carry= quo (s, m.p);
      dest = rem (s, m.p);
    }
    else {
      carry= 0;
      dest= s;
    } }
static void reduce_mod ( C &  dest,
const M &  m,
C &  carry 
) [inline, static, inherited]

Definition at line 38 of file modulus_naive.hpp.

                                             {
    if (m.p != 0) {
      carry= quo (dest, m.p);
      dest = rem (dest, m.p);
    }
    else
      carry= 0; }
static void sub_mod ( C &  dest,
const C &  s1,
const C &  s2,
const M &  m,
C &  carry 
) [inline, static, inherited]

Definition at line 108 of file modular_integer.hpp.

References modulus_add_integer_naive< V >::sub_mod().

                                                                    {
    dest = s1;
    sub_mod (dest, s2, m, carry); }
static void sub_mod ( C &  dest,
const C &  s,
const M &  m,
C &  carry 
) [inline, static, inherited]

Definition at line 99 of file modular_integer.hpp.

References modulus_add_integer_naive< V >::sub_mod_core().

                                                      {
    sub_mod_core (dest, s, m.p, carry); }
static void sub_mod ( C &  dest,
const C &  s1,
const C &  s2,
const M &  m 
) [inline, static, inherited]

Definition at line 103 of file modular_integer.hpp.

References modulus_add_integer_naive< V >::sub_mod().

                                                          {
    dest = s1;
    sub_mod (dest, s2, m); }
static void sub_mod ( C &  dest,
const C &  s,
const M &  m 
) [inline, static, inherited]

Definition at line 95 of file modular_integer.hpp.

References modulus_add_integer_naive< V >::sub_mod_core().

                                            {
    sub_mod_core (dest, s, m.p); }
static void sub_mod_core ( C &  dest,
const C &  s,
const C &  p 
) [inline, static, inherited]

Definition at line 83 of file modular_integer.hpp.

                                                 {
    if (dest < s) dest += p;
    dest -= s; }
static void sub_mod_core ( C &  dest,
const C &  s,
const C &  p,
C &  carry 
) [inline, static, inherited]

Definition at line 88 of file modular_integer.hpp.

References mmx::C.

                                                           {
    VERIFY (carry == 0 || carry == 1, "unexpected large carry");
    C t = s + carry;
    if (t == p || dest < t) { dest += p; carry= 1; } else carry= 0;
    dest -= t; }

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