Macaulay2 Engine
Loading...
Searching...
No Matches
debug.cpp
Go to the documentation of this file.
1#include "debug.hpp"
2#include "text-io.hpp"
3#include "matrix.hpp"
4#include "relem.hpp"
5#include "gbring.hpp"
6#include "res-a1-poly.hpp"
7#include "res-a0-poly.hpp"
8#include "hermite.hpp"
9#include "mat.hpp"
10#include "monideal.hpp"
11
12void showint(mpz_srcptr a)
13{
14 char s[1000];
15 mpz_get_str(s, 10, a);
16 fprintf(stderr, " %s ", s);
17}
18
20{
21 buffer o;
22 o << "[";
23 for (int i = 0; i < a->len; i++)
24 {
25 if (i > 0) o << ", ";
26 o << a->array[i];
27 }
28 o << "]";
29 emit(o.str());
30}
31
32template <typename T>
34{
35 buffer o;
36 o << '[';
37 for (auto x : a) o << x << ' ';
38 o << ']';
39 emit(o.str());
40}
41
42template <typename T>
43void dvector(std::vector<T>& a)
44{
45 buffer o;
46 o << '[';
47 for (auto x : a) o << x << ' ';
48 o << ']';
49 emit(o.str());
50}
51
52void dmatrix(const Matrix *M)
53{
54 buffer o;
55 M->text_out(o);
56 emit(o.str());
57}
58
59void drelem(const RingElement *f)
60{
61 buffer o;
62 f->text_out(o);
63 emit(o.str());
64}
65
66void dfree(const FreeModule *F)
67{
68 buffer o;
69 F->text_out(o);
70 emit(o.str());
71}
72
73void dringelem(const Ring *R, const ring_elem f)
74{
75 buffer o;
76 R->elem_text_out(o, f);
77 emit(o.str());
78}
79
80void dNterm(const Ring *R, const Nterm *f)
81{
82 buffer o;
83 ring_elem g = const_cast<Nterm *>(f);
84 R->elem_text_out(o, g);
85 emit(o.str());
86}
87
88void dvec(const Ring *R, const vec v)
89{
90 buffer o;
91 R->vec_text_out(o, v);
92 emit_line(o.str());
93}
94
95void dgbvec(const GBRing *R, gbvector *v)
96{
97 buffer o;
98 const FreeModule *F = nullptr;
99 R->gbvector_text_out(o, F, v);
100 emit(o.str());
101}
102
103void drespoly(const res_poly *R, const resterm *f)
104{
105 buffer o;
106 R->elem_text_out(o, f);
107 emit(o.str());
108}
109
110void drespoly2(const res2_poly *R, const res2term *f)
111{
112 buffer o;
113 R->elem_text_out(o, f);
114 emit(o.str());
115}
116
118{
119 buffer o;
120 G->text_out(o);
121 emit(o.str());
122}
123
125{
126 buffer o;
127 m->text_out(o);
128 emit(o.str());
129}
130
132{
133 buffer o;
134 m->text_out(o);
135 emit(o.str());
136}
137
138void dstash()
139{
140 buffer o;
141 stash::stats(o);
142 emit(o.str());
143}
144
146{
147 buffer o;
148 o << a << newline;
149 emit(o.str());
150}
151
152void pring(const Ring *R)
153{
154 buffer o;
155 R->text_out(o);
156 emit(o.str());
157}
158// Local Variables:
159// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
160// indent-tabs-mode: nil
161// End:
void text_out(buffer &o) const
Definition freemod.cpp:471
Engine-side free module R^n over a Ring.
Definition freemod.hpp:66
void gbvector_text_out(buffer &o, const FreeModule *F, const gbvector *f, int nterms=-1) const
Definition gbring.cpp:779
Polynomial-ring view tuned for the inner loop of classical Buchberger Groebner-basis computations.
Definition gbring.hpp:120
Slow Hermite normal form computation over ZZ. Replace.
Definition hermite.hpp:56
void text_out(buffer &o) const
Definition matrix.cpp:1316
void text_out(buffer &o) const
Definition monideal.cpp:639
Engine-side monomial ideal: a decision tree of Nmi_nodes storing the (typically minimal) generators b...
Definition monideal.hpp:136
void text_out(buffer &o) const
Definition mat.cpp:89
Abstract base class for mutable matrices over an arbitrary engine Ring, the in-place counterpart of t...
Definition mat.hpp:79
void vec_text_out(buffer &o, const vecterm *v, bool p_one=true, bool p_plus=false, bool p_parens=false) const
virtual void text_out(buffer &o) const =0
virtual void elem_text_out(buffer &o, const ring_elem f, bool p_one=true, bool p_plus=false, bool p_parens=false) const =0
void text_out(buffer &o) const
Definition relem.cpp:142
Front-end-visible "ring element" value: an engine ring_elem paired with the Ring* that gives it meani...
Definition relem.hpp:67
xxx xxx xxx
Definition ring.hpp:102
char * str()
Definition buffer.hpp:72
void elem_text_out(buffer &o, const res2term *f) const
void elem_text_out(buffer &o, const resterm *f) const
static void stats(buffer &o)
Definition mem.cpp:93
void dmatrix(const Matrix *M)
Definition debug.cpp:52
void dvec(const Ring *R, const vec v)
Definition debug.cpp:88
void drelem(const RingElement *f)
Definition debug.cpp:59
void dstash()
Definition debug.cpp:138
void dNterm(const Ring *R, const Nterm *f)
Definition debug.cpp:80
void showint(mpz_srcptr a)
Definition debug.cpp:12
void dhermite(HermiteComputation *G)
Definition debug.cpp:117
void pring(const Ring *R)
Definition debug.cpp:152
void dringelem(const Ring *R, const ring_elem f)
Definition debug.cpp:73
void dvector(gc_vector< T > &a)
Definition debug.cpp:33
void dRRR(gmp_RR a)
Definition debug.cpp:145
void dmonideal(MonomialIdeal *m)
Definition debug.cpp:131
void drespoly2(const res2_poly *R, const res2term *f)
Definition debug.cpp:110
void dmutablemat(MutableMatrix *m)
Definition debug.cpp:124
void dfree(const FreeModule *F)
Definition debug.cpp:66
void drespoly(const res_poly *R, const resterm *f)
Definition debug.cpp:103
void dintarray(M2_arrayint a)
Definition debug.cpp:19
void dgbvec(const GBRing *R, gbvector *v)
Definition debug.cpp:95
Debugger-callable d* helpers that pretty-print engine values to stderr.
#define Matrix
Definition factory.cpp:14
GBRing and gbvector — the GB-tuned polynomial-ring view used by classical Buchberger code.
HermiteComputation — Hermite normal form over ZZ, the ZZ-analogue of GaussElimComputation.
void size_t s
Definition m2-mem.cpp:271
char newline[]
Definition m2-types.cpp:49
mpfr_srcptr gmp_RR
Definition m2-types.h:148
MutableMatrix — abstract base of every mutable matrix the engine hands across the boundary.
Matrix — the engine's immutable homomorphism F -> G between free modules.
MonomialIdeal — exponent-vector-only representation of an ideal generated by monomials.
typename std::vector< T, gc_allocator< T > > gc_vector
a version of the STL vector, which allocates its backing memory with gc.
Definition newdelete.hpp:76
volatile int x
RingElement — tagged (Ring*, ring_elem) pair, the engine's universal element type.
tbb::flow::graph G
Singly linked-list node carrying one term of a polynomial-ring element.
Definition ringelem.hpp:156
void emit_line(const char *s)
Definition text-io.cpp:47
void emit(const char *s)
Definition text-io.cpp:41
Text-formatting helpers layered on buffer: bignum print, line wrapping, M2_gbTrace-gated emit.