#include "series.h"
#include "symbol.h"
+#ifndef NO_GINAC_NAMESPACE
namespace GiNaC {
+#endif // ndef NO_GINAC_NAMESPACE
// If comparing expressions (ex::compare()) is fast, you can set this to 1.
// Some routines like quo(), rem() and gcd() will then return a quick answer
numeric ex::integer_content(void) const
{
- ASSERT(bp!=0);
+ GINAC_ASSERT(bp!=0);
return bp->integer_content();
}
epvector::const_iterator itend = seq.end();
numeric c = numZERO();
while (it != itend) {
- ASSERT(!is_ex_exactly_of_type(it->rest,numeric));
- ASSERT(is_ex_exactly_of_type(it->coeff,numeric));
+ GINAC_ASSERT(!is_ex_exactly_of_type(it->rest,numeric));
+ GINAC_ASSERT(is_ex_exactly_of_type(it->coeff,numeric));
c = gcd(ex_to_numeric(it->coeff), c);
it++;
}
- ASSERT(is_ex_exactly_of_type(overall_coeff,numeric));
+ GINAC_ASSERT(is_ex_exactly_of_type(overall_coeff,numeric));
c = gcd(ex_to_numeric(overall_coeff),c);
return c;
}
numeric mul::integer_content(void) const
{
-#ifdef DOASSERT
+#ifdef DO_GINAC_ASSERT
epvector::const_iterator it = seq.begin();
epvector::const_iterator itend = seq.end();
while (it != itend) {
- ASSERT(!is_ex_exactly_of_type(recombine_pair_to_ex(*it),numeric));
+ GINAC_ASSERT(!is_ex_exactly_of_type(recombine_pair_to_ex(*it),numeric));
++it;
}
-#endif // def DOASSERT
- ASSERT(is_ex_exactly_of_type(overall_coeff,numeric));
+#endif // def DO_GINAC_ASSERT
+ GINAC_ASSERT(is_ex_exactly_of_type(overall_coeff,numeric));
return abs(ex_to_numeric(overall_coeff));
}
numeric ex::max_coefficient(void) const
{
- ASSERT(bp!=0);
+ GINAC_ASSERT(bp!=0);
return bp->max_coefficient();
}
{
epvector::const_iterator it = seq.begin();
epvector::const_iterator itend = seq.end();
- ASSERT(is_ex_exactly_of_type(overall_coeff,numeric));
+ GINAC_ASSERT(is_ex_exactly_of_type(overall_coeff,numeric));
numeric cur_max = abs(ex_to_numeric(overall_coeff));
while (it != itend) {
numeric a;
- ASSERT(!is_ex_exactly_of_type(it->rest,numeric));
+ GINAC_ASSERT(!is_ex_exactly_of_type(it->rest,numeric));
a = abs(ex_to_numeric(it->coeff));
if (a > cur_max)
cur_max = a;
numeric mul::max_coefficient(void) const
{
-#ifdef DOASSERT
+#ifdef DO_GINAC_ASSERT
epvector::const_iterator it = seq.begin();
epvector::const_iterator itend = seq.end();
while (it != itend) {
- ASSERT(!is_ex_exactly_of_type(recombine_pair_to_ex(*it),numeric));
+ GINAC_ASSERT(!is_ex_exactly_of_type(recombine_pair_to_ex(*it),numeric));
it++;
}
-#endif // def DOASSERT
- ASSERT(is_ex_exactly_of_type(overall_coeff,numeric));
+#endif // def DO_GINAC_ASSERT
+ GINAC_ASSERT(is_ex_exactly_of_type(overall_coeff,numeric));
return abs(ex_to_numeric(overall_coeff));
}
ex ex::smod(const numeric &xi) const
{
- ASSERT(bp!=0);
+ GINAC_ASSERT(bp!=0);
return bp->smod(xi);
}
ex numeric::smod(const numeric &xi) const
{
+#ifndef NO_GINAC_NAMESPACE
return GiNaC::smod(*this, xi);
+#else // ndef NO_GINAC_NAMESPACE
+ return ::smod(*this, xi);
+#endif // ndef NO_GINAC_NAMESPACE
}
ex add::smod(const numeric &xi) const
epvector::const_iterator it = seq.begin();
epvector::const_iterator itend = seq.end();
while (it != itend) {
- ASSERT(!is_ex_exactly_of_type(it->rest,numeric));
+ GINAC_ASSERT(!is_ex_exactly_of_type(it->rest,numeric));
+#ifndef NO_GINAC_NAMESPACE
numeric coeff = GiNaC::smod(ex_to_numeric(it->coeff), xi);
+#else // ndef NO_GINAC_NAMESPACE
+ numeric coeff = ::smod(ex_to_numeric(it->coeff), xi);
+#endif // ndef NO_GINAC_NAMESPACE
if (!coeff.is_zero())
newseq.push_back(expair(it->rest, coeff));
it++;
}
- ASSERT(is_ex_exactly_of_type(overall_coeff,numeric));
+ GINAC_ASSERT(is_ex_exactly_of_type(overall_coeff,numeric));
+#ifndef NO_GINAC_NAMESPACE
numeric coeff = GiNaC::smod(ex_to_numeric(overall_coeff), xi);
+#else // ndef NO_GINAC_NAMESPACE
+ numeric coeff = ::smod(ex_to_numeric(overall_coeff), xi);
+#endif // ndef NO_GINAC_NAMESPACE
return (new add(newseq,coeff))->setflag(status_flags::dynallocated);
}
ex mul::smod(const numeric &xi) const
{
-#ifdef DOASSERT
+#ifdef DO_GINAC_ASSERT
epvector::const_iterator it = seq.begin();
epvector::const_iterator itend = seq.end();
while (it != itend) {
- ASSERT(!is_ex_exactly_of_type(recombine_pair_to_ex(*it),numeric));
+ GINAC_ASSERT(!is_ex_exactly_of_type(recombine_pair_to_ex(*it),numeric));
it++;
}
-#endif // def DOASSERT
+#endif // def DO_GINAC_ASSERT
mul * mulcopyp=new mul(*this);
- ASSERT(is_ex_exactly_of_type(overall_coeff,numeric));
+ GINAC_ASSERT(is_ex_exactly_of_type(overall_coeff,numeric));
+#ifndef NO_GINAC_NAMESPACE
mulcopyp->overall_coeff = GiNaC::smod(ex_to_numeric(overall_coeff),xi);
+#else // ndef NO_GINAC_NAMESPACE
+ mulcopyp->overall_coeff = ::smod(ex_to_numeric(overall_coeff),xi);
+#endif // ndef NO_GINAC_NAMESPACE
mulcopyp->clearflag(status_flags::evaluated);
mulcopyp->clearflag(status_flags::hash_calculated);
return mulcopyp->setflag(status_flags::dynallocated);
}
-/** Exception thrown by heur_gcd() to signal failure */
+/** Exception thrown by heur_gcd() to signal failure. */
class gcdheu_failed {};
/** Compute GCD of multivariate polynomials using the heuristic GCD algorithm.
return e;
}
+#ifndef NO_GINAC_NAMESPACE
} // namespace GiNaC
+#endif // ndef NO_GINAC_NAMESPACE