Esempio n. 1
0
const Ring /* or null */ *IM2_Ring_localization(const Ring *R, Computation *C)
{
  try
    {
      const PolyRing *PR = R->cast_to_PolyRing(); // FIXME should this get a PolyRing or Ring?
      GBComputation *P = C->cast_to_GBComputation();
      if (PR == nullptr)
        {
          ERROR("expected a polynomial ring");
          return nullptr;
        }
      if (P == nullptr)
        {
          ERROR("expected a Grobner basis computation");
          return nullptr;
        }
      if (P->get_ring() != PR)
        {
          ERROR("expected matrix to be over the same ring");
          return nullptr;
        }
      return LocalRing::create(PR, P);
  } catch (exc::engine_error e)
    {
      ERROR(e.what());
      return NULL;
  }
}
Esempio n. 2
0
Computation /* or null */ *
IM2_GB_set_hilbert_function(Computation *C,
                            const RingElement *h)
{
     try {
          clear_emit_size();
          GBComputation *G = C->cast_to_GBComputation();
          if (G->get_ring()->get_degree_ring() != h->get_ring())
            {
              ERROR("expected Hilbert function hint to be in correct degree ring");
              return 0;
            }
          if (G != 0)
            return G->set_hilbert_function(h);
          ERROR("computation type unknown or not implemented");
          return 0;
     }
     catch (exc::engine_error e) {
          ERROR(e.what());
          return NULL;
     }
}
Esempio n. 3
0
 virtual const Ring * get_ring() const { return G->get_ring(); }