Macaulay2 Engine
Loading...
Searching...
No Matches

◆ support()

M2_arrayint FreeAlgebra::support ( const Poly & f) const

Definition at line 192 of file FreeAlgebra.cpp.

193{
194 int numVarsFound = 0;
195 std::vector<int> exp, exp2;
196 auto fIt = f.cbegin();
197 auto fEnd = f.cend();
198
199 for (auto i = 0; i < numVars(); i++)
200 exp2.push_back(0);
201
202 for ( ; fIt != fEnd; fIt++)
203 {
204 monoid().support(fIt.monom(),exp);
205 for (auto i : exp)
206 {
207 if (exp2[i] == 0)
208 {
209 exp2[i]++;
210 numVarsFound++;
211 }
212 }
213 if (numVarsFound == numVars()) break;
214 }
215
216 exp.clear();
217 for (int i = 0; i < numVars(); i++)
218 if (exp2[i] > 0) exp.push_back(i);
219
220 M2_arrayint result = M2_makearrayint(exp.size());
221 int next = 0;
222 for (auto i : exp)
223 result->array[next++] = i;
224 return result;
225}
int numVars() const
const FreeMonoid & monoid() const
void support(const Monom &m, std::vector< int > &result) const
MPREAL_MSVC_DEBUGVIEW_DATA void clear(::mpfr_ptr)
Definition mpreal.h:770
VALGRIND_MAKE_MEM_DEFINED & result(result)
M2_arrayint M2_makearrayint(int n)
Definition m2-types.cpp:6
const mpreal exp2(const mpreal &x, mp_rnd_t r=mpreal::get_default_rnd())
Definition mpreal.h:2299
const mpreal exp(const mpreal &x, mp_rnd_t r=mpreal::get_default_rnd())
Definition mpreal.h:2298

References mpfr::mpreal::clear(), M2_makearrayint(), monoid(), numVars(), result(), and FreeMonoid::support().

Referenced by M2FreeAlgebra::support().