1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
|
// Copyright 2004 Michael E. Stillman.
#include "comp-gb.hpp"
#include "gb-homog2.hpp"
#include "gb-test1.hpp"
#include "gb-sugarless.hpp"
#include "gb-toric.hpp"
#include "gauss.hpp"
#include "hermite.hpp"
#include "gb-default.hpp"
#include "gbweight.hpp"
#include "comp-gb-proxy.hpp"
#include "text-io.hpp"
#include "finalize.hpp"
GBComputation *createF4GB(const Matrix *m,
M2_bool collect_syz,
int n_rows_to_keep,
M2_arrayint gb_weights,
int strategy,
M2_bool use_max_degree,
int max_degree);
GBComputation::~GBComputation() {}
void GBComputation::text_out(buffer &o) const
{
o << "-- a raw Groebner basis computation --";
}
GBComputation *GBComputation::choose_gb(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)
{
const Ring *R1 = m->get_ring();
const PolynomialRing *R2 = R1->cast_to_PolynomialRing();
if (R2 == 0)
{
// Look for the correct computation type here.
if (R1 == globalZZ)
{
return new HermiteComputation(m, collect_syz, n_rows_to_keep);
}
if (R1->is_field())
{
return new GaussElimComputation(m, collect_syz, n_rows_to_keep);
}
#ifdef DEVELOPMENT
#warning "handle non polynomial rings"
#endif
ERROR("GB computation for non-polynomial rings not yet re-implemented");
return 0;
}
// const PolynomialRing *R = R2->get_flattened_ring();
// bool is_graded = (R->is_graded() && m->is_homogeneous());
// bool ring_is_base = R->is_basic_ring();
// bool base_is_ZZ = R->getCoefficientRing()->is_ZZ();
#ifdef DEVELOPMENT
#warning "NOT QUITE!! Need to know if it is ZZ or QQ"
#warning "unused variables commented out"
#endif
// bool base_is_field = !R->getCoefficientRing()->is_ZZ();
GBComputation *result;
switch (algorithm)
{
case 4:
result = GBinhom_comp::create(m,
collect_syz,
n_rows_to_keep,
gb_weights,
strategy,
use_max_degree,
max_degree);
break;
case 5:
result = GB_comp::create(m,
collect_syz,
n_rows_to_keep,
gb_weights,
strategy,
use_max_degree,
max_degree);
break;
case 6:
result = createF4GB(m,
collect_syz,
n_rows_to_keep,
gb_weights,
strategy,
use_max_degree,
max_degree);
break;
case 7:
result = binomialGB_comp::create(m,
collect_syz,
n_rows_to_keep,
gb_weights,
strategy,
use_max_degree,
max_degree);
break;
case 8:
result = gbB::create(m,
collect_syz,
n_rows_to_keep,
gb_weights,
strategy,
use_max_degree,
max_degree,
max_reduction_count);
break;
default:
result = gbA::create(m,
collect_syz,
n_rows_to_keep,
gb_weights,
strategy,
use_max_degree,
max_degree,
max_reduction_count);
break;
}
intern_GB(result);
return result != NULL ? new GBProxy(result) : NULL;
#if 0
// if (is_graded)
// return GB_comp::create(m,
// collect_syz,
// n_rows_to_keep,
// strategy,
// use_max_degree,
// max_degree);
//
// return 0;
#endif
#if 0
// if (base_is_ZZ)
// {
// if (ring_is_base)
// {
//
// return HermiteComputation::create(m,
// collect_syz,
// collect_change,
// n_rows_to_keep);
// return 0;
// }
// // Question: should we separate between the graded, nongraded versions?
// return GBZZ::create(m,
// collect_syz,
// collect_change,
// n_rows_to_keep);
// return 0;
// }
// else
// {
// // Base is a field
// if (ring_is_base)
// {
// return GaussElimComputation::create(m,
// collect_syz,
// collect_change,
// n_rows_to_keep);
// // This should be fraction free
// return 0;
// }
// // Also allow the user to choose between them.
// if (is_graded)
// return GB_comp::create(m,
// collect_syz,
// n_rows_to_keep,
// strategy,
// use_max_degree,
// max_degree);
// return GB_inhom_comp::create(m,
// collect_syz,
// collect_change,
// n_rows_to_keep,
// strategy);
// return 0;
// }
#endif
}
Computation /* or null */ *GBComputation::set_hilbert_function(
const RingElement *h)
// The default version returns an error saying that Hilbert functions cannot be
// used.
{
ERROR("Hilbert function use is not implemented for this GB algorithm");
return 0;
}
const Matrix /* or null */ *GBComputation::get_parallel_lead_terms(
M2_arrayint w)
{
ERROR(
"Cannot compute parallel lead terms for this kind of Groebner "
"computation");
return 0;
}
// Local Variables:
// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
// indent-tabs-mode: nil
// End:
|