Macaulay2 Engine
Loading...
Searching...
No Matches
res-moninfo-dense.cpp
Go to the documentation of this file.
1// Copyright 2016 Michael E. Stillman
2
4#include "schreyer-resolution/res-monomial-types.hpp" // for res_monomial_word
5
6#include <cstdio> // for fprintf, stderr
7#include <cstdlib> // for rand
8
10 const std::vector<int>& var_degrees,
11 const std::vector<int>& weightvecs,
12 const MonomialOrderingType moType)
13{
14 (void) weightvecs;
15 (void) moType;
16 nvars = nvars0;
17 hashfcn = std::unique_ptr<res_monomial_word[]>(new res_monomial_word[nvars]);
18 for (int i = 0; i < nvars; i++) hashfcn[i] = rand();
19 mask = 0x10000000;
20 mVarDegrees = var_degrees;
21
24 ncalls_mult = 0;
32 ncalls_divide = 0;
33 ncalls_weight = 0;
36
37 nweights = 0;
38#if 0
39 if (moType == MonomialOrderingType::Lex) // moIsLex(mo)
40 {
41 compare = &ResMonoidDense::compare_lex;
42
43 if (M2_gbTrace >= 1)
44 fprintf(stderr, "lex order\n");
45 }
46 else if (moType == MonomialOrderingType::GRevLex) // moIsGRevLex(mo)
47 {
48 compare = &ResMonoidDense::compare_grevlex;
49
50 if (M2_gbTrace >= 1)
51 fprintf(stderr, "grevlex order\n");
52 }
53 else
54 {
55 weight_vectors = weightvecs;
56 nweights = static_cast<int>(weight_vectors.size()) / nvars;
57 compare = &ResMonoidDense::compare_weightvector;
58
59 if (M2_gbTrace >= 1)
60 fprintf(stderr, "weight order\n");
61 }
62#endif
63
64 nslots = 2 + nvars + nweights;
65 firstvar = 2 + nweights;
66}
67
69{
70 // delete [] hashfcn;
71}
72
74{
75 fprintf(stderr, "monomial info\n");
76 fprintf(stderr, " nvars = %d", nvars);
77 fprintf(stderr, " nslots = %d", nslots);
78 fprintf(stderr, " mask = %d", mask);
79 fprintf(stderr, " hash values for each variable\n");
80 for (int i = 0; i < nvars; i++) fprintf(stderr, " %d\n", hashfcn[i]);
81 fprintf(stderr, " #calls hashval = %lu\n", ncalls_hash_value);
82 fprintf(stderr, " #calls compare = %lu\n", ncalls_compare);
83 fprintf(stderr, " #calls mult = %lu\n", ncalls_mult);
84 fprintf(stderr, " #calls get comp= %lu\n", ncalls_get_component);
85 fprintf(stderr, " #calls fromexp = %lu\n", ncalls_from_expvector);
86 fprintf(stderr, " #calls toexp = %lu\n", ncalls_to_expvector);
87 fprintf(stderr, " #calls fromvp = %lu\n", ncalls_from_varpower);
88 fprintf(stderr, " #calls tovp = %lu\n", ncalls_to_varpower);
89 fprintf(stderr, " #calls is equal= %lu\n", ncalls_is_equal);
90 fprintf(stderr, " #calls eq true = %lu\n", ncalls_is_equal_true);
91 fprintf(stderr, " #calls divide = %lu\n", ncalls_divide);
92 fprintf(stderr, " #calls weight = %lu\n", ncalls_weight);
93 fprintf(stderr, " #calls unneeded= %lu\n", ncalls_unneccesary);
94 fprintf(stderr, " #calls vp quot = %lu\n", ncalls_quotient_as_vp);
95}
96
98{
99 fprintf(stderr, "[");
100 for (int v = 1; v < monomial_size(m); v++)
101 {
102 if (v > 1) fprintf(stderr, " ");
103 fprintf(stderr, "%d", m[v]);
104 }
105 fprintf(stderr, "]");
106}
107
109{
111
112 m += 2 + nweights; // get by: hashcode, component, weightvals
113 for (int i = 0; i < nvars; i++)
114 {
115 long e = *m++;
116 if (e == 0) continue;
117 fprintf(stdout, "%c", 'a' + i);
118 if (e > 1) fprintf(stdout, "%ld", e);
119 }
120 fprintf(stdout, "<%d>", comp);
121}
122
124{
125 o << "[";
126 for (int ell = 0; ell < monomial_size(mon); ell++)
127 {
128 if (ell != 0) o << " ";
129 o << mon[ell];
130 }
131 o << "]";
132}
133// Local Variables:
134// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
135// indent-tabs-mode: nil
136// End:
unsigned long ncalls_quotient_as_vp
unsigned long ncalls_hash_value
component_index get_component(res_const_packed_monomial m) const
unsigned long ncalls_to_varpower
unsigned long ncalls_divide
std::unique_ptr< res_monomial_word[]> hashfcn
void showAlpha(res_const_packed_monomial m) const
res_monomial_word mask
unsigned long ncalls_compare
unsigned long ncalls_is_equal
unsigned long ncalls_unneccesary
unsigned long ncalls_to_expvector
unsigned long ncalls_from_expvector
ResMonoidDense(int nvars, const std::vector< int > &var_degrees, const std::vector< int > &weightvecs, MonomialOrderingType moType)
int monomial_size(res_const_packed_monomial m) const
unsigned long ncalls_get_component
unsigned long ncalls_weight
std::vector< int > weight_vectors
std::vector< int > mVarDegrees
unsigned long ncalls_is_equal_true
unsigned long ncalls_mult
unsigned long ncalls_from_varpower
void dump(std::ostream &o, res_const_packed_monomial mon)
static int compare(const vecterm *t, const vecterm *s)
Definition geovec.hpp:112
int M2_gbTrace
Definition m2-types.cpp:52
ResMonoidDense — dense exponent-vector implementation of the resolution monoid.
myword component_index
const res_monomial_word * res_const_packed_monomial
myword res_monomial_word
MonomialOrderingType
Typed-monomial vocabulary shared by ResMonoid, ResPolyRing, SchreyerFrame, and F4Res.