itpp::GF Class Reference

Galois Field GF(q). More...

`#include <itpp/comm/galois.h>`

## Public Member Functions

| GF ()
| Constructor.
| GF (int qvalue)
| Constructor.
| GF (int qvalue, int inexp)
| Constructor.
| GF (const GF &ingf)
| Copy constructor.
void | set (int qvalue, int inexp)
| GF(q) equals alpha ^ inexp.
void | set (int qvalue, const bvec &vectorspace)
| GF(q) equals the element that corresponds to the given vector space.
void | set_size (int qvalue)
| set q=2^mvalue
int | get_size () const
| Return q.
bvec | get_vectorspace () const
| Returns the vector space representation of GF(q).
int | get_value () const
| Returns the alpha exponent.
int | operator== (const GF &ingf) const
| Equality check.
int | operator!= (const GF &ingf) const
| Not-equality check.
void | operator= (const GF &ingf)
| GF(q) equals ingf.
void | operator= (const int inexp)
| GF(q) equals alpha^inexp.
void | operator+= (const GF &ingf)
| sum of two GF(q)
GF | operator+ (const GF &ingf) const
| sum of two GF(q)
void | operator-= (const GF &ingf)
| Difference of two GF(q), same as sum for q=2^m.
GF | operator- (const GF &ingf) const
| Difference of two GF(q), same as sum for q=2^m.
void | operator*= (const GF &ingf)
| product of two GF(q)
GF | operator* (const GF &ingf) const
| product of two GF(q)
void | operator/= (const GF &ingf)
| division of two GF(q)
GF | operator/ (const GF &ingf) const
| product of two GF(q)

## Friends

ITPP_EXPORT friend std::ostream & | operator<< (std::ostream &os, const GF &ingf)
| Output stream for GF(q)
ITPP_EXPORT friend std::istream & | operator>> (std::istream &is, GF &ingf)
| Input stream for GF(q)

## Detailed Description

Galois Field GF(q).

Author
  Tony Ottosson

Galois field GF(q), where q = 2^m. Possible m values is m = 1,2,...,16. Elements are given as exponents of the primitive element alpha. Observe that the zeroth element are given as "-1". ( log(0)=-Inf ).

### The following primitve polynomials are used to construct the fields:

- GF(4): 1+x+x^2
- GF(8): 1+x+x^3
- GF(16): 1+x+x^4
- GF(32): 1+x^2+x^5
- GF(64): 1+x^2+x^6
- GF(128): 1+x^3+x^7
- GF(256): 1+x^2+x^3+x^4+x^8
- GF(512): 1+x^4+x^9
- GF(1024): 1+x^3+x^10
- GF(2^11): 1+x^2+x^11
- GF(2^12): 1+x+x^4+x^12
- GF(2^13): 1+x+x^3+x^4+x^13
- GF(2^14): 1+x+x^3+x^5+x^14
- GF(2^15): 1+x+x^15
- GF(2^16): 1+x+x^3+x^12+x^16

As indicated it is possible to use this class for binary elements, that is GF(2). However, this is less efficient in storage (each element take 5 bytes of memory) and in speed. If possible use the class BIN instead. Observe, also that the element "0" is called "-1" and "1" called "0".

Definition at line 74 of file galois.h.

## Constructor & Destructor Documentation

## GF() [1/4]

itpp::GF::GF | ( |  | ) |

inline

Constructor.

Definition at line 78 of file galois.h.

## GF() [2/4]

itpp::GF::GF | ( | int | qvalue | ) |

inline

Constructor.

Definition at line 80 of file galois.h.

References itpp::Array< T >::set_size().

## GF() [3/4]

itpp::GF::GF | ( | int | qvalue,
|  | int | inexp
| ) |  |

inline

Constructor.

Definition at line 87 of file galois.h.

## GF() [4/4]

itpp::GF::GF | ( | const GF & | ingf | ) |

inline

Copy constructor.

Definition at line 89 of file galois.h.

## Member Function Documentation

## set() [1/2]

void itpp::GF::set | ( | int | qvalue,
|  | int | inexp
| ) |  |

inline

GF(q) equals alpha ^ inexp.

Definition at line 92 of file galois.h.

