923{
925 if (R != nullptr)
926 {
928 int nsupp = 0;
931 for (
int i = 0; i < R->
n_vars(); i++) exp[i] = exp2[i] = 0;
932 for (
int j = 0; j <
n_cols(); j++)
933 for (vec v =
elem(j); v !=
nullptr; v = v->next)
934 for (Nterm& f : v->coeff)
935 {
937 for (int k = 0; k < n; k++)
938 if (exp2[k] != 0 && exp[k] == 0)
939 {
941 if (++nsupp == n) goto out;
942 }
943 }
944out:
946 int next = 0;
947 for (int i = 0; i < n; i++)
948 if (exp[i] > 0)
result->array[next++] = i;
952 }
953
954
955 const M2FreeAlgebraOrQuotient* Q =
dynamic_cast<const M2FreeAlgebraOrQuotient*
>(
get_ring());
956 if (Q != nullptr)
957 {
959 int nsupp = 0;
961 for (int i = 0; i < n; i++)
963 for (
int j = 0; j <
n_cols() && nsupp < n; j++)
964 for (vec v =
elem(j); v !=
nullptr && nsupp < n; v = v->next)
965 {
966 auto f = Q->
toPoly(v->coeff);
967 for (auto t = f->cbegin(); t != f->cend(); ++t)
968 {
970 for (
int k = 0; k <
exp2.size(); k++)
971 {
972 if (exp[exp2[k]] == 0)
973 {
975 if (++nsupp == n) break;
976 }
977 }
978 }
979 }
980
982 int next = 0;
983 for (int i = 0; i < n; i++)
984 if (exp[i] > 0)
result->array[next++] = i;
985
986
988 }
989
990 ERROR(
"expected a polynomial ring");
991 return nullptr;
992}
exponents::Exponents exponents_t
const FreeMonoid & monoid() const
void support(const Monom &m, std::vector< int > &result) const
const Poly * toPoly(const ring_elem f) const
virtual int n_vars() const =0
virtual const FreeAlgebra & freeAlgebra() const =0
const Ring * get_ring() const
ring_elem elem(int i, int j) const
void to_expvector(const_monomial m, exponents_t result_exp) const
virtual const Monoid * getMonoid() const
virtual const PolynomialRing * cast_to_PolynomialRing() const
VALGRIND_MAKE_MEM_DEFINED & result(result)
M2_arrayint M2_makearrayint(int n)
const mpreal exp2(const mpreal &x, mp_rnd_t r=mpreal::get_default_rnd())
const mpreal exp(const mpreal &x, mp_rnd_t r=mpreal::get_default_rnd())
#define newarray_atomic(T, len)