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

◆ rawNCGroebnerBasisTwoSided()

const Matrix * rawNCGroebnerBasisTwoSided ( const Matrix * input,
int maxdeg,
int strategy )

Definition at line 946 of file groebner.cpp.

947{
948 const Ring* R = input->get_ring();
949 const M2FreeAlgebra* A = R->cast_to_M2FreeAlgebra();
950 if (A != nullptr and input->n_rows() == 1)
951 {
952 auto elems = matrixToPolyList(A, input);
953 bool isF4 = strategy & 16;
954 bool isParallel = strategy & 32;
955 if (isF4)
956 {
957 int numthreads = M2_numTBBThreads; // settable from front end.
958 // std::cout << "Using numthreads = " << numthreads << std::endl;
959 NCF4 G(A->freeAlgebra(), elems, maxdeg, strategy, (isParallel ? numthreads : 1));
960 G.compute(maxdeg); // this argument is actually the soft degree limit
961 auto result = copyPolyVector(A, G.currentValue());
962 return polyListToMatrix(A, result, 1, result.size()); // consumes the Poly's in result
963 }
964 else
965 {
966 NCGroebner G(A->freeAlgebra(), elems, maxdeg, strategy);
967 G.compute(maxdeg); // this argument is actually the soft degree limit
968 auto result = copyPolyVector(A, G.currentValue());
969 return polyListToMatrix(A, result, 1, result.size()); // consumes the Poly's in result
970 }
971
972 }
973 ERROR("expected a one row matrix over a noncommutative algebra");
974 return nullptr;
975}
PolyList copyPolyVector(const M2FreeAlgebraOrQuotient *A, const PolyList &polys)
const FreeAlgebra & freeAlgebra() const
Concrete Ring wrapper around an owned FreeAlgebra (no quotient).
const Ring * get_ring() const
Definition matrix.hpp:134
int n_rows() const
Definition matrix.hpp:146
Non-commutative F4 Groebner-basis driver: builds a per-degree Macaulay matrix from overlaps and reduc...
Definition NCF4.hpp:104
One-overlap-at-a-time Groebner basis driver for the free associative algebra (the "Naive" companion t...
virtual const M2FreeAlgebra * cast_to_M2FreeAlgebra() const
Definition ring.hpp:256
xxx xxx xxx
Definition ring.hpp:102
ConstPolyList matrixToPolyList(const M2FreeAlgebraOrQuotient *A, const Matrix *input)
Definition groebner.cpp:907
const Matrix * polyListToMatrix(const M2FreeAlgebraOrQuotient *A, const PolyL &elems, int numrows, int numcols)
Definition groebner.cpp:927
const int ERROR
Definition m2-mem.cpp:55
VALGRIND_MAKE_MEM_DEFINED & result(result)
int M2_numTBBThreads
Definition m2-types.cpp:51
tbb::flow::graph G

References Ring::cast_to_M2FreeAlgebra(), copyPolyVector(), ERROR, M2FreeAlgebra::freeAlgebra(), G, Matrix::get_ring(), M2_numTBBThreads, Matrix, matrixToPolyList(), Matrix::n_rows(), polyListToMatrix(), and result().