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

◆ rawNCReductionTwoSided()

const Matrix * rawNCReductionTwoSided ( const Matrix * toBeReduced,
const Matrix * reducerMatrix )

Definition at line 977 of file groebner.cpp.

978{
979 const Ring* R = toBeReduced->get_ring();
980 if (R != reducerMatrix->get_ring())
981 {
982 ERROR("expected matrices to be over the same ring");
983 return nullptr;
984 }
985 const M2FreeAlgebra* A = R->cast_to_M2FreeAlgebra();
986 if (A != nullptr and reducerMatrix->n_rows() == 1)
987 {
988 auto outRows = toBeReduced->n_rows();
989 auto outCols = toBeReduced->n_cols();
990 auto reducees = matrixToPolyList(A, toBeReduced);
991 auto reducers = matrixToPolyList(A, reducerMatrix);
992 NCGroebner G(A->freeAlgebra(),reducers, 0, 0);
993 G.initReductionOnly();
994 auto result = G.twoSidedReduction(reducees);
995 return polyListToMatrix(A, result, outRows, outCols); // consumes the Poly's in result.
996 }
997 ERROR("expected a matrix over a noncommutative algebra");
998 return nullptr;
999}
const FreeAlgebra & freeAlgebra() const
Concrete Ring wrapper around an owned FreeAlgebra (no quotient).
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
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)
tbb::flow::graph G

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