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

◆ rawNCBasis()

const Matrix * rawNCBasis ( const Matrix * gb2SidedIdeal,
M2_arrayint lo_degree,
M2_arrayint hi_degree,
int limit )

Definition at line 1001 of file groebner.cpp.

1006{
1007 const Ring* R = gb2SidedIdeal->get_ring();
1008 if (R == nullptr)
1009 {
1010 ERROR("internal error: expected non-null Ring!");
1011 return nullptr;
1012 }
1013 try {
1014 const M2FreeAlgebra* A = R->cast_to_M2FreeAlgebra();
1015 if (A != nullptr)
1016 {
1017 ConstPolyList G = matrixToPolyList(A, gb2SidedIdeal);
1018
1019 // WARNING: The following line creates new polynomials
1020 // which are used directly in vectorToMatrix (without copying)
1021 // but when result goes out of scope, the list is deleted,
1022 // but not the polynomials themselves, as they are pointers.
1024 bool worked = ncBasis(A->freeAlgebra(),
1025 G,
1028 limit,
1029 result);
1030 if (not worked) return nullptr;
1031 return polyListToMatrix(A, result, 1, result.size()); // consumes entries of result
1032 }
1033 ERROR("expected a free algebra");
1034 return nullptr;
1035 }
1036 catch (exc::engine_error& e) {
1037 ERROR(e.what());
1038 return nullptr;
1039 }
1040}
gc_vector< const Poly * > ConstPolyList
gc_vector< Poly * > PolyList
const FreeAlgebra & freeAlgebra() const
Concrete Ring wrapper around an owned FreeAlgebra (no quotient).
const Ring * get_ring() const
Definition matrix.hpp:134
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
bool ncBasis(const FreeAlgebra &A, const ConstPolyList &gb, const std::vector< int > &lo_degree, const std::vector< int > &hi_degree, int limit, PolyList &result)
const int ERROR
Definition m2-mem.cpp:55
VALGRIND_MAKE_MEM_DEFINED & result(result)
tbb::flow::graph G
std::vector< T > M2_arrayint_to_stdvector(M2_arrayint arr)
Definition util.hpp:96

References Ring::cast_to_M2FreeAlgebra(), ERROR, M2FreeAlgebra::freeAlgebra(), G, Matrix::get_ring(), M2_arrayint_to_stdvector(), Matrix, matrixToPolyList(), ncBasis(), polyListToMatrix(), and result().