Modular arithmetic
 
Betöltés...
Keresés...
Nincs egyezés
bme::Mod osztályreferencia

#include <mod.h>

Publikus tagfüggvények

 Mod ()
 Default konstruktor.
 
 Mod (int _val)
 Kezdeti érték beállítása a default modulus mellett.
 
 Mod (int _val, int _mod)
 Kezdeti érték beállítása a default modulus mellett.
 
 Mod (const Mod &other)
 Másoló konstruktor.
 
int get_val () const
 Maradékosztály reprezentánsa.
 
void set_val (int _val)
 Maradékosztály beállítása.
 
int get_mod () const
 Modulus lekérdezése.
 
void set_mod (int _mod)
 Modulus beállítása.
 
bool is_invalid () const
 Invalid objektum lekérdezése.
 
bool operator== (const Mod &other) const
 
bool operator== (int other) const
 
bool operator!= (const Mod &other) const
 
bool operator!= (int other) const
 
bool operator< (const Mod &other) const
 
bool operator<= (const Mod &other) const
 
bool operator> (const Mod &other) const
 
bool operator>= (const Mod &other) const
 
Modoperator= (const Mod &other)
 
Mod add (const Mod &other) const
 Az összeadást megvalósító függvény.
 
Mod operator+ (const Mod &other) const
 
Mod operator+ (int other) const
 
Modoperator+= (const Mod &other)
 
Modoperator+= (int other)
 
Mod operator- () const
 
Mod operator- (const Mod &other) const
 
Mod operator- (int other) const
 
Modoperator-= (const Mod &other)
 
Modoperator-= (int other)
 
Mod multiply (const Mod &other) const
 A szorzást megvalósító függvény.
 
Mod operator* (const Mod &other) const
 
Mod operator* (int other) const
 
Modoperator*= (const Mod &other)
 
Modoperator*= (int other)
 
Mod inverse () const
 Az inverzet számoló függvény.
 
Mod operator/ (const Mod &other) const
 
Mod operator/ (int other) const
 
Modoperator/= (const Mod &other)
 
Modoperator/= (int other)
 
Mod pow (int k) const
 Hatványozás.
 

Statikus publikus tagfüggvények

static void set_default_modulus (int _def_mod)
 Default modulus beállítása.
 
static void set_normal_print_mode ()
 Kiírás módjának beállítása.
 
static void set_short_print_mode ()
 Kiírás módjának beállítása.
 
static int get_print_mode ()
 Kiírás módja.
 
static int get_default_modulus ()
 Default modulus lekérdezése.
 

Részletes leírás

A Mod osztály a modulo n maradékosztályok gyűrűjét reprezentálja.

Definíció a(z) mod.h fájl 24. sorában.

Konstruktorok és destruktorok dokumentációja

◆ Mod() [1/4]

bme::Mod::Mod ( )
inline

Default konstruktor.

Beállítja a default modulust és maradékosztály a 0 lesz

Definíció a(z) mod.h fájl 58. sorában.

◆ Mod() [2/4]

bme::Mod::Mod ( int _val)
inline

Kezdeti érték beállítása a default modulus mellett.

Ez a konstruktor beállítja a default modulust (m) és a paraméterként megadott maradékosztályt (_val) egy 0 és m-1 közötti reprezentánssal.

Definíció a(z) mod.h fájl 65. sorában.

◆ Mod() [3/4]

bme::Mod::Mod ( int _val,
int _mod )
inline

Kezdeti érték beállítása a default modulus mellett.

Ez a konstruktor beállítja a megadott modulust (_mod) és a paraméterként megadott maradékosztályt (_val) egy 0 és _mod-1 közötti reprezentánssal. Ha a megadott modulus nem pozitív, akkor a beállított érték invalid (0,0).

Definíció a(z) mod.h fájl 73. sorában.

◆ Mod() [4/4]

bme::Mod::Mod ( const Mod & other)
inline

Másoló konstruktor.

Definíció a(z) mod.h fájl 86. sorában.

Tagfüggvények dokumentációja

◆ add()

Mod bme::Mod::add ( const Mod & other) const

Az összeadást megvalósító függvény.

