source: git/libpolys/coeffs/AEQ.h @ 0a703ea

fieker-DuValspielwiese
Last change on this file since 0a703ea was 3918fd, checked in by Max Horn <max@…>, 10 years ago
Add const qualifier to some methods Note that Q_poly::is_equal() was not made const -- it reduces the polynomial, which of course modifies it. This seems odd, as it is different from the behaviour of the two other polynomial classes. It also seems odd to have a method name is_equal() with side effects. Perhaps this is a bug?
  • Property mode set to 100755
File size: 3.8 KB
Line 
1#ifndef QPOLY
2#define QPOLY
3
4
5#include <gmp.h>
6#include <omalloc/omalloc.h>
7
8
9class Q_poly // Klasse von Q_polynomen mit Typ (Grad, Koeffizienten ganzzahlig)
10{
11
12public:
13    // Charakteristika der Q_polynome (TO DO??: Dynamisches Array)
14
15    int deg;                // Grad des Q_polynoms
16    mpz_t denom;        // Hauptnenner der Koeffizienten
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    Q_poly();
23    Q_poly( int ,mpz_t, mpz_t*);
24    //Q_poly(int_poly,int);
25    //~Q_poly();
26
27    //Reduktion modulo p
28    void Q_poly_reduce();
29    void Q_poly_extend(mpz_t);
30
31    // Arithmetische Operationen
32
33
34    // Additionen
35
36    void Q_poly_add(const Q_poly , const Q_poly );
37    void Q_poly_add_to(const Q_poly);
38    void Q_poly_add_mon(const Q_poly,mpz_t, int); //addiert Monome zu Q_polynom
39    void Q_poly_add_mon_to(mpz_t,int);
40    void Q_poly_add_const( Q_poly, const mpz_t);
41    void Q_poly_add_const_to(const mpz_t);
42
43    // Subtraktion
44
45    void Q_poly_sub(const Q_poly , const Q_poly );
46    void Q_poly_sub_to(const Q_poly);
47    void Q_poly_sub_mon(const Q_poly,mpz_t,int);
48    void Q_poly_sub_mon_to(mpz_t,int);
49    void Q_poly_sub_const( Q_poly, const mpz_t);
50    void Q_poly_sub_const_to(const mpz_t);
51
52    //Multiplikationen
53
54    void Q_poly_mult_n(Q_poly,Q_poly);
55    void Q_poly_mult_n_to(const Q_poly);
56    void Q_poly_mult_ka(const Q_poly, const Q_poly);
57    void Q_poly_scalar_mult(const mpz_t ,const Q_poly);
58    void Q_poly_scalar_mult(const Q_poly, const mpz_t);
59    void Q_poly_scalar_mult_to(const mpz_t);
60    void Q_poly_neg();
61    void Q_poly_mon_mult(const Q_poly, const int);
62    void Q_poly_mon_mult_to(const int);
63
64    //Divisionen
65    void Q_poly_div(Q_poly&, Q_poly&,const Q_poly, const Q_poly);        // exakte Division
66    void Q_poly_div_to(Q_poly&, Q_poly&,const Q_poly);                       // To Variante exakte Division
67    void Q_poly_scalar_div(const Q_poly, const mpz_t); // Dividiert Polynom durch ganze Zahl
68    void Q_poly_scalar_div_to(const mpz_t);
69    void Q_poly_div_rem(const Q_poly, const Q_poly);        //Division mit Rest
70    void Q_poly_div_rem_to(const Q_poly);
71    void Q_poly_mon_div(const Q_poly, const int);        //Division durch Monom
72    void Q_poly_mon_div_rem(const Q_poly, const int);
73
74    //Kombinationen
75
76    void Q_poly_multadd_to(const Q_poly, const Q_poly); //a=a*b+c
77    void Q_poly_multsub_to(const Q_poly,const Q_poly);  //a=a*b-c
78    //Q_poly Q_poly_addmult_to(const Q_poly, const Q_poly);
79
80
81
82
83    // Sonstige Operationen
84    void Q_poly_set(const Q_poly);
85    void Q_poly_set(const mpz_t);                        // Setzt Q_polynom auf Konstante aus Z
86    void Q_poly_set(const mpz_t, const mpz_t);        // Setzt Q_polynom auf Konstante aus Q
87    void Q_poly_set_zero();                                // Setzt Q_polynom auf 0
88    void Q_poly_horner(mpz_t, const mpz_t);                // Wertet Q_polynom mittels Horner-Schema an einer Stelle aus
89    void Q_poly_horner_Q_poly(Q_poly, const Q_poly);        //Setzt Q_polynom in Q_polynom mittels Horner Schema ein
90    void Q_poly_gcd(Q_poly,Q_poly);                //Standard GGT
91    void Q_poly_extgcd(Q_poly &,Q_poly &,Q_poly &, Q_poly, Q_poly);        //Erweiterter Standard GGT
92    int is_equal(Q_poly &);                        // Test auf Gleichheit
93    int is_zero() const;                                // Test auf Gleichheit mit 0
94    int is_one() const;                                // Test auf Gleichheit mit 1
95    int is_monic() const;                                // testet, ob das Q_polynom normiert ist
96
97    // Ein und Ausgabe
98    void Q_poly_insert();                        // Eingabe von Q_polynom
99    void Q_poly_print();                        //Ausgabe von Q_polynom
100
101
102};
103
104#endif
105
106
Note: See TracBrowser for help on using the repository browser.