Macaulay2 Engine
Loading...
Searching...
No Matches
GBF4Interface.cpp
Go to the documentation of this file.
1#include "GBF4Interface.hpp"
2
3#include "PolynomialList.hpp"
4
6// getting polynomials/ideals/submodules to/from this code to M2, files //
8
9// TODO: Fix int/Strategy discrepancy. Make a ComputationStrategy type in util.hpp or comp-gb.hpp?
10auto createGBF4Interface(const Matrix *inputMatrix,
11 const std::vector<int>& variableWeights, // what is this, do we need it?
12 int strategy, // do we need this?
13 int numThreads
14 ) -> GBComputation*
15{
16 (void) strategy;
17 return newf4::createGBF4Interface(inputMatrix, variableWeights, newf4::Strategy::Normal, numThreads);
18}
19
20namespace newf4 {
21
22auto createGBF4Interface(const Matrix *inputMatrix,
23 const std::vector<int>& variableWeights, // what is this, do we need it?
24 Strategy strategy, // do we need this?
25 int numThreads
26 ) -> GBComputation*
27{
28 const PolynomialRing* R = inputMatrix->get_ring()->cast_to_PolynomialRing();
29 if (R == nullptr)
30 throw exc::engine_error("expected polynomial ring");
31
32 auto C = new GBF4Interface(R,
33 inputMatrix,
34 variableWeights,
35 strategy,
36 numThreads);
37 return C;
38}
39
40
42 const Matrix* inputMatrix,
43 const std::vector<int>& variableWeights,
44 Strategy strategy,
45 int numThreads
46 )
47 : mOriginalRing(originalRing),
48 mFreeModule(inputMatrix->rows()),
49 mVectorArithmetic(std::make_unique<VectorArithmetic>(mOriginalRing->getCoefficients())),
52 variableWeights,
53 strategy))
54{
55 (void) numThreads;
56 mComputation->initializeWithMatrix(inputMatrix);
57 mComputation->dumpBasisMonomials();
58 mComputation->showInput();
59}
60
62 const FreeModule* freeModule,
63 const BasicPolyList& basicPolyList,
64 const std::vector<int>& variableWeights,
65 Strategy strategy,
66 int numThreads
67 )
68 : mOriginalRing(originalRing),
69 mFreeModule(freeModule),
70 mVectorArithmetic(std::make_unique<VectorArithmetic>(mOriginalRing->getCoefficients())),
73 variableWeights,
74 strategy))
75{
76 (void) numThreads;
77 mComputation->initializeWithBasicPolyList(basicPolyList);
78}
79
81{
82 // TODO: Clean up properly
83}
84
85}; // namespace newf4
86
87// Local Variables:
88// indent-tabs-mode: nil
89// End:
std::vector< BasicPoly > BasicPolyList
auto createGBF4Interface(const Matrix *inputMatrix, const std::vector< int > &variableWeights, int strategy, int numThreads) -> GBComputation *
Legacy-to-new-F4 adapter exposing GBF4Computation through the engine's GBComputation API.
Hash-table-keyed polynomial storage for the new F4.
Engine-side free module R^n over a Ring.
Definition freemod.hpp:66
base class for Groebner basis computations.
Definition comp-gb.hpp:69
virtual const PolynomialRing * cast_to_PolynomialRing() const
Definition polyring.hpp:304
Abstract base for the engine's polynomial-ring hierarchy.
Definition polyring.hpp:96
Runtime dispatcher that hides the concrete coefficient ring behind a std::variant of ConcreteVectorAr...
GBF4Interface(const PolynomialRing *originalRing, const Matrix *inputMatrix, const std::vector< int > &variableWeights, Strategy strategy, int numThreads)
std::unique_ptr< VectorArithmetic > mVectorArithmetic
std::unique_ptr< GBF4Computation > mComputation
const FreeModule * mFreeModule
const PolynomialRing * mOriginalRing
#define Matrix
Definition factory.cpp:14
auto createGBF4Interface(const Matrix *inputMatrix, const std::vector< int > &variableWeights, Strategy strategy, int numThreads) -> GBComputation *
STL namespace.