My Project
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes
modpk Class Reference

class to do operations mod p^k for int's p and k More...

#include <fac_util.h>

Public Member Functions

 modpk ()
 
 modpk (int q, int l)
 
 modpk (const modpk &m)
 
modpkoperator= (const modpk &m)
 
 ~modpk ()
 
int getp () const
 
int getk () const
 
CanonicalForm inverse (const CanonicalForm &f, bool symmetric=true) const
 
CanonicalForm getpk () const
 
CanonicalForm operator() (const CanonicalForm &f, bool symmetric=true) const
 

Private Attributes

CanonicalForm pk
 
CanonicalForm pkhalf
 
int p
 
int k
 

Detailed Description

class to do operations mod p^k for int's p and k

Definition at line 22 of file fac_util.h.

Constructor & Destructor Documentation

◆ modpk() [1/3]

modpk::modpk ( )

Definition at line 22 of file fac_util.cc.

23{
24 p = 0;
25 k = 0;
26 pk = 1;
27 pkhalf = 0;
28}
int p
Definition: fac_util.h:27
CanonicalForm pkhalf
Definition: fac_util.h:26
CanonicalForm pk
Definition: fac_util.h:25
int k
Definition: fac_util.h:28

◆ modpk() [2/3]

modpk::modpk ( int  q,
int  l 
)

Definition at line 30 of file fac_util.cc.

31{
32 p = q;
33 k = l;
34 pk = power( CanonicalForm( p ), k );
35 pkhalf = pk / 2;
36}
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
int l
Definition: cfEzgcd.cc:100
factory's main class
Definition: canonicalform.h:86

◆ modpk() [3/3]

modpk::modpk ( const modpk m)

Definition at line 38 of file fac_util.cc.

39{
40 p = m.p;
41 k = m.k;
42 pk = m.pk;
43 pkhalf = m.pkhalf;
44}
int m
Definition: cfEzgcd.cc:128

◆ ~modpk()

modpk::~modpk ( )
inline

Definition at line 34 of file fac_util.h.

34{}

Member Function Documentation

◆ getk()

int modpk::getk ( ) const
inline

Definition at line 36 of file fac_util.h.

36{ return k; }

◆ getp()

int modpk::getp ( ) const
inline

Definition at line 35 of file fac_util.h.

35{ return p; }

◆ getpk()

CanonicalForm modpk::getpk ( ) const
inline

Definition at line 38 of file fac_util.h.

38{ return pk; }

◆ inverse()

CanonicalForm modpk::inverse ( const CanonicalForm f,
bool  symmetric = true 
) const

Definition at line 59 of file fac_util.cc.

60{
61 CanonicalForm u, r0 = this->operator()( f, false ), r1 = pk, q0 = 1, q1 = 0;
62 while ( ( r0 > 0 ) && ( r1 > 0 ) ) {
63 u = r0 / r1;
64 r0 = r0 % r1;
65 q0 = u*q1 + q0;
66 if ( r0 > 0 ) {
67 u = r1 / r0;
68 r1 = r1 % r0;
69 q1 = u*q0 + q1;
70 }
71 }
72 if ( r0 == 0 )
73 return this->operator()( pk-q1, symmetric );
74 else
75 return this->operator()( q0, symmetric );
76}
CanonicalForm operator()(const CanonicalForm &f, bool symmetric=true) const
Definition: fac_util.cc:79

◆ operator()()

CanonicalForm modpk::operator() ( const CanonicalForm f,
bool  symmetric = true 
) const

Definition at line 79 of file fac_util.cc.

80{
81 PKHALF = pkhalf;
82 PK = pk;
83 if ( symmetric )
84 return mapdomain( f, mappksymmetric );
85 else
86 return mapdomain( f, mappk );
87}
CanonicalForm mapdomain(const CanonicalForm &f, CanonicalForm(*mf)(const CanonicalForm &))
CanonicalForm mapdomain ( const CanonicalForm & f, CanonicalForm (*mf)( const CanonicalForm & ) )
Definition: cf_ops.cc:440
FILE * f
Definition: checklibs.c:9
static CanonicalForm mappksymmetric(const CanonicalForm &)
Definition: fac_util.cc:99
STATIC_INST_VAR CanonicalForm PKHALF
Definition: fac_util.cc:15
STATIC_INST_VAR CanonicalForm PK
Definition: fac_util.cc:15
static CanonicalForm mappk(const CanonicalForm &)
Definition: fac_util.cc:109

◆ operator=()

modpk & modpk::operator= ( const modpk m)

Definition at line 47 of file fac_util.cc.

48{
49 if ( this != &m ) {
50 p = m.p;
51 k = m.k;
52 pk = m.pk;
53 pkhalf = m.pkhalf;
54 }
55 return *this;
56}

Field Documentation

◆ k

int modpk::k
private

Definition at line 28 of file fac_util.h.

◆ p

int modpk::p
private

Definition at line 27 of file fac_util.h.

◆ pk

CanonicalForm modpk::pk
private

Definition at line 25 of file fac_util.h.

◆ pkhalf

CanonicalForm modpk::pkhalf
private

Definition at line 26 of file fac_util.h.


The documentation for this class was generated from the following files: