Macaulay2 Engine
Loading...
Searching...
No Matches

◆ initialize()

void res_comp::initialize ( const Matrix * mat,
int LengthLimit,
int strategy )
private

Definition at line 14 of file res-a1.cpp.

15{
16 int i;
17
19 assert(P != NULL);
20 R = new res_poly(const_cast<PolynomialRing *>(P));
21 M = P->getMonoid();
22 K = P->getCoefficientRing();
23 generator_matrix = mat;
24
25 // These next two lines may be added next (5/2/06)
26 // res_degree_stash = new stash("resDegree", sizeof(res_degree));
27 // res_level_stash = new stash("resLevel", sizeof(res_level));
28 res_pair_stash = new stash("respair", sizeof(res_pair));
29 mi_stash = new stash("res minodes", sizeof(Nmi_node));
30
31 for (i = 0; i <= LengthLimit; i++) resn.push_back(new res_level);
32
33 max_degree = M->max_degree();
34 length_limit = LengthLimit;
35 if (mat->n_rows() > 0)
36 {
37 lodegree = mat->rows()->primary_degree(0);
38 for (i = 1; i < mat->n_rows(); i++)
39 if (lodegree > mat->rows()->primary_degree(i))
40 lodegree = mat->rows()->primary_degree(i);
41 }
42 else
43 lodegree = 0;
44
45 for (i = 0; i < mat->n_cols(); i++)
46 if (lodegree > mat->cols()->primary_degree(i) - 1)
47 lodegree = mat->cols()->primary_degree(i) - 1;
48
50 n_level = 2;
52
55 const SchreyerOrder *S = mat->rows()->get_schreyer_order();
56 for (i = 0; i < mat->n_rows(); i++)
57 {
58 res_pair *p = new_res_pair();
59
60 p->me = component_number++;
61 p->minimal_me = p->me;
62 next_me_number++; // this and 'component_number' should still be equal
63 // here.
64 p->compare_num = i;
65
66 if (S == nullptr)
67 p->base_monom = M->make_one();
68 else
69 p->base_monom = M->make_new(S->base_monom(i));
70 p->mi = new MonomialIdeal(P, mi_stash);
71 p->syz_type = SYZ_MINIMAL;
72 p->base_comp = p;
73 base_components.push_back(p);
74 search_mi.push_back(new MonomialIdeal(P, mi_stash));
75
76 int d = mat->rows()->primary_degree(i);
77 res_degree *mypairs = make_degree_set(0, d);
78 p->next = mypairs->first;
79 mypairs->first = p;
80 mypairs->npairs++;
81 resn[0]->npairs++;
82 npairs++;
83 }
84
85 nleft = 0;
86 npairs = 0;
87 nminimal = 0;
88
89 for (i = 0; i < mat->n_cols(); i++)
90 if ((*mat)[i] != nullptr)
91 {
92 res_pair *p = new_res_pair(i); // Makes a generator 'pair'
93 int d = mat->cols()->primary_degree(i);
94 res_degree *mypairs = make_degree_set(1, d - 1);
95 p->next = mypairs->next_gen;
96 mypairs->next_gen = p;
97 mypairs->nleft++;
98 mypairs->npairs++;
99 resn[1]->nleft++;
100 resn[1]->npairs++;
101 nleft++;
102 npairs++;
103 }
104
105 for (i = 0; i < base_components.size(); i++)
106 {
107 res_pair *p = base_components[i];
108 p->compare_num = i;
109 }
110
111 exp_size = EXPONENT_BYTE_SIZE(P->n_vars());
112 monom_size = MONOMIAL_BYTE_SIZE(M->monomial_size());
113
114 compare_type = 0;
115}
int primary_degree(int i) const
Definition freemod.cpp:440
const SchreyerOrder * get_schreyer_order() const
Definition freemod.hpp:103
const Ring * get_ring() const
Definition matrix.hpp:134
int n_cols() const
Definition matrix.hpp:147
int n_rows() const
Definition matrix.hpp:146
const FreeModule * rows() const
Definition matrix.hpp:144
const FreeModule * cols() const
Definition matrix.hpp:145
virtual const PolynomialRing * cast_to_PolynomialRing() const
Definition ring.hpp:243
const_monomial base_monom(int i) const
Definition schorder.hpp:91
size_t exp_size
Definition res-a1.hpp:114
int hidegree
Definition res-a1.hpp:98
res_degree * make_degree_set(int level, int deg)
Definition res-a1.cpp:175
int compare_type
Definition res-a1.hpp:117
int component_number
Definition res-a1.hpp:108
int next_me_number
Definition res-a1.hpp:107
const Monoid * M
Definition res-a1.hpp:80
int lodegree
Definition res-a1.hpp:97
int n_level
Definition res-a1.hpp:88
const Matrix * generator_matrix
Definition res-a1.hpp:82
int length_limit
Definition res-a1.hpp:99
stash * mi_stash
Definition res-a1.hpp:85
int max_degree
Definition res-a1.hpp:102
stash * res_pair_stash
Definition res-a1.hpp:84
int n_degree
Definition res-a1.hpp:89
res_poly * R
Definition res-a1.hpp:79
const Ring * K
Definition res-a1.hpp:81
int nleft
Definition res-a1.hpp:109
int nminimal
Definition res-a1.hpp:111
int npairs
Definition res-a1.hpp:110
res_pair * new_res_pair()
Definition res-a1.cpp:210
const PolynomialRing * P
Definition res-a1.hpp:78
size_t monom_size
Definition res-a1.hpp:115
int npairs
Definition res-a1.hpp:32
res_pair * next_gen
Definition res-a1.hpp:29
int nleft
Definition res-a1.hpp:33
res_pair * first
Definition res-a1.hpp:25
int p
#define MONOMIAL_BYTE_SIZE(mon_size)
Definition monoid.hpp:66
#define EXPONENT_BYTE_SIZE(nvars)
Definition monoid.hpp:63
@ SYZ_MINIMAL

References SchreyerOrder::base_monom(), Ring::cast_to_PolynomialRing(), Matrix::cols(), compare_type, component_number, exp_size, EXPONENT_BYTE_SIZE, res_degree::first, generator_matrix, Matrix::get_ring(), FreeModule::get_schreyer_order(), hidegree, K, length_limit, lodegree, M, make_degree_set(), Matrix, max_degree, mi_stash, monom_size, MONOMIAL_BYTE_SIZE, Matrix::n_cols(), n_degree, n_level, Matrix::n_rows(), new_res_pair(), res_degree::next_gen, next_me_number, nleft, res_degree::nleft, nminimal, npairs, res_degree::npairs, P, p, FreeModule::primary_degree(), R, res_pair_stash, Matrix::rows(), and SYZ_MINIMAL.

Referenced by res_comp().