Elements of the ring Z_p.
More...
#include <istream>
#include <ostream>
#include <sstream>
#include <string>
#include "chomp/system/config.h"
Go to the source code of this file.
|
template<class intType > |
intType | invertModuloLargeP (const intType &n, const intType &q) |
| Inverts a number in the modulo 'p' arithmetic, provided that 'p' is a prime number. More...
|
|
template<class intType > |
intType | invertModuloSmallP (const intType &n, const intType &q) |
| Inverts a number in the modulo 'p' arithmetic, provided that 'p' is a prime number. More...
|
|
template<class intType > |
bool | numberIsPrime (const intType &n) |
| Verifies if the given number is a positive prime number. More...
|
|
template<class intType > |
bool | divide (const tZp< intType > &a, const tZp< intType > &b, tZp< intType > "ient, tZp< intType > &remainder) |
|
template<class intType > |
int_t | hashkey1 (const tZp< intType > &n) |
| Generates a hashing key no. More...
|
|
template<class intType > |
int_t | hashkey2 (const tZp< intType > &n) |
| Generates a hashing key no. More...
|
|
template<class intType > |
std::istream & | operator>> (std::istream &in, tZp< intType > &n) |
| Reads an element from an input stream. More...
|
|
template<class intType > |
std::ostream & | operator<< (std::ostream &out, const tZp< intType > &n) |
| Writes an element to an output stream. More...
|
|
template<class intType1 , class intType2 > |
bool | operator== (const tZp< intType1 > &n1, const tZp< intType2 > &n2) |
| Operator == for checking whether two elements of possibly different rings are equal. More...
|
|
template<class intType1 , class intType2 > |
bool | operator== (const tZp< intType1 > &n1, const intType2 &n2) |
| Operator == for checking whether a ring element is equivalent to an integer number. More...
|
|
template<class intType1 , class intType2 > |
bool | operator== (const intType1 &n1, const tZp< intType2 > &n2) |
| Operator == for checking whether a ring element is equivalent to an integer number. More...
|
|
Elements of the ring Z_p.
Definition in file ringzp.h.
◆ divide()
template<class intType >
bool divide |
( |
const tZp< intType > & |
a, |
|
|
const tZp< intType > & |
b, |
|
|
tZp< intType > & |
quotient, |
|
|
tZp< intType > & |
remainder |
|
) |
| |
|
inline |
◆ hashkey1()
template<class intType >
int_t hashkey1 |
( |
const tZp< intType > & |
n | ) |
|
|
inline |
Generates a hashing key no.
1 for an element of the Zp ring. This key is to be used in a hashed set.
Definition at line 455 of file ringzp.h.
◆ hashkey2()
template<class intType >
int_t hashkey2 |
( |
const tZp< intType > & |
n | ) |
|
|
inline |
Generates a hashing key no.
2 for a general pair of elements, based on hashing keys of the elements. This key is to be used in a hashed set.
Definition at line 464 of file ringzp.h.
◆ invertModuloLargeP()
template<class intType >
intType invertModuloLargeP |
( |
const intType & |
n, |
|
|
const intType & |
q |
|
) |
| |
Inverts a number in the modulo 'p' arithmetic, provided that 'p' is a prime number.
This procedure is good for large values of 'p' and uses a longer type of integers for multiplication.
Definition at line 95 of file ringzp.h.
◆ invertModuloSmallP()
template<class intType >
intType invertModuloSmallP |
( |
const intType & |
n, |
|
|
const intType & |
q |
|
) |
| |
Inverts a number in the modulo 'p' arithmetic, provided that 'p' is a prime number.
This procedure is good for small values of 'p', such that 'p' squared still fits in the same integer type.
Definition at line 127 of file ringzp.h.
Referenced by tZp< intType >::invert().
◆ numberIsPrime()
template<class intType >
bool numberIsPrime |
( |
const intType & |
n | ) |
|
◆ operator<<()
template<class intType >
std::ostream& operator<< |
( |
std::ostream & |
out, |
|
|
const tZp< intType > & |
n |
|
) |
| |
|
inline |
Writes an element to an output stream.
Definition at line 483 of file ringzp.h.
◆ operator==() [1/3]
template<class intType1 , class intType2 >
bool operator== |
( |
const tZp< intType1 > & |
n1, |
|
|
const tZp< intType2 > & |
n2 |
|
) |
| |
|
inline |
Operator == for checking whether two elements of possibly different rings are equal.
Definition at line 494 of file ringzp.h.
◆ operator==() [2/3]
template<class intType1 , class intType2 >
bool operator== |
( |
const tZp< intType1 > & |
n1, |
|
|
const intType2 & |
n2 |
|
) |
| |
|
inline |
Operator == for checking whether a ring element is equivalent to an integer number.
Intended to compare with 0 and 1 only.
Definition at line 502 of file ringzp.h.
◆ operator==() [3/3]
template<class intType1 , class intType2 >
bool operator== |
( |
const intType1 & |
n1, |
|
|
const tZp< intType2 > & |
n2 |
|
) |
| |
|
inline |
Operator == for checking whether a ring element is equivalent to an integer number.
Intended to compare with 0 and 1 only.
Definition at line 510 of file ringzp.h.
◆ operator>>()
template<class intType >
std::istream& operator>> |
( |
std::istream & |
in, |
|
|
tZp< intType > & |
n |
|
) |
| |
|
inline |
Reads an element from an input stream.
Definition at line 473 of file ringzp.h.