Example #1
0
const Ring /* or null */ *IM2_Ring_quotient(const Ring *R, const Matrix *I)
{
  try
    {
      if (I->get_ring() != R)
        {
          ERROR("expected matrix to be over the same ring");
        }
      if (I->n_rows() != 1)
        {
          ERROR("expected a one row matrix of quotient elements");
          return 0;
        }
      const PolynomialRing *P = R->cast_to_PolynomialRing();
      if (P == 0)
        {
          ERROR("expected a polynomial ring");
          return 0;
        }
      PolynomialRing *result = PolynomialRing::create_quotient(P, I);
      intern_polyring(result);
      return result;
  } catch (exc::engine_error e)
    {
      ERROR(e.what());
      return NULL;
  }
}
Example #2
0
const Ring /* or null */ *IM2_Ring_quotient1(const Ring *R, const Ring *B)
/* R is a poly ring of the form A[x], B = A/I, constructs A[x]/I */
/* if R is a polynomial ring of the form A[x]/J, and B = A/I (where A is a poly
   ring)
   then form the quotient ring B[x]/J. */
{
  try
    {
      const PolynomialRing *R1 = R->cast_to_PolynomialRing();
      const PolynomialRing *B1 = B->cast_to_PolynomialRing();
      if (R1 == 0 || B1 == 0)
        {
          ERROR("expected a polynomial ring");
          return 0;
        }
      if (R1->n_quotients() > 0)
        {
          ERROR("encountered quotient polynomial ring");
          return 0;
        }
      PolynomialRing *result = PolyRingQuotient::create_quotient(R1, B1);
      intern_polyring(result);
      return result;
  } catch (exc::engine_error e)
    {
      ERROR(e.what());
      return NULL;
  }
}
Example #3
0
const Ring /* or null */ *IM2_Ring_skew_polyring(const Ring *R,
                                         M2_arrayint skewvars)
{
     try {
#if 0
//   const PolyQQ *RQ = R->cast_to_PolyQQ();
//   if (RQ != 0)
//     {
//       const PolyRing *P = SkewPolynomialRing::create(globalZZ,
//                                                   RQ->getMonoid(),
//                                                   skewvars);
//       return PolyQQ::create(P);
//     }
#endif
          const PolynomialRing *P = R->cast_to_PolynomialRing();
          if (P == 0)
            {
              ERROR("expected a polynomial ring");
              return 0;
            }
          SkewPolynomialRing *result =
             SkewPolynomialRing::create(P->getCoefficients(),
                                        P->getMonoid(),
                                        skewvars);
          intern_polyring(result);
          return result;
     }
     catch (exc::engine_error e) {
          ERROR(e.what());
          return NULL;
     }
}
Example #4
0
const Ring /* or null */ *IM2_Ring_weyl_algebra(const Ring *R,
                                                M2_arrayint comm_vars,
                                                M2_arrayint diff_vars,
                                                int homog_var)
{
  try
    {
      const PolynomialRing *P = R->cast_to_PolynomialRing();
      if (P == 0)
        {
          ERROR("expected a polynomial ring");
          return 0;
        }
      WeylAlgebra *result = WeylAlgebra::create(P->getCoefficients(),
                                                P->getMonoid(),
                                                diff_vars,
                                                comm_vars,
                                                homog_var);
      intern_polyring(result);
      return result;
  } catch (exc::engine_error e)
    {
      ERROR(e.what());
      return NULL;
  }
}
Example #5
0
const Ring /* or null */ *IM2_Ring_polyring(const Ring *K, const Monoid *M)
{
  try
    {
      const PolyRing *result = PolyRing::create(K, M);
      intern_polyring(result);
      return result;
  } catch (exc::engine_error e)
    {
      ERROR(e.what());
      return NULL;
  }
}
Example #6
0
const Ring * /* or null */ rawDividedPowerRing(const Ring *K, const Monoid *M)
{
#if 0
  //TODO: MES, this function has not yet been implemented, or even placed in engine.h
  try {
    const DividedPowerRing * result = 0;  // DividedPowerRing::create(K,M);
    intern_polyring(result);
    return result;
  }
  catch (exc::engine_error e) {
    ERROR(e.what());
    return NULL;
  }
#endif
  ERROR("not yet implemented");
  return 0;
}
Example #7
0
const Ring /* or null */ *IM2_Ring_schur(const Ring *R)
{
     try {
          const PolynomialRing *P = R->cast_to_PolynomialRing();
          if (P == 0)
            {
              ERROR("Schur ring construction: expected a polynomial ring");
              return 0;
            }
          SchurRing *result = SchurRing::create(P);
          intern_polyring(result);
          return result;
     }
     catch (exc::engine_error e) {
          ERROR(e.what());
          return NULL;
     }
}
Example #8
0
const Ring /* or null */ *IM2_Ring_solvable_algebra(const Ring *R,
                                            const Matrix *Q)
{
     try {
          const PolynomialRing *P = R->cast_to_PolynomialRing();
          if (P == 0)
            {
              ERROR("expected a polynomial ring");
              return 0;
            }
          SolvableAlgebra *result = SolvableAlgebra::create(P, Q);
          intern_polyring(result);
          return result;
     }
     catch (exc::engine_error e) {
          ERROR(e.what());
          return NULL;
     }
}
Example #9
0
const Ring /* or null */ *IM2_Ring_polyring(const Ring *K, const Monoid *M)
{
     try {
#if 0
//   if (K == globalQQ)
//     {
//       const PolyRing *P = PolyRing::create(globalZZ,M);
//       return PolyQQ::create(P);
//     }
#endif
       const PolyRing *result = PolyRing::create(K,M);
       intern_polyring(result);
       return result;
     }
     catch (exc::engine_error e) {
          ERROR(e.what());
          return NULL;
     }
}
Example #10
0
const Ring /* or null */ *IM2_Ring_skew_polyring(const Ring *R,
                                                 M2_arrayint skewvars)
{
  try
    {
      const PolynomialRing *P = R->cast_to_PolynomialRing();
      if (P == 0)
        {
          ERROR("expected a polynomial ring");
          return 0;
        }
      SkewPolynomialRing *result = SkewPolynomialRing::create(
          P->getCoefficients(), P->getMonoid(), skewvars);
      intern_polyring(result);
      return result;
  } catch (exc::engine_error e)
    {
      ERROR(e.what());
      return NULL;
  }
}
Example #11
0
const Ring /* or null */ *IM2_Ring_weyl_algebra(const Ring *R,
                                        M2_arrayint comm_vars,
                                        M2_arrayint diff_vars,
                                        int homog_var)
{
     try {
#if 0
//   const PolyQQ *RQ = R->cast_to_PolyQQ();
//   if (RQ != 0)
//     {
//       const WeylAlgebra *P = WeylAlgebra::create(globalZZ,
//                                               RQ->getMonoid(),
//                                               diff_vars,
//                                               comm_vars,
//                                               homog_var);
//       return PolyQQ::create(P);
//     }
#endif
          const PolynomialRing *P = R->cast_to_PolynomialRing();
          if (P == 0)
            {
              ERROR("expected a polynomial ring");
              return 0;
            }
          WeylAlgebra *result = WeylAlgebra::create(P->getCoefficients(),
                                                    P->getMonoid(),
                                                    diff_vars,
                                                    comm_vars,
                                                    homog_var);
          intern_polyring(result);
          return result;
     }
     catch (exc::engine_error e) {
          ERROR(e.what());
          return NULL;
     }
}