1 | #ifndef AEP_H |
---|
2 | #define AEP_H |
---|
3 | |
---|
4 | |
---|
5 | #include <gmp.h> |
---|
6 | #include <omalloc/omalloc.h> |
---|
7 | |
---|
8 | |
---|
9 | class p_poly // Klasse von p_polynomen mit Typ (Grad, Koeffizienten ganzzahlig) |
---|
10 | { |
---|
11 | |
---|
12 | public: |
---|
13 | // Charakteristika der p_polynome (TO DO??: Dynamisches Array) |
---|
14 | |
---|
15 | int deg; // Grad des p_polynoms |
---|
16 | int mod; // Primzahl (Modul??) |
---|
17 | mpz_t coef[100]; // Feld der Koeffizienten |
---|
18 | //mpz_t coef = reinterpret_cast<mpz_t*> (omAlloc(100*sizeof(mpz_t))); |
---|
19 | |
---|
20 | |
---|
21 | // Konstruktoren und Destruktoren |
---|
22 | p_poly(); |
---|
23 | p_poly( int ,int, mpz_t*); |
---|
24 | //p_poly(int_poly,int); |
---|
25 | //~p_poly(); |
---|
26 | |
---|
27 | //Reduktion modulo p |
---|
28 | p_poly p_poly_reduce(p_poly, int); |
---|
29 | |
---|
30 | // Arithmetische Operationen |
---|
31 | |
---|
32 | |
---|
33 | // Additionen |
---|
34 | |
---|
35 | p_poly p_poly_add(const p_poly , const p_poly ); |
---|
36 | p_poly p_poly_add_to(const p_poly); |
---|
37 | p_poly p_poly_add_mon(const p_poly,mpz_t, int); //addiert Monome zu p_polynom |
---|
38 | p_poly p_poly_add_mon_to(mpz_t,int); |
---|
39 | p_poly p_poly_add_const( p_poly, const mpz_t); |
---|
40 | p_poly p_poly_add_const_to(const mpz_t); |
---|
41 | |
---|
42 | // Subtraktion |
---|
43 | |
---|
44 | p_poly p_poly_sub(const p_poly , const p_poly ); |
---|
45 | p_poly p_poly_sub_to(const p_poly); |
---|
46 | p_poly p_poly_sub_mon(const p_poly,mpz_t,int); |
---|
47 | p_poly p_poly_sub_mon_to(mpz_t,int); |
---|
48 | p_poly p_poly_sub_const( p_poly, const mpz_t); |
---|
49 | p_poly p_poly_sub_const_to(const mpz_t); |
---|
50 | |
---|
51 | //Multiplikationen |
---|
52 | |
---|
53 | p_poly p_poly_mult_n(p_poly,p_poly); |
---|
54 | p_poly p_poly_mult_n_to(const p_poly); |
---|
55 | p_poly p_poly_mult_ka( p_poly, p_poly); |
---|
56 | p_poly p_poly_scalar_mult(const mpz_t ,const p_poly); |
---|
57 | p_poly p_poly_scalar_mult(const p_poly, const mpz_t); |
---|
58 | p_poly p_poly_scalar_mult_to(const mpz_t); |
---|
59 | p_poly p_poly_neg(); |
---|
60 | p_poly p_poly_mon_mult( p_poly, const int); |
---|
61 | p_poly p_poly_mon_mult_to(const int); |
---|
62 | |
---|
63 | //Divisionen |
---|
64 | p_poly p_poly_div(p_poly&, p_poly&, p_poly, p_poly); // exakte Division |
---|
65 | p_poly p_poly_div_to(p_poly&, p_poly&, p_poly); // To Variante exakte Division |
---|
66 | p_poly p_poly_scalar_div(const p_poly, const mpz_t n); // Multipliziert konstante an Polynom |
---|
67 | p_poly p_poly_scalar_div_to(const mpz_t n); |
---|
68 | p_poly p_poly_div_rem( p_poly, p_poly);//Division mit Rest |
---|
69 | p_poly p_poly_div_rem_to( p_poly); |
---|
70 | p_poly p_poly_mon_div(const p_poly, const int); //Division durch MOnom |
---|
71 | p_poly p_poly_mon_div_rem(const p_poly, const int); |
---|
72 | |
---|
73 | //Kombinationen |
---|
74 | |
---|
75 | p_poly p_poly_multadd_to(const p_poly, const p_poly); //a=a*b+c |
---|
76 | p_poly p_poly_multsub_to(const p_poly,const p_poly); //a=a*b-c |
---|
77 | //p_poly p_poly_addmult_to(const p_poly, const p_poly); |
---|
78 | |
---|
79 | |
---|
80 | |
---|
81 | |
---|
82 | // Sonstige Operationen |
---|
83 | p_poly p_poly_set(const p_poly); |
---|
84 | p_poly p_poly_set(const mpz_t,int); // Setzt p_polynom auf Konstante |
---|
85 | p_poly p_poly_set_zero(); // Setzt p_polynom auf 0 |
---|
86 | void p_poly_horner(mpz_t, const mpz_t); // Wertet p_polynom mittels Horner-Schema an einer Stelle aus |
---|
87 | void p_poly_horner_p_poly(p_poly, p_poly); //Setzt p_polynom in p_polynom mittels Horner Schema ein |
---|
88 | p_poly p_poly_gcd(p_poly,p_poly); //Standard GGT |
---|
89 | p_poly p_poly_extgcd(p_poly &,p_poly &,p_poly &, p_poly, p_poly); //Erweiterter Standard GGT |
---|
90 | int is_equal(const p_poly); // Test auf Gleichheit |
---|
91 | int is_zero(); // Test auf Gleichheit mit 0 |
---|
92 | int is_one(); // Test auf Gleichheit mit 1 |
---|
93 | int is_monic(); // testet, ob das p_polynom normiert ist |
---|
94 | |
---|
95 | // Ein und Ausgabe |
---|
96 | void p_poly_insert(); // Eingabe von p_polynom |
---|
97 | void p_poly_print(); //Ausgabe von p_polynom |
---|
98 | }; |
---|
99 | |
---|
100 | #endif |
---|
101 | |
---|
102 | |
---|