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

◆ create() [1/2]

GBComputation * GBDeclared::create ( const Matrix * leadterms,
const Matrix * m,
const Matrix * gb,
const Matrix * change,
const Matrix * syz )
static

Definition at line 117 of file comp-gb-declared.cpp.

122{
123 // Check:
124 // the rings are all the same, and all are not NULL.
125 // m->rows(), gb->rows() are the same
126 // change->rows(), syz->rows() are the same.
127 assert(leadterms != 0 && m != 0 && gb != 0 && change != 0 && syz != 0);
128 const Ring *R = gb->get_ring();
129 if (R != m->get_ring() || R != leadterms->get_ring() ||
130 R != change->get_ring() || R != syz->get_ring())
131 {
132 ERROR("expected the same ring");
133 return nullptr;
134 }
135
136 const PolynomialRing *P = R->cast_to_PolynomialRing();
137 if (P == nullptr)
138 {
139 ERROR("declaring a GB requires a polynomial ring");
140 return nullptr;
141 }
142 if (leadterms->n_rows() != gb->n_rows() ||
143 leadterms->n_cols() != gb->n_cols())
144 {
145 ERROR(
146 "expected same number of lead terms as marked Groebner basis "
147 "elements");
148 return nullptr;
149 }
150 // Then: create and return the object
151 return new GBDeclared(leadterms, m, gb, change, syz);
152}
const Matrix * syz
GBDeclared(const Matrix *m0, const Matrix *gb, const Matrix *change, const Matrix *syz0)
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
virtual const PolynomialRing * cast_to_PolynomialRing() const
Definition ring.hpp:243
void gb(IntermediateBasis &F, int n)
const int ERROR
Definition m2-mem.cpp:55

References Ring::cast_to_PolynomialRing(), ERROR, gb(), GBComputation::GBComputation(), GBDeclared(), Matrix::get_ring(), Matrix, Matrix::n_cols(), Matrix::n_rows(), and syz.