source: git/kernel/GBEngine/tgbgauss.h @ 2d223b

fieker-DuValspielwiese
Last change on this file since 2d223b was 76f525, checked in by Hans Schoenemann <hannes@…>, 9 years ago
opt: omallocClass for mac_poly_r
  • Property mode set to 100644
File size: 2.6 KB
Line 
1#ifndef TGBGAUSS_HEADER
2#define TGBGAUSS_HEADER
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/*
7* ABSTRACT: gauss implementation for F4 header
8*/
9// #include <kernel/mod2.h>
10#include <coeffs/numbers.h>
11#include <polys/monomials/p_polys.h>
12#include <omalloc/omallocClass.h>
13//#include "tgb_internal.h"
14
15class slimgb_alg;
16
17class 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};
41
42class mac_poly_r :public omallocClass
43{
44public:
45  number coef;
46  mac_poly_r* next;
47  int exp;
48  mac_poly_r():next(NULL){}
49};
50//mac_polys exp are smaller iff they are greater by monomial ordering
51//corresponding to solving linear equations notation
52
53typedef mac_poly_r* mac_poly;
54
55class tgb_sparse_matrix{
56 private:
57  ring r;
58  mac_poly* mp;
59  int columns;
60  int rows;
61  BOOLEAN free_numbers;
62 public:
63  void sort_rows();
64  friend poly free_row_to_poly(tgb_sparse_matrix* mat, int row, poly* monoms, int monom_index);
65  friend void init_with_mac_poly(tgb_sparse_matrix* mat, int row, mac_poly m);
66  tgb_sparse_matrix(int i, int j, ring rarg);
67  ~tgb_sparse_matrix();
68  int get_rows();
69  int get_columns();
70  void print();
71  void row_normalize(int row);
72  void row_content(int row);
73  //  void perm_rows(int i, int j);
74  void perm_rows(int i, int j){
75  mac_poly h;
76  h=mp[i];
77  mp[i]=mp[j];
78  mp[j]=h;
79  }
80  void set(int i, int j, number n);
81  number get(int i, int j);
82  BOOLEAN is_zero_entry(int i, int j);
83  void free_row(int row, BOOLEAN free_non_zeros=TRUE);
84  int min_col_not_zero_in_row(int row);
85  int next_col_not_zero(int row,int pre);
86  BOOLEAN zero_row(int row);
87  void mult_row(int row,number factor);
88  void add_lambda_times_row(int add_to,int summand,number factor);
89  int non_zero_entries(int row);
90};
91void simple_gauss(tgb_sparse_matrix* mat, slimgb_alg* c);
92void simple_gauss2(tgb_matrix* mat);
93
94
95
96mac_poly mac_p_add_ff_qq(mac_poly a, number f,mac_poly b);
97
98void mac_mult_cons(mac_poly p,number c);
99int mac_length(mac_poly p);
100
101//contrary to delete on the mac_poly_r, the coefficients are also destroyed here
102void mac_destroy(mac_poly p);
103
104#endif
Note: See TracBrowser for help on using the repository browser.