Visszaadja az összeg maradékosztályát, invalid a visszatérési érték, ha a tagok modulusai nem egyeznek, vagy ha valamelyik tag invalid.

Definíció a(z) mod.cpp fájl 9. sorában.

◆ get_default_modulus()

static int bme::Mod::get_default_modulus ( )
inlinestatic

Default modulus lekérdezése.

Visszaadja a default modulus értékét. Ha nincs beállítva default modulus, akkor a default modulus kezdeti értékét állítja be és adja vissza.

Definíció a(z) mod.h fájl 165. sorában.

◆ get_mod()

int bme::Mod::get_mod ( ) const
inline

Modulus lekérdezése.

Definíció a(z) mod.h fájl 107. sorában.

◆ get_print_mode()

static int bme::Mod::get_print_mode ( )
inlinestatic

Kiírás módja.

Definíció a(z) mod.h fájl 155. sorában.

◆ get_val()

int bme::Mod::get_val ( ) const
inline

Maradékosztály reprezentánsa.

Visszaadja a maradékosztály 0 és m-1 közti reprezentánsát, ahol m a modulus.

Definíció a(z) mod.h fájl 92. sorában.

◆ inverse()

Mod bme::Mod::inverse ( ) const

Az inverzet számoló függvény.

Az elem multiplikatív inverzét adja vissza, ha létezik. Invalid a visszatérési érték, ha nem invertálható az elem.

Definíció a(z) mod.cpp fájl 24. sorában.

◆ is_invalid()

bool bme::Mod::is_invalid ( ) const
inline

Invalid objektum lekérdezése.

Igazzal tér vissza, ha az objektum invalid, hamissal különben.

Definíció a(z) mod.h fájl 176. sorában.

◆ multiply()

Mod bme::Mod::multiply ( const Mod & other) const

A szorzást megvalósító függvény.

Visszaadja a szorzat maradékosztályát, invalid a visszatérési érték, ha a tényezők modulusai nem egyeznek, vagy ha valamelyik tényező invalid.

Definíció a(z) mod.cpp fájl 16. sorában.

◆ operator!=() [1/2]

bool bme::Mod::operator!= ( const Mod & other) const
inline

Definíció a(z) mod.h fájl 186. sorában.

◆ operator!=() [2/2]

bool bme::Mod::operator!= ( int other) const
inline

Definíció a(z) mod.h fájl 190. sorában.

◆ operator*() [1/2]

Mod bme::Mod::operator* ( const Mod & other) const
inline

Definíció a(z) mod.h fájl 246. sorában.

◆ operator*() [2/2]

Mod bme::Mod::operator* ( int other) const
inline

Definíció a(z) mod.h fájl 247. sorában.

◆ operator*=() [1/2]

Mod & bme::Mod::operator*= ( const Mod & other)
inline

Definíció a(z) mod.h fájl 248. sorában.

◆ operator*=() [2/2]

Mod & bme::Mod::operator*= ( int other)
inline

Definíció a(z) mod.h fájl 249. sorában.

◆ operator+() [1/2]

Mod bme::Mod::operator+ ( const Mod & other) const
inline

Definíció a(z) mod.h fájl 228. sorában.

◆ operator+() [2/2]

Mod bme::Mod::operator+ ( int other) const
inline

Definíció a(z) mod.h fájl 229. sorában.

◆ operator+=() [1/2]

Mod & bme::Mod::operator+= ( const Mod & other)
inline

Definíció a(z) mod.h fájl 230. sorában.

◆ operator+=() [2/2]

Mod & bme::Mod::operator+= ( int other)
inline

Definíció a(z) mod.h fájl 231. sorában.

◆ operator-() [1/3]

Mod bme::Mod::operator- ( ) const
inline

Definíció a(z) mod.h fájl 232. sorában.

◆ operator-() [2/3]

Mod bme::Mod::operator- ( const Mod & other) const
inline

Definíció a(z) mod.h fájl 233. sorában.

◆ operator-() [3/3]

Mod bme::Mod::operator- ( int other) const
inline

Definíció a(z) mod.h fájl 234. sorában.

◆ operator-=() [1/2]

