const Ring /* or null */ *IM2_Ring_localization(const Ring *R, Computation *C) { try { const PolyRing *PR = R->cast_to_PolyRing(); // FIXME should this get a PolyRing or Ring? GBComputation *P = C->cast_to_GBComputation(); if (PR == nullptr) { ERROR("expected a polynomial ring"); return nullptr; } if (P == nullptr) { ERROR("expected a Grobner basis computation"); return nullptr; } if (P->get_ring() != PR) { ERROR("expected matrix to be over the same ring"); return nullptr; } return LocalRing::create(PR, P); } catch (exc::engine_error e) { ERROR(e.what()); return NULL; } }
extern "C" void remove_gb(void *p, void *cd) { GBComputation *G = static_cast<GBComputation *>(p); AO_t nremoved = AO_fetch_and_add1(&gbs_nremoved); if (M2_gbTrace >= 3) fprintf(stderr, "\n --removing gb %zd at %p\n", nremoved, G); G->remove_gb(); }
const Matrix /* or null */ * rawGBGetParallelLeadTerms(Computation *C, M2_arrayint w) { try { clear_emit_size(); GBComputation *G = C->cast_to_GBComputation(); if (G != 0) return G->get_parallel_lead_terms(w); ERROR("computation type unknown or not implemented"); return 0; } catch (exc::engine_error e) { ERROR(e.what()); return NULL; } }
const Matrix /* or null */ * rawGBGetLeadTerms(Computation *C, int nparts) { try { clear_emit_size(); GBComputation *G = C->cast_to_GBComputation(); if (G != 0) return G->get_initial(nparts); ERROR("computation type unknown or not implemented"); return 0; } catch (exc::engine_error e) { ERROR(e.what()); return NULL; } }
int IM2_GB_contains(Computation *C, const Matrix *m) { try { clear_emit_size(); GBComputation *G = C->cast_to_GBComputation(); if (G != 0) return G->contains(m); ERROR("computation type unknown or not implemented"); return -2; } catch (exc::engine_error e) { ERROR(e.what()); return -2; } }
const Matrix /* or null */ * rawGBMatrixRemainder(Computation *C, const Matrix *m) { try { clear_emit_size(); GBComputation *G = C->cast_to_GBComputation(); if (G != 0) return G->matrix_remainder(m); ERROR("computation type unknown or not implemented"); return 0; } catch (exc::engine_error e) { ERROR(e.what()); return NULL; } }
const Matrix /* or null */ *rawGBGetMatrix(Computation *C) /* Get the minimal, auto-reduced GB of a GB computation. Each call to this will produce a different raw matrix */ { try { clear_emit_size(); GBComputation *G = C->cast_to_GBComputation(); if (G != 0) return G->get_gb(); ERROR("computation type unknown or not implemented"); return 0; } catch (exc::engine_error e) { ERROR(e.what()); return NULL; } }
M2_bool IM2_GB_matrix_lift(Computation *C, const Matrix *m, const Matrix /* or null */ **result_remainder, const Matrix /* or null */ **result_quotient ) { try { clear_emit_size(); GBComputation *G = C->cast_to_GBComputation(); if (G != 0) return G->matrix_lift(m, result_remainder, result_quotient); else ERROR("computation type unknown or not implemented"); } catch (exc::engine_error e) { ERROR(e.what()); } return false; }
const Matrix /* or null */ *rawGBMinimalGenerators(Computation *C) /* Yields a matrix whose columns form a minimal generating set for the ideal or submodule, as computed so far. In the inhomogeneous case, this yields a generating set which is sometimes smaller than the entire Groebner basis. */ { try { clear_emit_size(); GBComputation *G = C->cast_to_GBComputation(); if (G != 0) return G->get_mingens(); ERROR("computation type unknown or not implemented"); return 0; } catch (exc::engine_error e) { ERROR(e.what()); return NULL; } }
const Matrix /* or null */ *rawGBSyzygies(Computation *C) /* Yields a matrix containing the syzygies computed so far via the GB computation C, assuming that 'collect_syz' was set when the computation was created. If 'n_rows_to_keep' was set to a non-negative integer, then only that many rows of each syzygy are kept. */ { try { clear_emit_size(); GBComputation *G = C->cast_to_GBComputation(); if (G != 0) return G->get_syzygies(); ERROR("computation type unknown or not implemented"); return 0; } catch (exc::engine_error e) { ERROR(e.what()); return NULL; } }
const Matrix /* or null */ *rawGBChangeOfBasis(Computation *C) /* Yields the change of basis matrix from the Groebner basis to the original generators, at least if n_rows_to_keep was set when creating the GB computation. This matrix, after the computation has run to completion, should satisfy: (original matrix) = (GB matrix) * (change of basis matrix). */ { try { clear_emit_size(); GBComputation *G = C->cast_to_GBComputation(); if (G != 0) return G->get_change(); ERROR("computation type unknown or not implemented"); return 0; } catch (exc::engine_error e) { ERROR(e.what()); return NULL; } }
Computation /* or null */ * IM2_GB_set_hilbert_function(Computation *C, const RingElement *h) { try { clear_emit_size(); GBComputation *G = C->cast_to_GBComputation(); if (G->get_ring()->get_degree_ring() != h->get_ring()) { ERROR("expected Hilbert function hint to be in correct degree ring"); return 0; } if (G != 0) return G->set_hilbert_function(h); ERROR("computation type unknown or not implemented"); return 0; } catch (exc::engine_error e) { ERROR(e.what()); return NULL; } }
virtual void text_out(buffer &o) const { G->text_out(o); }
virtual void show() const { G->show(); }
virtual M2_bool matrix_lift(const Matrix *m, const Matrix /* or null */ **result_remainder, const Matrix /* or null */ **result_quotient) { return G->matrix_lift(m,result_remainder,result_quotient); }
virtual int contains(const Matrix *m) { return G->contains(m); }
virtual const Matrix /* or null */ *get_parallel_lead_terms(M2_arrayint w) { return G->get_parallel_lead_terms(w); }
virtual const Matrix /* or null */ *matrix_remainder(const Matrix *m) { return G->matrix_remainder(m); }
virtual const Matrix /* or null */ *get_syzygies() { return G->get_syzygies(); }
virtual Computation /* or null */ *set_hilbert_function(const RingElement *h) { return G->set_hilbert_function(h); }
virtual const Matrix /* or null */ *get_mingens() { return G->get_mingens(); }
virtual const Matrix /* or null */ *get_change() { return G->get_change(); }
//////////////////////////////// // Results of the computation // //////////////////////////////// virtual const Matrix /* or null */ *get_gb() { return G->get_gb(); }
virtual int complete_thru_degree() const { return G->complete_thru_degree(); }
GBComputation *replace_GB(GBComputation *G0) { GBComputation *result = G; set_status(G->status()); G = G0; return result; }
virtual bool stop_conditions_ok() { G->stop_ = stop_; return G->stop_conditions_ok(); }
virtual const Matrix /* or null */ *get_initial(int nparts) { return G->get_initial(nparts); }
virtual void start_computation() { G->start_computation(); set_status(G->status()); }
virtual const Ring * get_ring() const { return G->get_ring(); }