References it_assert_debug, and itpp::Array< T >::set_size().

## set() [2/2]

void itpp::GF::set | ( | int | qvalue,
|  | const bvec & | vectorspace
| ) |  |

inline

GF(q) equals the element that corresponds to the given vector space.

The format is (...,c,b,a), where the element x is given as x=...+c*alpha^2+b*alpha+a.

Definition at line 269 of file galois.h.

References itpp::bin2dec(), it_assert_debug, itpp::Array< T >::length(), and set_size().

## set_size()

void itpp::GF::set_size | ( | int | qvalue | ) |

set q=2^mvalue

Definition at line 44 of file galois.cpp.

References it_assert, itpp::log2(), itpp::round_i(), itpp::Array< T >::set_size(), itpp::Array< T >::size(), and itpp::size().

Referenced by set().

## get_size()

int itpp::GF::get_size | ( |  | ) | const

inline

Return q.

Definition at line 106 of file galois.h.

## get_vectorspace()

bvec itpp::GF::get_vectorspace | ( |  | ) | const

inline

Returns the vector space representation of GF(q).

The format is (...,c,b,a), where the element x is given as x=...+c*alpha^2+b*alpha+a.

Definition at line 276 of file galois.h.

References itpp::dec2bin().

## get_value()

int itpp::GF::get_value | ( |  | ) | const

inline

Returns the alpha exponent.

Definition at line 286 of file galois.h.

## operator==()

int itpp::GF::operator== | ( | const GF & | ingf | ) | const

inline

Equality check.

Definition at line 291 of file galois.h.

## operator!=()

int itpp::GF::operator!= | ( | const GF & | ingf | ) | const

inline

Not-equality check.

Definition at line 301 of file galois.h.

## operator=() [1/2]

void itpp::GF::operator= | ( | const GF & | ingf | ) |

inline

GF(q) equals ingf.

Definition at line 307 of file galois.h.

## operator=() [2/2]

void itpp::GF::operator= | ( | const int | inexp | ) |

inline

GF(q) equals alpha^inexp.

Definition at line 313 of file galois.h.

References it_assert_debug.

## operator+=()

void itpp::GF::operator+= | ( | const GF & | ingf | ) |

inline

sum of two GF(q)

Definition at line 319 of file galois.h.

References it_assert_debug.

## operator+()

GF itpp::GF::operator+ | ( | const GF & | ingf | ) | const

inline

sum of two GF(q)

Definition at line 331 of file galois.h.

## operator-=()

void itpp::GF::operator-= | ( | const GF & | ingf | ) |

inline

Difference of two GF(q), same as sum for q=2^m.

Definition at line 338 of file galois.h.

## operator-()

GF itpp::GF::operator- | ( | const GF & | ingf | ) | const

inline

Difference of two GF(q), same as sum for q=2^m.

Definition at line 343 of file galois.h.

## operator*=()

void itpp::GF::operator*= | ( | const GF & | ingf | ) |

inline

product of two GF(q)

Definition at line 350 of file galois.h.

References it_assert_debug.

## operator*()

GF itpp::GF::operator* | ( | const GF & | ingf | ) | const

inline

product of two GF(q)

Definition at line 360 of file galois.h.

## operator/=()

void itpp::GF::operator/= | ( | const GF & | ingf | ) |

inline

division of two GF(q)

Definition at line 367 of file galois.h.

References it_assert, and it_assert_debug.

## operator/()

GF itpp::GF::operator/ | ( | const GF & | ingf | ) | const

inline

product of two GF(q)

Definition at line 378 of file galois.h.

## Friends And Related Symbol Documentation

## operator<<

ITPP_EXPORT friend std::ostream & operator<< | ( | std::ostream & | os,
|  | const GF & | ingf
| ) |  |

friend

Output stream for GF(q)

Definition at line 125 of file galois.cpp.

## operator>>

ITPP_EXPORT friend std::istream & operator>> | ( | std::istream & | is,
|  | GF & | ingf
| ) |  |

friend

Input stream for GF(q)

Definition at line 93 of file galois.cpp.

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

- itpp/comm/galois.h
- itpp/comm/galois.cpp

Generated on Mon Apr 22 2024 09:45:27 for IT++ by Doxygen 1.9.8