Mod & bme::Mod::operator-= ( const Mod & other)
inline

Definíció a(z) mod.h fájl 235. sorában.

◆ operator-=() [2/2]

Mod & bme::Mod::operator-= ( int other)
inline

Definíció a(z) mod.h fájl 236. sorában.

◆ operator/() [1/2]

Mod bme::Mod::operator/ ( const Mod & other) const
inline

Definíció a(z) mod.h fájl 258. sorában.

◆ operator/() [2/2]

Mod bme::Mod::operator/ ( int other) const
inline

Definíció a(z) mod.h fájl 259. sorában.

◆ operator/=() [1/2]

Mod & bme::Mod::operator/= ( const Mod & other)
inline

Definíció a(z) mod.h fájl 260. sorában.

◆ operator/=() [2/2]

Mod & bme::Mod::operator/= ( int other)
inline

Definíció a(z) mod.h fájl 261. sorában.

◆ operator<()

bool bme::Mod::operator< ( const Mod & other) const
inline

Definíció a(z) mod.h fájl 194. sorában.

◆ operator<=()

bool bme::Mod::operator<= ( const Mod & other) const
inline

Definíció a(z) mod.h fájl 201. sorában.

◆ operator=()

Mod & bme::Mod::operator= ( const Mod & other)
inline

Definíció a(z) mod.h fájl 214. sorában.

◆ operator==() [1/2]

bool bme::Mod::operator== ( const Mod & other) const
inline

Definíció a(z) mod.h fájl 178. sorában.

◆ operator==() [2/2]

bool bme::Mod::operator== ( int other) const
inline

Definíció a(z) mod.h fájl 182. sorában.

◆ operator>()

bool bme::Mod::operator> ( const Mod & other) const
inline

Definíció a(z) mod.h fájl 205. sorában.

◆ operator>=()

bool bme::Mod::operator>= ( const Mod & other) const
inline

Definíció a(z) mod.h fájl 209. sorában.

◆ pow()

Mod bme::Mod::pow ( int k) const

Hatványozás.

Az elem k-adik hatványának osztályát adja vissza. Invalid a visszatérési érték, ha az elem invalid.

Definíció a(z) mod.cpp fájl 35. sorában.

◆ set_default_modulus()

static void bme::Mod::set_default_modulus ( int _def_mod)
inlinestatic

Default modulus beállítása.

Beállítja a default modulust a paraméterként megadott értékre (_def_mod), ha a megadott érték nem pozitív, akkor a kezdeti default modulus érték lesz a default modulus.

Definíció a(z) mod.h fájl 133. sorában.

◆ set_mod()

void bme::Mod::set_mod ( int _mod)
inline

Modulus beállítása.

Beállítja a modulust a paraméterként megadott értékre (_mod), a maradékosztályt pedig ehhez a modulushoz igazítja, a választott reprezentáns 0 és _mod-1 közé esik. Ha a paraméter nem pozitív, invalid-ra (0,0) állítja az értéket.

Definíció a(z) mod.h fájl 116. sorában.

◆ set_normal_print_mode()

static void bme::Mod::set_normal_print_mode ( )
inlinestatic

Kiírás módjának beállítása.

Beállítja a kiírás módját az alapértelmezettre, a képernyőre való kiírásnál a modulus és a maradékosztály is megjelenik az együtthatóknál.

Definíció a(z) mod.h fájl 142. sorában.

◆ set_short_print_mode()

static void bme::Mod::set_short_print_mode ( )
inlinestatic

Kiírás módjának beállítása.

Beállítja a kiírás módját az alapértelmezettre, a képernyőre való kiírásnál csak a modulus jelenik meg az együtthatóknál, a maradékosztály nem.

Definíció a(z) mod.h fájl 151. sorában.

◆ set_val()

void bme::Mod::set_val ( int _val)
inline

Maradékosztály beállítása.

Beállítja a maradékosztályt a paraméterként megadott értékre, a választott reprezentáns 0 és m-1 közé esik, ahol m a modulus. Invalid példányt nem változtat.

Definíció a(z) mod.h fájl 100. sorában.


Ez a dokumentáció az osztályról a következő fájlok alapján készült: