Пример #1
0
void CheckoutDialog::checkout()
// ----------------------------------------------------------------------------
//    Action for checkout button
// ----------------------------------------------------------------------------
{
    QString id = historyFrame->rev();
    bool ok = repo->checkout(+id);
    if (ok)
        emit checkedOut(id);
}
Пример #2
0
const Matrix * rawMGB(const Matrix *inputMatrix, 
                      int reducer,
                      int spairGroupSize, // a value of 0 means let the algorithm choose
                      int nthreads,
                      M2_string logging)
{
  const Ring *R = inputMatrix->get_ring();
  const PolyRing *P = R->cast_to_PolyRing();
  if (P == 0) 
    {
      ERROR("expected a polynomial ring");
      return 0;
    }
  if (nthreads < 0)
    {
      ERROR("mgb: expected a non-negative number of threads");
      return 0;
    }
  int charac = P->charac();
  int nvars = P->n_vars();
#if defined(HAVE_MATHICGB)
  mgb::GroebnerConfiguration configuration(charac, nvars);

  const auto reducerType = reducer == 0 ?
    mgb::GroebnerConfiguration::ClassicReducer :
    mgb::GroebnerConfiguration::MatrixReducer;
  configuration.setReducer(reducerType);
  configuration.setMaxSPairGroupSize(spairGroupSize);
  configuration.setMaxThreadCount(nthreads);
  std::string log(logging->array, logging->len);
  configuration.setLogging(log.c_str());


  std::vector<int> mat;
  bool base_is_revlex = true;
  // Now set the monomial ordering info
  if (!monomialOrderingToMatrix(* P->getMonoid()->getMonomialOrdering(), mat, base_is_revlex))
    {
      ERROR("monomial ordering is not appropriate for Groebner basis computation");
      return 0;
    }
  configuration.setMonomialOrder((base_is_revlex ? 
                                    mgb::GroebnerConfiguration::BaseOrder::ReverseLexicographicBaseOrder 
                                  : mgb::GroebnerConfiguration::BaseOrder::LexicographicBaseOrder),
                                 mat);

#if 0
  // Debug information
  printf("Setting monomial order:");
  for (size_t i=0; i<mat.size(); i++) printf("%d ", mat[i]);
  printf("\n");
  printf("  Base=%d\n", base_is_revlex);
#endif

  mgb::GroebnerInputIdealStream input(configuration);

  std::ostringstream computedStr;
  mgb::IdealStreamLog<> computed(computedStr, charac, nvars);
  mgb::IdealStreamChecker<decltype(computed)> checkedOut(computed);

  matrixToStream(inputMatrix, input); 
  MatrixStream matStream(P);
  //  mgb::computeGroebnerBasis(input, checked);
  mgb::computeGroebnerBasis(input, matStream);
  const Matrix* result = matStream.value();
  //  rawDisplayMatrixStream(result);
  return result;
#endif
  return inputMatrix;
}