From 96da14a897902abefadbabac1c3c53179e68f025 Mon Sep 17 00:00:00 2001 From: Mahrud Sayrafi Date: Fri, 5 Jul 2024 13:45:00 -0500 Subject: [PATCH] removed duplicates from engine.h --- M2/Macaulay2/e/engine.h | 94 ----------------------------- M2/Macaulay2/e/interface/groebner.h | 28 ++++++++- 2 files changed, 27 insertions(+), 95 deletions(-) diff --git a/M2/Macaulay2/e/engine.h b/M2/Macaulay2/e/engine.h index 0721668cb42..e6f157944dc 100644 --- a/M2/Macaulay2/e/engine.h +++ b/M2/Macaulay2/e/engine.h @@ -116,100 +116,6 @@ extern "C" { void rawShowComputation(const Computation *C); /* Dan: connected to rawShowComputation */ - /******************************************* - * Computation routines for Groebner bases * - *******************************************/ - - /* - routine to compute a Groebner basis of an ideal in a polynomial ring - over a finite prime field. Interfaces to mathicgb. - reducer: 0 is ClassicReducer, 1 is MatrixReducer - */ - const Matrix* /* or null */ rawMGB(const Matrix* input, - int reducer, - int spairGroupSize, - int nthreads, - const M2_string logging - ); /* connected: rawMGB */ - - Computation /* or null */ *IM2_GB_make(const Matrix *m, - M2_bool collect_syz, - int n_rows_to_keep, - M2_arrayint gb_weights, - M2_bool use_max_degree, - int max_degree, - int algorithm, - int strategy, - int max_reduction_count); /* drg: connected rawGB */ - - Computation /* or null */ *IM2_GB_force(const Matrix *m, - const Matrix *gb, - const Matrix *change, - const Matrix *syz); /* drg: connected rawGBForce */ - - Computation /* or null */ *rawMarkedGB(const Matrix *leadterms, - const Matrix *m, - const Matrix *gb, - const Matrix *change, - const Matrix *syz); /* mes: connected rawMarkedGB */ - - Computation /* or null */ *rawGroebnerWalk(const Matrix *gb, - const MonomialOrdering *order1); - /* Create a GB algorithm which will compute using the generic Groebner walk algorithm - Input: gb: a matrix which, under order1, would be a Groebner basis, except that - 'gb' is a matrix over a polynomial ring whose order is 'order2'. - order1: a monomial ordering - Output: a Groebner basis computation object which will compute a GB of gb wrt - order2, using the Geneeric Groebner Walk algorithm of ... - Assumptions: the base ring is a polynomial ring over a field, with NO quotient elements - */ - - Computation /* or null */ *IM2_GB_set_hilbert_function(Computation *G, - const RingElement *h); /* drg: connected rawGBSetHilbertFunction */ - - - const Matrix /* or null */ *rawGBGetMatrix(Computation *C); - /* Get the minimal, auto-reduced GB of a GB computation. - Each call to this may produce a different raw matrix */ - - const Matrix /* or null */ *rawGBGetLeadTerms(Computation *G, int nparts); - - const Matrix /* or null */ *rawGBGetParallelLeadTerms(Computation *C, M2_arrayint w); - - 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. */ - - 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). */ - - 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. */ - - const Matrix /* or null */ *rawGBMatrixRemainder(Computation *G, - const Matrix *m); /* drg: connected rawGBMatrixRemainder */ - - M2_bool IM2_GB_matrix_lift(Computation *G, - const Matrix *m, - const Matrix /* or null */ **result_remainder, - const Matrix /* or null */ **result_quotient - ); /* drg: connected rawGBMatrixLift */ - /* false is returned if there is an error or if the remainder is NON-zero */ - - int IM2_GB_contains(Computation *G, - const Matrix *m); /* drg: connected rawGBContains */ - - /******************************************* * Computation routines for Resolutions **** *******************************************/ diff --git a/M2/Macaulay2/e/interface/groebner.h b/M2/Macaulay2/e/interface/groebner.h index 016cc5227dc..cb5d9e4f1e4 100644 --- a/M2/Macaulay2/e/interface/groebner.h +++ b/M2/Macaulay2/e/interface/groebner.h @@ -1,3 +1,7 @@ +/******************************************* + * Computation routines for Groebner bases * + *******************************************/ + // FIXME: this header is based on what is defined in groebner.cpp, // but the declarations in engine.h don't seem to match @@ -80,15 +84,18 @@ Computation /* or null */ *IM2_res_make(const Matrix *m, int strategy, M2_bool parallelizeByDegree); +/* rawGBSetHilbertFunction */ Computation /* or null */ *IM2_GB_set_hilbert_function(Computation *C, const RingElement *h); +/* rawGBForce */ Computation /* or null */ *IM2_GB_force( const Matrix *m, /* trimmed or minimal gens, may be the same as gb */ const Matrix *gb, const Matrix *change, /* same number of columns as 'gb', if not 0 */ const Matrix *syz); /* possibly 0 too, otherwise same rows as change */ +/* rawMarkedGB */ Computation /* or null */ *rawMarkedGB( const Matrix *leadterms, const Matrix *m, /* trimmed or minimal gens, may be the same as gb */ @@ -96,6 +103,14 @@ Computation /* or null */ *rawMarkedGB( const Matrix *change, /* same number of columns as 'gb', if not 0 */ const Matrix *syz); /* possibly 0 too, otherwise same rows as change */ +/* Create a GB algorithm which will compute using the generic Groebner walk algorithm + Input: gb: a matrix which, under order1, would be a Groebner basis, except that + 'gb' is a matrix over a polynomial ring whose order is 'order2'. + order1: a monomial ordering + Output: a Groebner basis computation object which will compute a GB of gb wrt + order2, using the Geneeric Groebner Walk algorithm of ... + Assumptions: the base ring is a polynomial ring over a field, with NO quotient elements + */ Computation /* or null */ *rawGroebnerWalk(const Matrix *gb, const MonomialOrdering *order1); @@ -120,6 +135,7 @@ enum ComputationStatusCode rawStatus1(Computation *C); int rawStatus2(Computation *C); void rawShowComputation(const Computation *C); + 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 */ @@ -149,14 +165,21 @@ const Matrix /* or null */ *rawGBSyzygies(Computation *C); set to a non-negative integer, then only that many rows of each syzygy are kept. */ +/* rawGBMatrixRemainder */ const Matrix /* or null */ *rawGBMatrixRemainder(Computation *C, const Matrix *m); +/* rawGBMatrixLift: false is returned if there is an error or if the + remainder is NON-zero */ M2_bool IM2_GB_matrix_lift(Computation *C, const Matrix *m, const Matrix /* or null */ **result_remainder, const Matrix /* or null */ **result_quotient); +/* rawGBContains: given a Groebner basis computation C and matrix m, returns: + -2 for errors + -1 for containment of span(m) in span(C) + i for the smallest index of a column of m not contained in span(C) */ int IM2_GB_contains(Computation *C, const Matrix *m); /******************************************* @@ -254,8 +277,11 @@ Matrix /* or null */ *rawSubduction1(int numparts, void rawDisplayMatrixStream(const Matrix *inputMatrix); +/* rawMGB: interface to mathicgb for computing a Groebner basis of an ideal + in a polynomial ring over a finite prime field. + reducer: 0 is ClassicReducer, 1 is MatrixReducer */ const Matrix *rawMGB( - const Matrix *inputMatrix, + const Matrix *input, int reducer, int spairGroupSize, // a value of 0 means let the algorithm choose int nthreads,