[b055de9] | 1 | #ifndef TGBGAUSS_HEADER |
---|
| 2 | #define TGBGAUSS_HEADER |
---|
[6b9532] | 3 | /**************************************** |
---|
| 4 | * Computer Algebra System SINGULAR * |
---|
| 5 | ****************************************/ |
---|
[341696] | 6 | /* $Id$ */ |
---|
[6b9532] | 7 | /* |
---|
| 8 | * ABSTRACT: gauss implementation for F4 header |
---|
| 9 | */ |
---|
[762407] | 10 | // #include <kernel/mod2.h> |
---|
[210e07] | 11 | #include <coeffs/numbers.h> |
---|
[47e836b] | 12 | #include <polys/monomials/p_polys.h> |
---|
[eb716b0] | 13 | //#include "tgb_internal.h" |
---|
| 14 | |
---|
[9cbb7a3] | 15 | struct slimgb_alg; |
---|
[81306a] | 16 | |
---|
[b055de9] | 17 | class tgb_matrix{ |
---|
| 18 | private: |
---|
| 19 | number** n; |
---|
| 20 | int columns; |
---|
| 21 | int rows; |
---|
| 22 | BOOLEAN free_numbers; |
---|
| 23 | public: |
---|
| 24 | tgb_matrix(int i, int j); |
---|
| 25 | ~tgb_matrix(); |
---|
| 26 | int get_rows(); |
---|
| 27 | int get_columns(); |
---|
| 28 | void print(); |
---|
| 29 | void perm_rows(int i, int j); |
---|
| 30 | void set(int i, int j, number n); |
---|
| 31 | number get(int i, int j); |
---|
| 32 | BOOLEAN is_zero_entry(int i, int j); |
---|
| 33 | void free_row(int row, BOOLEAN free_non_zeros=TRUE); |
---|
| 34 | int min_col_not_zero_in_row(int row); |
---|
| 35 | int next_col_not_zero(int row,int pre); |
---|
| 36 | BOOLEAN zero_row(int row); |
---|
| 37 | void mult_row(int row,number factor); |
---|
| 38 | void add_lambda_times_row(int add_to,int summand,number factor); |
---|
| 39 | int non_zero_entries(int row); |
---|
| 40 | }; |
---|
[81306a] | 41 | |
---|
| 42 | class mac_poly_r{ |
---|
| 43 | public: |
---|
| 44 | number coef; |
---|
| 45 | mac_poly_r* next; |
---|
| 46 | int exp; |
---|
| 47 | mac_poly_r():next(NULL){} |
---|
| 48 | }; |
---|
| 49 | //mac_polys exp are smaller iff they are greater by monomial ordering |
---|
| 50 | //corresponding to solving linear equations notation |
---|
| 51 | |
---|
| 52 | typedef mac_poly_r* mac_poly; |
---|
| 53 | |
---|
[b055de9] | 54 | class tgb_sparse_matrix{ |
---|
| 55 | private: |
---|
| 56 | ring r; |
---|
| 57 | mac_poly* mp; |
---|
| 58 | int columns; |
---|
| 59 | int rows; |
---|
| 60 | BOOLEAN free_numbers; |
---|
| 61 | public: |
---|
| 62 | void sort_rows(); |
---|
| 63 | friend poly free_row_to_poly(tgb_sparse_matrix* mat, int row, poly* monoms, int monom_index); |
---|
| 64 | friend void init_with_mac_poly(tgb_sparse_matrix* mat, int row, mac_poly m); |
---|
| 65 | tgb_sparse_matrix(int i, int j, ring rarg); |
---|
| 66 | ~tgb_sparse_matrix(); |
---|
| 67 | int get_rows(); |
---|
| 68 | int get_columns(); |
---|
| 69 | void print(); |
---|
| 70 | void row_normalize(int row); |
---|
| 71 | void row_content(int row); |
---|
| 72 | // void perm_rows(int i, int j); |
---|
| 73 | void perm_rows(int i, int j){ |
---|
| 74 | mac_poly h; |
---|
| 75 | h=mp[i]; |
---|
| 76 | mp[i]=mp[j]; |
---|
| 77 | mp[j]=h; |
---|
| 78 | } |
---|
| 79 | void set(int i, int j, number n); |
---|
| 80 | number get(int i, int j); |
---|
| 81 | BOOLEAN is_zero_entry(int i, int j); |
---|
| 82 | void free_row(int row, BOOLEAN free_non_zeros=TRUE); |
---|
| 83 | int min_col_not_zero_in_row(int row); |
---|
| 84 | int next_col_not_zero(int row,int pre); |
---|
| 85 | BOOLEAN zero_row(int row); |
---|
| 86 | void mult_row(int row,number factor); |
---|
| 87 | void add_lambda_times_row(int add_to,int summand,number factor); |
---|
| 88 | int non_zero_entries(int row); |
---|
| 89 | }; |
---|
[9cbb7a3] | 90 | void simple_gauss(tgb_sparse_matrix* mat, slimgb_alg* c); |
---|
[b055de9] | 91 | void simple_gauss2(tgb_matrix* mat); |
---|
[81306a] | 92 | |
---|
| 93 | |
---|
| 94 | |
---|
| 95 | mac_poly mac_p_add_ff_qq(mac_poly a, number f,mac_poly b); |
---|
| 96 | |
---|
| 97 | void mac_mult_cons(mac_poly p,number c); |
---|
| 98 | int mac_length(mac_poly p); |
---|
| 99 | |
---|
| 100 | //contrary to delete on the mac_poly_r, the coefficients are also destroyed here |
---|
| 101 | void mac_destroy(mac_poly p); |
---|
| 102 | |
---|
[b055de9] | 103 | #endif |
---|