From: Christian Bauer Date: Mon, 22 Nov 1999 19:44:58 +0000 (+0000) Subject: - ASSERT macro renamed to GINAC_ASSERT X-Git-Tag: release_0-5-0~138 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=24fe247f9ed16114a765a01c593fec5c4a2f591c - ASSERT macro renamed to GINAC_ASSERT --- diff --git a/ginac/add.cpp b/ginac/add.cpp index 0f25d2dc..6f5380cc 100644 --- a/ginac/add.cpp +++ b/ginac/add.cpp @@ -87,7 +87,7 @@ add::add(ex const & lh, ex const & rh) tinfo_key = TINFO_add; overall_coeff=exZERO(); construct_from_2_ex(lh,rh); - ASSERT(is_canonical()); + GINAC_ASSERT(is_canonical()); } add::add(exvector const & v) @@ -96,7 +96,7 @@ add::add(exvector const & v) tinfo_key = TINFO_add; overall_coeff=exZERO(); construct_from_exvector(v); - ASSERT(is_canonical()); + GINAC_ASSERT(is_canonical()); } /* @@ -112,7 +112,7 @@ add::add(epvector const & v, bool do_not_canonicalize) } else { construct_from_epvector(v); } - ASSERT(is_canonical()); + GINAC_ASSERT(is_canonical()); } */ @@ -122,7 +122,7 @@ add::add(epvector const & v) tinfo_key = TINFO_add; overall_coeff=exZERO(); construct_from_epvector(v); - ASSERT(is_canonical()); + GINAC_ASSERT(is_canonical()); } add::add(epvector const & v, ex const & oc) @@ -131,18 +131,18 @@ add::add(epvector const & v, ex const & oc) tinfo_key = TINFO_add; overall_coeff=oc; construct_from_epvector(v); - ASSERT(is_canonical()); + GINAC_ASSERT(is_canonical()); } add::add(epvector * vp, ex const & oc) { debugmsg("add constructor from epvector *,ex",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_add; - ASSERT(vp!=0); + GINAC_ASSERT(vp!=0); overall_coeff=oc; construct_from_epvector(*vp); delete vp; - ASSERT(is_canonical()); + GINAC_ASSERT(is_canonical()); } ////////// @@ -276,13 +276,13 @@ ex add::eval(int level) const debugmsg("add eval",LOGLEVEL_MEMBER_FUNCTION); if ((level==1)&&(flags & status_flags::evaluated)) { -#ifdef DOASSERT +#ifdef DO_GINAC_ASSERT for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) { - ASSERT(!is_ex_exactly_of_type((*cit).rest,add)); - ASSERT(!(is_ex_exactly_of_type((*cit).rest,numeric)&& + GINAC_ASSERT(!is_ex_exactly_of_type((*cit).rest,add)); + GINAC_ASSERT(!(is_ex_exactly_of_type((*cit).rest,numeric)&& (ex_to_numeric((*cit).coeff).compare(numONE())!=0))); } -#endif // def DOASSERT +#endif // def DO_GINAC_ASSERT return *this; } @@ -296,13 +296,13 @@ ex add::eval(int level) const return (new add(evaled_seqp))->setflag(status_flags::dynallocated); } -#ifdef DOASSERT +#ifdef DO_GINAC_ASSERT for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) { - ASSERT(!is_ex_exactly_of_type((*cit).rest,add)); - ASSERT(!(is_ex_exactly_of_type((*cit).rest,numeric)&& + GINAC_ASSERT(!is_ex_exactly_of_type((*cit).rest,add)); + GINAC_ASSERT(!(is_ex_exactly_of_type((*cit).rest,numeric)&& (ex_to_numeric((*cit).coeff).compare(numONE())!=0))); } -#endif // def DOASSERT +#endif // def DO_GINAC_ASSERT if (flags & status_flags::evaluated) { return *this; @@ -394,19 +394,19 @@ ex add::eval(int level) const setflag(status_flags::dynallocated); } -#ifdef DOASSERT +#ifdef DO_GINAC_ASSERT for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) { - ASSERT(!is_ex_exactly_of_type((*cit).rest,add)); + GINAC_ASSERT(!is_ex_exactly_of_type((*cit).rest,add)); if (is_ex_exactly_of_type((*cit).rest,numeric)) { dbgprint(); } - ASSERT(!is_ex_exactly_of_type((*cit).rest,numeric)); + GINAC_ASSERT(!is_ex_exactly_of_type((*cit).rest,numeric)); } -#endif // def DOASSERT +#endif // def DO_GINAC_ASSERT if (flags & status_flags::evaluated) { - ASSERT(seq.size()>0); - ASSERT((seq.size()>1)||!overall_coeff.is_equal(exZERO())); + GINAC_ASSERT(seq.size()>0); + GINAC_ASSERT((seq.size()>1)||!overall_coeff.is_equal(exZERO())); return *this; } @@ -483,7 +483,7 @@ expair add::split_ex_to_pair(ex const & e) const { if (is_ex_exactly_of_type(e,mul)) { mul const & mulref=ex_to_mul(e); - ASSERT(mulref.seq.size()>1); + GINAC_ASSERT(mulref.seq.size()>1); ex const & lastfactor_rest=(*(mulref.seq.end()-1)).rest; ex const & lastfactor_coeff=(*(mulref.seq.end()-1)).coeff; if (is_ex_exactly_of_type(lastfactor_rest,numeric) && @@ -528,10 +528,10 @@ expair add::split_ex_to_pair(ex const & e) const expair add::combine_ex_with_coeff_to_pair(ex const & e, ex const & c) const { - ASSERT(is_ex_exactly_of_type(c,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(c,numeric)); if (is_ex_exactly_of_type(e,mul)) { mul const & mulref=ex_to_mul(e); - ASSERT(mulref.seq.size()>1); + GINAC_ASSERT(mulref.seq.size()>1); ex const & lastfactor_rest=(*(mulref.seq.end()-1)).rest; ex const & lastfactor_coeff=(*(mulref.seq.end()-1)).coeff; if (is_ex_exactly_of_type(lastfactor_rest,numeric) && @@ -566,7 +566,7 @@ expair add::combine_ex_with_coeff_to_pair(ex const & e, expair add::combine_ex_with_coeff_to_pair(ex const & e, ex const & c) const { - ASSERT(is_ex_exactly_of_type(c,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(c,numeric)); if (is_ex_exactly_of_type(e,mul)) { mul const & mulref=ex_to_mul(e); ex numfactor=mulref.overall_coeff; @@ -594,11 +594,11 @@ expair add::combine_ex_with_coeff_to_pair(ex const & e, expair add::combine_pair_with_coeff_to_pair(expair const & p, ex const & c) const { - ASSERT(is_ex_exactly_of_type(p.coeff,numeric)); - ASSERT(is_ex_exactly_of_type(c,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(p.coeff,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(c,numeric)); if (is_ex_exactly_of_type(p.rest,numeric)) { - ASSERT(ex_to_numeric(p.coeff).is_equal(numONE())); // should be normalized + GINAC_ASSERT(ex_to_numeric(p.coeff).is_equal(numONE())); // should be normalized return expair(ex_to_numeric(p.rest).mul_dyn(ex_to_numeric(c)),exONE()); } diff --git a/ginac/assertion.h b/ginac/assertion.h index 39bb4f4e..b208b847 100644 --- a/ginac/assertion.h +++ b/ginac/assertion.h @@ -25,10 +25,12 @@ #include -#if defined(DO_GINAC_ASSERT) && !defined(ASSERT) -#define ASSERT(X) assert(X) +#if !defined(GINAC_ASSERT) +#if defined(DO_GINAC_ASSERT) +#define GINAC_ASSERT(X) assert(X) #else -#define ASSERT(X) ((void)0) +#define GINAC_ASSERT(X) ((void)0) +#endif #endif #endif // ndef __GINAC_ASSERTION_H__ diff --git a/ginac/basic.cpp b/ginac/basic.cpp index 1c8814d4..eb4a72e0 100644 --- a/ginac/basic.cpp +++ b/ginac/basic.cpp @@ -53,7 +53,7 @@ basic::~basic() { debugmsg("basic destructor",LOGLEVEL_DESTRUCT); destroy(0); - ASSERT((!(flags & status_flags::dynallocated))||(refcount==0)); + GINAC_ASSERT((!(flags & status_flags::dynallocated))||(refcount==0)); } basic::basic(basic const & other) : flags(0), refcount(0), tinfo_key(TINFO_BASIC) @@ -149,7 +149,7 @@ ex basic::operator[](int const i) const bool basic::has(ex const & other) const { - ASSERT(other.bp!=0); + GINAC_ASSERT(other.bp!=0); if (is_equal(*other.bp)) return true; if (nops()>0) { for (int i=0; i(&other); if (serial==o->serial) { return indexed::compare_same_type(other); diff --git a/ginac/color.cpp b/ginac/color.cpp index b59e4b4c..095a3b0c 100644 --- a/ginac/color.cpp +++ b/ginac/color.cpp @@ -96,54 +96,54 @@ void color::destroy(bool call_parent) color::color(color_types const t, unsigned const rl) : type(t), representation_label(rl) { debugmsg("color constructor from color_types,unsigned",LOGLEVEL_CONSTRUCT); - ASSERT(representation_label(&other); if (type==o->type) { if (representation_label==o->representation_label) { @@ -360,7 +360,7 @@ int color::compare_same_type(basic const & other) const bool color::is_equal_same_type(basic const & other) const { - ASSERT(other.tinfo() == TINFO_color); + GINAC_ASSERT(other.tinfo() == TINFO_color); const color *o = static_cast(&other); if (type!=o->type) return false; if (representation_label!=o->representation_label) return false; @@ -386,11 +386,11 @@ ex color::simplify_ncmul(exvector const & v) const // process only delta8 objects if (is_ex_exactly_of_type(*it,color) && (ex_to_color(*it).type==color_delta8)) { color & d8=ex_to_nonconst_color(*it); - ASSERT(d8.seq.size()==2); + GINAC_ASSERT(d8.seq.size()==2); coloridx const & first_idx=ex_to_coloridx(d8.seq[0]); coloridx const & second_idx=ex_to_coloridx(d8.seq[1]); // delta8_{a,a} should have been contracted in color::eval() - ASSERT((!first_idx.is_equal(second_idx))||(!first_idx.is_symbolic())); + GINAC_ASSERT((!first_idx.is_equal(second_idx))||(!first_idx.is_symbolic())); ex saved_delta8=*it; // save to restore it later // try to contract first index @@ -402,7 +402,7 @@ ex color::simplify_ncmul(exvector const & v) const *it=saved_delta8; } else { // a contracted index should occur exactly twice - ASSERT(replacements==2); + GINAC_ASSERT(replacements==2); *it=exONE(); something_changed=true; } @@ -417,7 +417,7 @@ ex color::simplify_ncmul(exvector const & v) const *it=saved_delta8; } else { // a contracted index should occur exactly twice - ASSERT(replacements==2); + GINAC_ASSERT(replacements==2); *it=exONE(); something_changed=true; } @@ -450,8 +450,8 @@ ex color::simplify_ncmul(exvector const & v) const if ((dvec.size()>=1)&&(fvec.size()>=1)) { for (exvector::iterator it1=dvec.begin(); it1!=dvec.end(); ++it1) { for (exvector::iterator it2=fvec.begin(); it2!=fvec.end(); ++it2) { - ASSERT(is_ex_exactly_of_type(*it1,color)); - ASSERT(is_ex_exactly_of_type(*it2,color)); + GINAC_ASSERT(is_ex_exactly_of_type(*it1,color)); + GINAC_ASSERT(is_ex_exactly_of_type(*it2,color)); color const & col1=ex_to_color(*it1); color const & col2=ex_to_color(*it2); exvector iv_intersect=idx_intersect(col1.seq,col2.seq); @@ -464,8 +464,8 @@ ex color::simplify_ncmul(exvector const & v) const if (dvec.size()>=2) { for (exvector::iterator it1=dvec.begin(); it1!=dvec.end()-1; ++it1) { for (exvector::iterator it2=it1+1; it2!=dvec.end(); ++it2) { - ASSERT(is_ex_exactly_of_type(*it1,color)); - ASSERT(is_ex_exactly_of_type(*it2,color)); + GINAC_ASSERT(is_ex_exactly_of_type(*it1,color)); + GINAC_ASSERT(is_ex_exactly_of_type(*it2,color)); color const & col1=ex_to_color(*it1); color const & col2=ex_to_color(*it2); exvector iv_intersect=idx_intersect(col1.seq,col2.seq); @@ -491,8 +491,8 @@ ex color::simplify_ncmul(exvector const & v) const if (fvec.size()>=2) { for (exvector::iterator it1=fvec.begin(); it1!=fvec.end()-1; ++it1) { for (exvector::iterator it2=it1+1; it2!=fvec.end(); ++it2) { - ASSERT(is_ex_exactly_of_type(*it1,color)); - ASSERT(is_ex_exactly_of_type(*it2,color)); + GINAC_ASSERT(is_ex_exactly_of_type(*it1,color)); + GINAC_ASSERT(is_ex_exactly_of_type(*it2,color)); color const & col1=ex_to_color(*it1); color const & col2=ex_to_color(*it2); exvector iv_intersect=idx_intersect(col1.seq,col2.seq); @@ -520,14 +520,14 @@ ex color::simplify_ncmul(exvector const & v) const if ((Tvecs[rl].size()>=2)&&((dvec.size()>=1)||(fvec.size()>=1))) { for (exvector::iterator it1=Tvecs[rl].begin(); it1!=Tvecs[rl].end()-1; ++it1) { exvector iv; - ASSERT(is_ex_exactly_of_type(*it1,color)&&ex_to_color(*it1).type==color_T); - ASSERT(is_ex_exactly_of_type(*(it1+1),color)&&ex_to_color(*(it1+1)).type==color_T); + GINAC_ASSERT(is_ex_exactly_of_type(*it1,color)&&ex_to_color(*it1).type==color_T); + GINAC_ASSERT(is_ex_exactly_of_type(*(it1+1),color)&&ex_to_color(*(it1+1)).type==color_T); iv.push_back(ex_to_color(*it1).seq[0]); iv.push_back(ex_to_color(*(it1+1)).seq[0]); // d_{a,b,c} T_b T_c = 5/6 T_a for (exvector::iterator it2=dvec.begin(); it2!=dvec.end(); ++it2) { - ASSERT(is_ex_exactly_of_type(*it2,color)&&ex_to_color(*it2).type==color_d); + GINAC_ASSERT(is_ex_exactly_of_type(*it2,color)&&ex_to_color(*it2).type==color_d); color const & dref=ex_to_color(*it2); exvector iv_intersect=idx_intersect(dref.seq,iv); if (iv_intersect.size()==2) { @@ -543,7 +543,7 @@ ex color::simplify_ncmul(exvector const & v) const // f_{a,b,c} T_b T_c = 3/2 I T_a for (exvector::iterator it2=fvec.begin(); it2!=fvec.end(); ++it2) { - ASSERT(is_ex_exactly_of_type(*it2,color)&&ex_to_color(*it2).type==color_f); + GINAC_ASSERT(is_ex_exactly_of_type(*it2,color)&&ex_to_color(*it2).type==color_f); color const & fref=ex_to_color(*it2); exvector iv_intersect=idx_intersect(fref.seq,iv); if (iv_intersect.size()==2) { @@ -681,7 +681,7 @@ void split_color_string_in_parts(exvector const & v, exvector & delta8vec, dvec.push_back(*cit); break; case color::color_T: - ASSERT(ex_to_color(*cit).representation_label(const_cast(other)); // return name.compare(o.name); const constant *o = static_cast(&other); @@ -127,7 +127,7 @@ int constant::compare_same_type(basic const & other) const bool constant::is_equal_same_type(basic const & other) const { - ASSERT(is_exactly_of_type(other, constant)); + GINAC_ASSERT(is_exactly_of_type(other, constant)); const constant *o = static_cast(&other); return serial==o->serial; } diff --git a/ginac/container.pl b/ginac/container.pl index 7a7b3e9d..798d6868 100755 --- a/ginac/container.pl +++ b/ginac/container.pl @@ -72,8 +72,8 @@ if ($let_op) { $LET_OP_IMPLEMENTATION=<=0); - ASSERT(i=0); + GINAC_ASSERT(i (const_cast(other)); int cmpval; @@ -624,7 +624,7 @@ int ${CONTAINER}::compare_same_type(basic const & other) const bool ${CONTAINER}::is_equal_same_type(basic const & other) const { - ASSERT(is_of_type(other,${CONTAINER})); + GINAC_ASSERT(is_of_type(other,${CONTAINER})); ${CONTAINER} const & o=static_cast<${CONTAINER} const &> (const_cast(other)); if (seq.size()!=o.seq.size()) return false; diff --git a/ginac/debugmsg.h b/ginac/debugmsg.h index 24d0f7e9..d7a77668 100644 --- a/ginac/debugmsg.h +++ b/ginac/debugmsg.h @@ -27,7 +27,7 @@ #ifdef _DEBUG #define VERBOSE -#define DOASSERT (VERBOSE||DEBUG) +#define DO_GINAC_ASSERT (VERBOSE||DEBUG) #endif #define LOGLEVEL_CONSTRUCT 0x0001 diff --git a/ginac/diff.cpp b/ginac/diff.cpp index 167d4939..7b4d489b 100644 --- a/ginac/diff.cpp +++ b/ginac/diff.cpp @@ -226,7 +226,7 @@ ex series::diff(symbol const & s) const ex ex::diff(symbol const & s, unsigned nth) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); if ( nth==0 ) { return *this; diff --git a/ginac/ex.cpp b/ginac/ex.cpp index e036af53..a5a2445c 100644 --- a/ginac/ex.cpp +++ b/ginac/ex.cpp @@ -43,17 +43,17 @@ namespace GiNaC { ex::ex() : bp(exZERO().bp) { debugmsg("ex default constructor",LOGLEVEL_CONSTRUCT); - ASSERT(exZERO().bp!=0); - ASSERT(exZERO().bp->flags & status_flags::dynallocated); - ASSERT(bp!=0); + GINAC_ASSERT(exZERO().bp!=0); + GINAC_ASSERT(exZERO().bp->flags & status_flags::dynallocated); + GINAC_ASSERT(bp!=0); ++bp->refcount; } ex::~ex() { debugmsg("ex destructor",LOGLEVEL_DESTRUCT); - ASSERT(bp!=0); - ASSERT(bp->flags & status_flags::dynallocated); + GINAC_ASSERT(bp!=0); + GINAC_ASSERT(bp->flags & status_flags::dynallocated); if (--bp->refcount == 0) { delete bp; } @@ -62,18 +62,18 @@ ex::~ex() ex::ex(ex const & other) : bp(other.bp) { debugmsg("ex copy constructor",LOGLEVEL_CONSTRUCT); - ASSERT(bp!=0); - ASSERT((bp->flags) & status_flags::dynallocated); + GINAC_ASSERT(bp!=0); + GINAC_ASSERT((bp->flags) & status_flags::dynallocated); ++bp->refcount; } ex const & ex::operator=(ex const & other) { debugmsg("ex operator=",LOGLEVEL_ASSIGNMENT); - ASSERT(bp!=0); - ASSERT(bp->flags & status_flags::dynallocated); - ASSERT(other.bp!=0); - ASSERT(other.bp->flags & status_flags::dynallocated); + GINAC_ASSERT(bp!=0); + GINAC_ASSERT(bp->flags & status_flags::dynallocated); + GINAC_ASSERT(other.bp!=0); + GINAC_ASSERT(other.bp->flags & status_flags::dynallocated); ++other.bp->refcount; basic * tmpbp=other.bp; if (--bp->refcount==0) { @@ -151,10 +151,10 @@ void ex::swap(ex & other) { debugmsg("ex swap",LOGLEVEL_MEMBER_FUNCTION); - ASSERT(bp!=0); - ASSERT(bp->flags & status_flags::dynallocated); - ASSERT(other.bp!=0); - ASSERT(other.bp->flags & status_flags::dynallocated); + GINAC_ASSERT(bp!=0); + GINAC_ASSERT(bp->flags & status_flags::dynallocated); + GINAC_ASSERT(other.bp!=0); + GINAC_ASSERT(other.bp->flags & status_flags::dynallocated); basic * tmpbp=bp; bp=other.bp; @@ -194,37 +194,37 @@ bool ex::info(unsigned inf) const int ex::nops() const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->nops(); } ex ex::expand(unsigned options) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->expand(options); } bool ex::has(ex const & other) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->has(other); } int ex::degree(symbol const & s) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->degree(s); } int ex::ldegree(symbol const & s) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->ldegree(s); } ex ex::coeff(symbol const & s, int const n) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->coeff(s,n); } @@ -284,64 +284,64 @@ ex ex::denom(bool normalize) const ex ex::collect(symbol const & s) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->collect(s); } ex ex::eval(int level) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->eval(level); } ex ex::evalf(int level) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->evalf(level); } ex ex::subs(lst const & ls, lst const & lr) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->subs(ls,lr); } ex ex::subs(ex const & e) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->subs(e); } exvector ex::get_indices(void) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->get_indices(); } ex ex::simplify_ncmul(exvector const & v) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->simplify_ncmul(v); } ex ex::operator[](ex const & index) const { debugmsg("ex operator[ex]",LOGLEVEL_OPERATOR); - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return (*bp)[index]; } ex ex::operator[](int const i) const { debugmsg("ex operator[int]",LOGLEVEL_OPERATOR); - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return (*bp)[i]; } ex ex::op(int const i) const { debugmsg("ex op()",LOGLEVEL_MEMBER_FUNCTION); - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->op(i); } @@ -349,15 +349,15 @@ ex & ex::let_op(int const i) { debugmsg("ex let_op()",LOGLEVEL_MEMBER_FUNCTION); makewriteable(); - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->let_op(i); } #ifndef INLINE_EX_CONSTRUCTORS int ex::compare(ex const & other) const { - ASSERT(bp!=0); - ASSERT(other.bp!=0); + GINAC_ASSERT(bp!=0); + GINAC_ASSERT(other.bp!=0); if (bp==other.bp) { // special case: both expression point to same basic, trivially equal return 0; @@ -369,8 +369,8 @@ int ex::compare(ex const & other) const #ifndef INLINE_EX_CONSTRUCTORS bool ex::is_equal(ex const & other) const { - ASSERT(bp!=0); - ASSERT(other.bp!=0); + GINAC_ASSERT(bp!=0); + GINAC_ASSERT(other.bp!=0); if (bp==other.bp) { // special case: both expression point to same basic, trivially equal return true; @@ -381,19 +381,19 @@ bool ex::is_equal(ex const & other) const unsigned ex::return_type(void) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->return_type(); } unsigned ex::return_type_tinfo(void) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->return_type_tinfo(); } unsigned ex::gethash(void) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->gethash(); } @@ -417,8 +417,8 @@ ex ex::exncmul(ex const & rh) const void ex::makewriteable() { debugmsg("ex makewriteable",LOGLEVEL_MEMBER_FUNCTION); - ASSERT(bp!=0); - ASSERT(bp->flags & status_flags::dynallocated); + GINAC_ASSERT(bp!=0); + GINAC_ASSERT(bp->flags & status_flags::dynallocated); if (bp->refcount > 1) { basic * bp2=bp->duplicate(); ++bp2->refcount; @@ -426,7 +426,7 @@ void ex::makewriteable() --bp->refcount; bp=bp2; } - ASSERT(bp->refcount == 1); + GINAC_ASSERT(bp->refcount == 1); } void ex::construct_from_basic(basic const & other) @@ -435,8 +435,8 @@ void ex::construct_from_basic(basic const & other) // cf. copy constructor ex const & tmpex = other.eval(1); // evaluate only one (top) level bp = tmpex.bp; - ASSERT(bp!=0); - ASSERT(bp->flags & status_flags::dynallocated); + GINAC_ASSERT(bp!=0); + GINAC_ASSERT(bp->flags & status_flags::dynallocated); ++bp->refcount; if ((other.flags & status_flags::dynallocated)&&(other.refcount==0)) { delete &const_cast(other); @@ -448,12 +448,12 @@ void ex::construct_from_basic(basic const & other) bp=other.duplicate(); bp->setflag(status_flags::dynallocated); } - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); // bp->clearflag(status_flags::evaluated); ++bp->refcount; } - ASSERT(bp!=0); - ASSERT(bp->flags & status_flags::dynallocated); + GINAC_ASSERT(bp!=0); + GINAC_ASSERT(bp->flags & status_flags::dynallocated); } ////////// diff --git a/ginac/ex.h b/ginac/ex.h index 0de91a17..a2517a50 100644 --- a/ginac/ex.h +++ b/ginac/ex.h @@ -65,9 +65,9 @@ public: #ifdef INLINE_EX_CONSTRUCTORS : bp(exZERO().bp) { - ASSERT(exZERO().bp!=0); - ASSERT(exZERO().bp->flags & status_flags::dynallocated); - ASSERT(bp!=0); + GINAC_ASSERT(exZERO().bp!=0); + GINAC_ASSERT(exZERO().bp->flags & status_flags::dynallocated); + GINAC_ASSERT(bp!=0); ++bp->refcount; } #else @@ -77,8 +77,8 @@ public: ~ex() #ifdef INLINE_EX_CONSTRUCTORS { - ASSERT(bp!=0); - ASSERT(bp->flags & status_flags::dynallocated); + GINAC_ASSERT(bp!=0); + GINAC_ASSERT(bp->flags & status_flags::dynallocated); if (--bp->refcount == 0) { delete bp; } @@ -91,8 +91,8 @@ public: #ifdef INLINE_EX_CONSTRUCTORS : bp(other.bp) { - ASSERT(bp!=0); - ASSERT((bp->flags) & status_flags::dynallocated); + GINAC_ASSERT(bp!=0); + GINAC_ASSERT((bp->flags) & status_flags::dynallocated); ++bp->refcount; } #else @@ -102,10 +102,10 @@ public: ex const & operator=(ex const & other) #ifdef INLINE_EX_CONSTRUCTORS { - ASSERT(bp!=0); - ASSERT(bp->flags & status_flags::dynallocated); - ASSERT(other.bp!=0); - ASSERT(other.bp->flags & status_flags::dynallocated); + GINAC_ASSERT(bp!=0); + GINAC_ASSERT(bp->flags & status_flags::dynallocated); + GINAC_ASSERT(other.bp!=0); + GINAC_ASSERT(other.bp->flags & status_flags::dynallocated); ++other.bp->refcount; basic * tmpbp=other.bp; if (--bp->refcount==0) { @@ -185,8 +185,8 @@ public: int compare(ex const & other) const #ifdef INLINE_EX_CONSTRUCTORS { - ASSERT(bp!=0); - ASSERT(other.bp!=0); + GINAC_ASSERT(bp!=0); + GINAC_ASSERT(other.bp!=0); if (bp==other.bp) { // special case: both expression point to same basic, trivially equal return 0; @@ -199,8 +199,8 @@ public: bool is_equal(ex const & other) const #ifdef INLINE_EX_CONSTRUCTORS { - ASSERT(bp!=0); - ASSERT(other.bp!=0); + GINAC_ASSERT(bp!=0); + GINAC_ASSERT(other.bp!=0); if (bp==other.bp) { // special case: both expression point to same basic, trivially equal return true; diff --git a/ginac/expair.h b/ginac/expair.h index 0a986775..320de73e 100644 --- a/ginac/expair.h +++ b/ginac/expair.h @@ -38,7 +38,7 @@ public: ~expair() {} expair(expair const & other) : rest(other.rest), coeff(other.coeff) { - ASSERT(is_ex_exactly_of_type(coeff,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(coeff,numeric)); } expair const & operator=(expair const & other) { @@ -50,12 +50,12 @@ public: } expair(ex const & r, ex const & c) : rest(r), coeff(c) { - ASSERT(is_ex_exactly_of_type(coeff,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(coeff,numeric)); } bool is_numeric_with_coeff_1(void) const { - ASSERT(is_ex_exactly_of_type(coeff,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(coeff,numeric)); return is_ex_exactly_of_type(rest,numeric) && (ex_to_numeric(coeff).compare(numONE())==0); } diff --git a/ginac/expairseq.cpp b/ginac/expairseq.cpp index 05b7233d..360c7b97 100644 --- a/ginac/expairseq.cpp +++ b/ginac/expairseq.cpp @@ -105,14 +105,14 @@ expairseq::expairseq(ex const & lh, ex const & rh) : basic(TINFO_expairseq) { debugmsg("expairseq constructor from ex,ex",LOGLEVEL_CONSTRUCT); construct_from_2_ex(lh,rh); - ASSERT(is_canonical()); + GINAC_ASSERT(is_canonical()); } expairseq::expairseq(exvector const & v) : basic(TINFO_expairseq) { debugmsg("expairseq constructor from exvector",LOGLEVEL_CONSTRUCT); construct_from_exvector(v); - ASSERT(is_canonical()); + GINAC_ASSERT(is_canonical()); } /* @@ -128,7 +128,7 @@ expairseq::expairseq(epvector const & v, bool do_not_canonicalize) : } else { construct_from_epvector(v); } - ASSERT(is_canonical()); + GINAC_ASSERT(is_canonical()); } */ @@ -137,17 +137,17 @@ expairseq::expairseq(epvector const & v, ex const & oc) : { debugmsg("expairseq constructor from epvector,ex",LOGLEVEL_CONSTRUCT); construct_from_epvector(v); - ASSERT(is_canonical()); + GINAC_ASSERT(is_canonical()); } expairseq::expairseq(epvector * vp, ex const & oc) : basic(TINFO_expairseq), overall_coeff(oc) { debugmsg("expairseq constructor from epvector *,ex",LOGLEVEL_CONSTRUCT); - ASSERT(vp!=0); + GINAC_ASSERT(vp!=0); construct_from_epvector(*vp); delete vp; - ASSERT(is_canonical()); + GINAC_ASSERT(is_canonical()); } ////////// @@ -180,7 +180,7 @@ ex expairseq::op(int const i) const if (unsigned(i)(const_cast(other)); int cmpval; @@ -246,7 +246,7 @@ int expairseq::compare_same_type(basic const & other) const //if (seq.size()==0) return 0; // empty expairseq's are equal #ifdef EXPAIRSEQ_USE_HASHTAB - ASSERT(hashtabsize==o.hashtabsize); + GINAC_ASSERT(hashtabsize==o.hashtabsize); if (hashtabsize==0) { #endif // def EXPAIRSEQ_USE_HASHTAB epvector::const_iterator cit1=seq.begin(); @@ -259,8 +259,8 @@ int expairseq::compare_same_type(basic const & other) const if (cmpval!=0) return cmpval; } - ASSERT(cit1==last1); - ASSERT(cit2==last2); + GINAC_ASSERT(cit1==last1); + GINAC_ASSERT(cit2==last2); return 0; #ifdef EXPAIRSEQ_USE_HASHTAB @@ -314,7 +314,7 @@ bool expairseq::is_equal_same_type(basic const & other) const other.printtree(cout,0); } - ASSERT(hashtabsize==o.hashtabsize); + GINAC_ASSERT(hashtabsize==o.hashtabsize); if (hashtabsize==0) { #endif // def EXPAIRSEQ_USE_HASHTAB @@ -417,7 +417,7 @@ expair expairseq::split_ex_to_pair(ex const & e) const expair expairseq::combine_ex_with_coeff_to_pair(ex const & e, ex const & c) const { - ASSERT(is_ex_exactly_of_type(c,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(c,numeric)); return expair(e,c); } @@ -425,8 +425,8 @@ expair expairseq::combine_ex_with_coeff_to_pair(ex const & e, expair expairseq::combine_pair_with_coeff_to_pair(expair const & p, ex const & c) const { - ASSERT(is_ex_exactly_of_type(p.coeff,numeric)); - ASSERT(is_ex_exactly_of_type(c,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(p.coeff,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(c,numeric)); return expair(p.rest,ex_to_numeric(p.coeff).mul_dyn(ex_to_numeric(c))); } @@ -448,16 +448,16 @@ ex expairseq::default_overall_coeff(void) const void expairseq::combine_overall_coeff(ex const & c) { - ASSERT(is_ex_exactly_of_type(overall_coeff,numeric)); - ASSERT(is_ex_exactly_of_type(c,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(overall_coeff,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(c,numeric)); overall_coeff = ex_to_numeric(overall_coeff).add_dyn(ex_to_numeric(c)); } void expairseq::combine_overall_coeff(ex const & c1, ex const & c2) { - ASSERT(is_ex_exactly_of_type(overall_coeff,numeric)); - ASSERT(is_ex_exactly_of_type(c1,numeric)); - ASSERT(is_ex_exactly_of_type(c2,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(overall_coeff,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(c1,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(c2,numeric)); overall_coeff = ex_to_numeric(overall_coeff). add_dyn(ex_to_numeric(c1).mul(ex_to_numeric(c2))); } @@ -480,8 +480,8 @@ void expairseq::construct_from_2_ex_via_exvector(ex const & lh, ex const & rh) v.push_back(rh); construct_from_exvector(v); #ifdef EXPAIRSEQ_USE_HASHTAB - ASSERT((hashtabsize==0)||(hashtabsize>=minhashtabsize)); - ASSERT(hashtabsize==calc_hashtabsize(seq.size())); + GINAC_ASSERT((hashtabsize==0)||(hashtabsize>=minhashtabsize)); + GINAC_ASSERT(hashtabsize==calc_hashtabsize(seq.size())); #endif // def EXPAIRSEQ_USE_HASHTAB } @@ -1008,9 +1008,9 @@ unsigned expairseq::calc_hashtabsize(unsigned sz) const // size=nearest_power_of_2*hashtabfactor; size=nearest_power_of_2/hashtabfactor; if (size=0); - ASSERT((hashindex=0); + GINAC_ASSERT((hashindex (const_cast(other)); int cmpval; @@ -392,7 +392,7 @@ int exprseq::compare_same_type(basic const & other) const bool exprseq::is_equal_same_type(basic const & other) const { - ASSERT(is_of_type(other,exprseq)); + GINAC_ASSERT(is_of_type(other,exprseq)); exprseq const & o=static_cast (const_cast(other)); if (seq.size()!=o.seq.size()) return false; diff --git a/ginac/exprseq_suppl.cpp b/ginac/exprseq_suppl.cpp index 5e96830d..8ac31b8b 100644 --- a/ginac/exprseq_suppl.cpp +++ b/ginac/exprseq_suppl.cpp @@ -34,8 +34,8 @@ bool exprseq::info(unsigned inf) const ex & exprseq::let_op(int const i) { - ASSERT(i>=0); - ASSERT(i=0); + GINAC_ASSERT(i(const_cast(other)); if (serial!=o.serial) { @@ -425,7 +425,7 @@ int function::compare_same_type(basic const & other) const bool function::is_equal_same_type(basic const & other) const { - ASSERT(is_of_type(other, function)); + GINAC_ASSERT(is_of_type(other, function)); function const & o=static_cast(const_cast(other)); if (serial!=o.serial) return false; @@ -462,7 +462,7 @@ unsigned function::return_type_tinfo(void) const ex function::pdiff(unsigned diff_param) const // partial differentiation { - ASSERT(serial(const_cast(other)); if (serial!=o.serial) { @@ -563,7 +563,7 @@ int function::compare_same_type(basic const & other) const bool function::is_equal_same_type(basic const & other) const { - ASSERT(is_of_type(other, function)); + GINAC_ASSERT(is_of_type(other, function)); function const & o=static_cast(const_cast(other)); if (serial!=o.serial) return false; @@ -600,7 +600,7 @@ unsigned function::return_type_tinfo(void) const ex function::pdiff(unsigned diff_param) const // partial differentiation { - ASSERT(serial (const_cast(other)); @@ -248,7 +248,7 @@ int idx::compare_same_type(basic const & other) const bool idx::is_equal_same_type(basic const & other) const { - ASSERT(is_of_type(other,idx)); + GINAC_ASSERT(is_of_type(other,idx)); idx const & o=static_cast (const_cast(other)); @@ -274,7 +274,7 @@ unsigned idx::calchash(void) const bool idx::is_co_contra_pair(basic const & other) const { // like is_equal_same_type(), but tests for different covariant status - ASSERT(is_of_type(other,idx)); + GINAC_ASSERT(is_of_type(other,idx)); idx const & o=static_cast (const_cast(other)); @@ -366,10 +366,10 @@ exvector idx_intersect(exvector const & iv1, exvector const & iv2) // assumes (but does not test) that each index occurs at most twice exvector iv_intersect; for (exvector::const_iterator cit1=iv1.begin(); cit1!=iv1.end(); ++cit1) { - ASSERT(is_ex_of_type(*cit1,idx)); + GINAC_ASSERT(is_ex_of_type(*cit1,idx)); if (ex_to_idx(*cit1).is_symbolic()) { for (exvector::const_iterator cit2=iv2.begin(); cit2!=iv2.end(); ++cit2) { - ASSERT(is_ex_of_type(*cit2,idx)); + GINAC_ASSERT(is_ex_of_type(*cit2,idx)); if ((*cit1).is_equal(*cit2)) { iv_intersect.push_back(*cit1); break; @@ -392,8 +392,8 @@ ex permute_free_index_to_front(exvector const & iv3, exvector const & iv2, // match (return value,iv2) to iv3 by permuting indices // iv3 is always cyclic - ASSERT(iv3.size()==3); - ASSERT(iv2.size()==2); + GINAC_ASSERT(iv3.size()==3); + GINAC_ASSERT(iv2.size()==2); *sig=1; @@ -412,8 +412,8 @@ unsigned subs_index_in_exvector(exvector & v, ex const & is, ex const & ir) unsigned replacements=0; unsigned current_replacements; - ASSERT(is_ex_of_type(is,idx)); - ASSERT(is_ex_of_type(ir,idx)); + GINAC_ASSERT(is_ex_of_type(is,idx)); + GINAC_ASSERT(is_ex_of_type(ir,idx)); for (it=v.begin(); it!=v.end(); ++it) { current_replacements=count_index(*it,is); @@ -438,7 +438,7 @@ unsigned count_index(ex const & e, ex const & i) ex subs_indices(ex const & e, exvector const & idxv_subs, exvector const & idxv_repl) { - ASSERT(idxv_subs.size()==idxv_repl.size()); + GINAC_ASSERT(idxv_subs.size()==idxv_repl.size()); ex res=e; for (unsigned i=0; i(&other); if (serial==o->serial) { return indexed::compare_same_type(other); diff --git a/ginac/lorentzidx.cpp b/ginac/lorentzidx.cpp index 3e69d30d..6d09ee1f 100644 --- a/ginac/lorentzidx.cpp +++ b/ginac/lorentzidx.cpp @@ -228,7 +228,7 @@ bool lorentzidx::info(unsigned inf) const lorentzidx lorentzidx::create_anonymous_representative(void) const { - ASSERT(is_symbolic()); + GINAC_ASSERT(is_symbolic()); lorentzidx i_copy(*this); i_copy.serial=0; i_copy.name="anonymous_representative"; diff --git a/ginac/lst.cpp b/ginac/lst.cpp index a71f5dda..227835f2 100644 --- a/ginac/lst.cpp +++ b/ginac/lst.cpp @@ -108,7 +108,7 @@ lst::lst(exlist const & s, bool discardable) : basic(TINFO_lst) lst::lst(exlist * vp) : basic(TINFO_lst) { debugmsg("lst constructor from exlist *",LOGLEVEL_CONSTRUCT); - ASSERT(vp!=0); + GINAC_ASSERT(vp!=0); seq.swap(*vp); delete vp; } @@ -308,8 +308,8 @@ int lst::nops() const ex & lst::let_op(int const i) { - ASSERT(i>=0); - ASSERT(i=0); + GINAC_ASSERT(i (const_cast(other)); int cmpval; @@ -403,7 +403,7 @@ int lst::compare_same_type(basic const & other) const bool lst::is_equal_same_type(basic const & other) const { - ASSERT(is_of_type(other,lst)); + GINAC_ASSERT(is_of_type(other,lst)); lst const & o=static_cast (const_cast(other)); if (seq.size()!=o.seq.size()) return false; diff --git a/ginac/matrix.cpp b/ginac/matrix.cpp index 3fd31fcb..bacacad8 100644 --- a/ginac/matrix.cpp +++ b/ginac/matrix.cpp @@ -143,7 +143,7 @@ ex matrix::expand(unsigned options) const * itself or one of the elements 'has' it. */ bool matrix::has(ex const & other) const { - ASSERT(other.bp!=0); + GINAC_ASSERT(other.bp!=0); // tautology: it is the expression itself if (is_equal(*other.bp)) return true; @@ -213,7 +213,7 @@ ex matrix::evalf(int level) const int matrix::compare_same_type(basic const & other) const { - ASSERT(is_exactly_of_type(other, matrix)); + GINAC_ASSERT(is_exactly_of_type(other, matrix)); matrix const & o=static_cast(const_cast(other)); // compare number of rows @@ -350,7 +350,7 @@ matrix matrix::transpose(void) const * called internally by matrix::determinant(). */ ex determinant_numeric(const matrix & M) { - ASSERT(M.rows()==M.cols()); // cannot happen, just in case... + GINAC_ASSERT(M.rows()==M.cols()); // cannot happen, just in case... matrix tmp(M); ex det=exONE(); ex piv; @@ -399,7 +399,7 @@ int permutation_sign(vector s) * routine is only called internally by matrix::determinant(). */ ex determinant_symbolic_perm(const matrix & M) { - ASSERT(M.rows()==M.cols()); // cannot happen, just in case... + GINAC_ASSERT(M.rows()==M.cols()); // cannot happen, just in case... if (M.rows()==1) { // speed things up return M(0,0); @@ -424,7 +424,7 @@ ex determinant_symbolic_perm(const matrix & M) * called internally by matrix::determinant(). */ ex determinant_symbolic_minor(const matrix & M) { - ASSERT(M.rows()==M.cols()); // cannot happen, just in case... + GINAC_ASSERT(M.rows()==M.cols()); // cannot happen, just in case... if (M.rows()==1) { // end of recursion return M(0,0); @@ -468,7 +468,7 @@ ex determinant_symbolic_minor(const matrix & M) * that are very hard to canonicalize. */ /*ex determinant_symbolic_leverrier(const matrix & M) *{ - * ASSERT(M.rows()==M.cols()); // cannot happen, just in case... + * GINAC_ASSERT(M.rows()==M.cols()); // cannot happen, just in case... * * matrix B(M); * matrix I(M.row, M.col); @@ -690,7 +690,7 @@ matrix matrix::fraction_free_elim(matrix const & vars, } */ -#ifdef DOASSERT +#ifdef DO_GINAC_ASSERT // test if we really have an upper echelon matrix int zero_in_last_row=-1; for (int r=1; r<=m; ++r) { @@ -702,10 +702,10 @@ matrix matrix::fraction_free_elim(matrix const & vars, break; } } - ASSERT((zero_in_this_row>zero_in_last_row)||(zero_in_this_row=n)); + GINAC_ASSERT((zero_in_this_row>zero_in_last_row)||(zero_in_this_row=n)); zero_in_last_row=zero_in_this_row; } -#endif // def DOASSERT +#endif // def DO_GINAC_ASSERT // assemble solution matrix sol(n,1); @@ -747,7 +747,7 @@ matrix matrix::fraction_free_elim(matrix const & vars, } */ -#ifdef DOASSERT +#ifdef DO_GINAC_ASSERT // test solution with echelon matrix for (int r=1; r<=m; ++r) { ex e=0; @@ -759,7 +759,7 @@ matrix matrix::fraction_free_elim(matrix const & vars, cout << "b.ffe_get(" << r<<",1)=" << b.ffe_get(r,1) << endl; cout << "diff=" << (e-b.ffe_get(r,1)).normal() << endl; } - ASSERT((e-b.ffe_get(r,1)).normal().is_zero()); + GINAC_ASSERT((e-b.ffe_get(r,1)).normal().is_zero()); } // test solution with original matrix @@ -782,9 +782,9 @@ matrix matrix::fraction_free_elim(matrix const & vars, ex xxx=e-rhs.ffe_get(r,1); cerr << "xxx=" << xxx << endl << endl; } - ASSERT((e-rhs.ffe_get(r,1)).normal().is_zero()); + GINAC_ASSERT((e-rhs.ffe_get(r,1)).normal().is_zero()); } -#endif // def DOASSERT +#endif // def DO_GINAC_ASSERT return sol; } diff --git a/ginac/mul.cpp b/ginac/mul.cpp index 5054fb06..78f2bd9e 100644 --- a/ginac/mul.cpp +++ b/ginac/mul.cpp @@ -88,7 +88,7 @@ mul::mul(ex const & lh, ex const & rh) tinfo_key = TINFO_mul; overall_coeff=exONE(); construct_from_2_ex(lh,rh); - ASSERT(is_canonical()); + GINAC_ASSERT(is_canonical()); } mul::mul(exvector const & v) @@ -97,7 +97,7 @@ mul::mul(exvector const & v) tinfo_key = TINFO_mul; overall_coeff=exONE(); construct_from_exvector(v); - ASSERT(is_canonical()); + GINAC_ASSERT(is_canonical()); } /* @@ -113,7 +113,7 @@ mul::mul(epvector const & v, bool do_not_canonicalize) } else { construct_from_epvector(v); } - ASSERT(is_canonical()); + GINAC_ASSERT(is_canonical()); } */ @@ -123,7 +123,7 @@ mul::mul(epvector const & v) tinfo_key = TINFO_mul; overall_coeff=exONE(); construct_from_epvector(v); - ASSERT(is_canonical()); + GINAC_ASSERT(is_canonical()); } mul::mul(epvector const & v, ex const & oc) @@ -132,18 +132,18 @@ mul::mul(epvector const & v, ex const & oc) tinfo_key = TINFO_mul; overall_coeff=oc; construct_from_epvector(v); - ASSERT(is_canonical()); + GINAC_ASSERT(is_canonical()); } mul::mul(epvector * vp, ex const & oc) { debugmsg("mul constructor from epvector *,ex",LOGLEVEL_CONSTRUCT); tinfo_key = TINFO_mul; - ASSERT(vp!=0); + GINAC_ASSERT(vp!=0); overall_coeff=oc; construct_from_epvector(*vp); delete vp; - ASSERT(is_canonical()); + GINAC_ASSERT(is_canonical()); } mul::mul(ex const & lh, ex const & mh, ex const & rh) @@ -157,7 +157,7 @@ mul::mul(ex const & lh, ex const & mh, ex const & rh) factors.push_back(rh); overall_coeff=exONE(); construct_from_exvector(factors); - ASSERT(is_canonical()); + GINAC_ASSERT(is_canonical()); } ////////// @@ -257,9 +257,9 @@ ex mul::eval(int level) const debugmsg("mul eval",LOGLEVEL_MEMBER_FUNCTION); if ((level==1)&&(flags & status_flags::evaluated)) { -#ifdef DOASSERT +#ifdef DO_GINAC_ASSERT for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) { - ASSERT((!is_ex_exactly_of_type((*cit).rest,mul))|| + GINAC_ASSERT((!is_ex_exactly_of_type((*cit).rest,mul))|| (!(ex_to_numeric((*cit).coeff).is_integer()))); } @@ -272,9 +272,9 @@ ex mul::eval(int level) const do { cit--; if (is_ex_exactly_of_type((*cit).rest,numeric)) { - ASSERT(all_numeric); + GINAC_ASSERT(all_numeric); if ((*cit).coeff.is_equal(exONE())) { - ASSERT(all_coeff_1); + GINAC_ASSERT(all_coeff_1); } else { all_coeff_1=false; } @@ -283,7 +283,7 @@ ex mul::eval(int level) const } } while (cit!=seq.begin()); } -#endif // def DOASSERT +#endif // def DO_GINAC_ASSERT return *this; } @@ -321,9 +321,9 @@ ex mul::eval(int level) const } -#ifdef DOASSERT +#ifdef DO_GINAC_ASSERT for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) { - ASSERT((!is_ex_exactly_of_type((*cit).rest,mul))|| + GINAC_ASSERT((!is_ex_exactly_of_type((*cit).rest,mul))|| (!(ex_to_numeric((*cit).coeff).is_integer()))); } @@ -336,9 +336,9 @@ ex mul::eval(int level) const do { cit--; if (is_ex_exactly_of_type((*cit).rest,numeric)) { - ASSERT(all_numeric); + GINAC_ASSERT(all_numeric); if ((*cit).coeff.is_equal(exONE())) { - ASSERT(all_coeff_1); + GINAC_ASSERT(all_coeff_1); } else { all_coeff_1=false; } @@ -347,7 +347,7 @@ ex mul::eval(int level) const } } while (cit!=seq.begin()); } -#endif // def DOASSERT +#endif // def DO_GINAC_ASSERT if (flags & status_flags::evaluated) { return *this; @@ -481,26 +481,26 @@ ex mul::eval(int level) const setflag(status_flags::dynallocated); } -#ifdef DOASSERT +#ifdef DO_GINAC_ASSERT for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) { - ASSERT((!is_ex_exactly_of_type((*cit).rest,mul))|| + GINAC_ASSERT((!is_ex_exactly_of_type((*cit).rest,mul))|| (!(ex_to_numeric((*cit).coeff).is_integer()))); - ASSERT(!((*cit).is_numeric_with_coeff_1())); + GINAC_ASSERT(!((*cit).is_numeric_with_coeff_1())); if (is_ex_exactly_of_type(recombine_pair_to_ex(*cit),numeric)) { printtree(cerr,0); } - ASSERT(!is_ex_exactly_of_type(recombine_pair_to_ex(*cit),numeric)); + GINAC_ASSERT(!is_ex_exactly_of_type(recombine_pair_to_ex(*cit),numeric)); /* for paranoia */ expair p=split_ex_to_pair(recombine_pair_to_ex(*cit)); - ASSERT(p.rest.is_equal((*cit).rest)); - ASSERT(p.coeff.is_equal((*cit).coeff)); + GINAC_ASSERT(p.rest.is_equal((*cit).rest)); + GINAC_ASSERT(p.coeff.is_equal((*cit).coeff)); /* end paranoia */ } -#endif // def DOASSERT +#endif // def DO_GINAC_ASSERT if (flags & status_flags::evaluated) { - ASSERT(seq.size()>0); - ASSERT((seq.size()>1)||!overall_coeff.is_equal(exONE())); + GINAC_ASSERT(seq.size()>0); + GINAC_ASSERT((seq.size()>1)||!overall_coeff.is_equal(exONE())); return *this; } @@ -773,23 +773,23 @@ ex mul::default_overall_coeff(void) const void mul::combine_overall_coeff(ex const & c) { - ASSERT(is_ex_exactly_of_type(overall_coeff,numeric)); - ASSERT(is_ex_exactly_of_type(c,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(overall_coeff,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(c,numeric)); overall_coeff = ex_to_numeric(overall_coeff).mul_dyn(ex_to_numeric(c)); } void mul::combine_overall_coeff(ex const & c1, ex const & c2) { - ASSERT(is_ex_exactly_of_type(overall_coeff,numeric)); - ASSERT(is_ex_exactly_of_type(c1,numeric)); - ASSERT(is_ex_exactly_of_type(c2,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(overall_coeff,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(c1,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(c2,numeric)); overall_coeff = ex_to_numeric(overall_coeff). mul_dyn(ex_to_numeric(c1).power(ex_to_numeric(c2))); } bool mul::can_make_flat(expair const & p) const { - ASSERT(is_ex_exactly_of_type(p.coeff,numeric)); + GINAC_ASSERT(is_ex_exactly_of_type(p.coeff,numeric)); // this assertion will probably fail somewhere // it would require a more careful make_flat, obeying the power laws // probably should return true only if p.coeff is integer @@ -852,7 +852,7 @@ ex mul::expand(unsigned options) const term=expanded_seq; for (l=0; l // *(c1,c2,ncmul(...)) (pull out commutative elements) @@ -391,7 +391,7 @@ ex ncmul::eval(int level) const if (count_noncommutative_composite==0) { // there are neither commutative nor noncommutative_composite // elements in assocseq - ASSERT(count_commutative==0); + GINAC_ASSERT(count_commutative==0); exvectorvector evv; unsignedvector rttinfos; @@ -416,15 +416,15 @@ ex ncmul::eval(int level) const } } -#ifdef DOASSERT - ASSERT(evv.size()==rttinfos.size()); - ASSERT(evv.size()>0); +#ifdef DO_GINAC_ASSERT + GINAC_ASSERT(evv.size()==rttinfos.size()); + GINAC_ASSERT(evv.size()>0); unsigned s=0; for (i=0; iinteger_content(); } @@ -240,27 +240,27 @@ numeric add::integer_content(void) const 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)); } @@ -841,7 +841,7 @@ static ex sr_gcd(const ex &a, const ex &b, const symbol *x) numeric ex::max_coefficient(void) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->max_coefficient(); } @@ -859,11 +859,11 @@ numeric add::max_coefficient(void) const { 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; @@ -874,15 +874,15 @@ numeric add::max_coefficient(void) const 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)); } @@ -897,7 +897,7 @@ numeric mul::max_coefficient(void) const ex ex::smod(const numeric &xi) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->smod(xi); } @@ -918,29 +918,29 @@ 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)); numeric coeff = GiNaC::smod(ex_to_numeric(it->coeff), xi); 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)); numeric coeff = GiNaC::smod(ex_to_numeric(overall_coeff), xi); 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)); mulcopyp->overall_coeff = GiNaC::smod(ex_to_numeric(overall_coeff),xi); mulcopyp->clearflag(status_flags::evaluated); mulcopyp->clearflag(status_flags::hash_calculated); diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index 4877dae7..c7d926a2 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -326,7 +326,7 @@ ex numeric::evalf(int level) const int numeric::compare_same_type(basic const & other) const { - ASSERT(is_exactly_of_type(other, numeric)); + GINAC_ASSERT(is_exactly_of_type(other, numeric)); numeric const & o = static_cast(const_cast(other)); if (*value == *o.value) { @@ -338,7 +338,7 @@ int numeric::compare_same_type(basic const & other) const bool numeric::is_equal_same_type(basic const & other) const { - ASSERT(is_exactly_of_type(other,numeric)); + GINAC_ASSERT(is_exactly_of_type(other,numeric)); numeric const *o = static_cast(&other); return is_equal(*o); @@ -714,7 +714,7 @@ bool numeric::operator>=(numeric const & other) const * if the number is really an integer before calling this method. */ int numeric::to_int(void) const { - ASSERT(is_integer()); + GINAC_ASSERT(is_integer()); return cl_I_to_int(The(cl_I)(*value)); } @@ -722,7 +722,7 @@ int numeric::to_int(void) const * if the number is really not complex before calling this method. */ double numeric::to_double(void) const { - ASSERT(is_real()); + GINAC_ASSERT(is_real()); return cl_double_approx(realpart(*value)); } diff --git a/ginac/power.cpp b/ginac/power.cpp index 36b5c8b4..bed6ed2f 100644 --- a/ginac/power.cpp +++ b/ginac/power.cpp @@ -93,13 +93,13 @@ void power::destroy(bool call_parent) power::power(ex const & lh, ex const & rh) : basic(TINFO_power), basis(lh), exponent(rh) { debugmsg("power constructor from ex,ex",LOGLEVEL_CONSTRUCT); - ASSERT(basis.return_type()==return_types::commutative); + GINAC_ASSERT(basis.return_type()==return_types::commutative); } power::power(ex const & lh, numeric const & rh) : basic(TINFO_power), basis(lh), exponent(rh) { debugmsg("power constructor from ex,numeric",LOGLEVEL_CONSTRUCT); - ASSERT(basis.return_type()==return_types::commutative); + GINAC_ASSERT(basis.return_type()==return_types::commutative); } ////////// @@ -132,8 +132,8 @@ int power::nops() const ex & power::let_op(int const i) { - ASSERT(i>=0); - ASSERT(i<2); + GINAC_ASSERT(i>=0); + GINAC_ASSERT(i<2); return i==0 ? basis : exponent; } @@ -245,7 +245,7 @@ ex power::eval(int level) const || res.is_rational()) { return res; } - ASSERT(!num_exponent->is_integer()); // has been handled by now + GINAC_ASSERT(!num_exponent->is_integer()); // has been handled by now // ^(c1,n/m) -> *(c1^q,c1^(n/m-q)), 0<(n/m-h)<1, q integer if (basis_is_rational && exponent_is_rational && num_exponent->is_real() @@ -284,7 +284,7 @@ ex power::eval(int level) const ex const & sub_exponent=sub_power.exponent; if (is_ex_exactly_of_type(sub_exponent,numeric)) { numeric const & num_sub_exponent=ex_to_numeric(sub_exponent); - ASSERT(num_sub_exponent!=numeric(1)); + GINAC_ASSERT(num_sub_exponent!=numeric(1)); if (num_exponent->is_integer() || abs(num_sub_exponent)<1) { return power(sub_basis,num_sub_exponent.mul(*num_exponent)); } @@ -300,7 +300,7 @@ ex power::eval(int level) const // ^(*(...,x;c1),c2) -> ^(*(...,x;1),c2)*c1^c2 (c1, c2 numeric(), c1>0) // ^(*(...,x,c1),c2) -> ^(*(...,x;-1),c2)*(-c1)^c2 (c1, c2 numeric(), c1<0) if (exponent_is_numerical && is_ex_exactly_of_type(ebasis,mul)) { - ASSERT(!num_exponent->is_integer()); // should have been handled above + GINAC_ASSERT(!num_exponent->is_integer()); // should have been handled above mul const & mulref=ex_to_mul(ebasis); if (!mulref.overall_coeff.is_equal(exONE())) { numeric const & num_coeff=ex_to_numeric(mulref.overall_coeff); @@ -314,7 +314,7 @@ ex power::eval(int level) const power(num_coeff,*num_exponent)))-> setflag(status_flags::dynallocated); } else { - ASSERT(num_coeff.compare(numZERO())<0); + GINAC_ASSERT(num_coeff.compare(numZERO())<0); if (num_coeff.compare(numMINUSONE())!=0) { mul * mulp=new mul(mulref); mulp->overall_coeff=exMINUSONE(); @@ -379,7 +379,7 @@ ex power::simplify_ncmul(exvector const & v) const int power::compare_same_type(basic const & other) const { - ASSERT(is_exactly_of_type(other, power)); + GINAC_ASSERT(is_exactly_of_type(other, power)); power const & o=static_cast(const_cast(other)); int cmpval; @@ -472,8 +472,8 @@ ex power::expand_add(add const & a, int const n) const term.reserve(m+1); for (l=0; lsetflag(status_flags::dynallocated); } @@ -591,8 +591,8 @@ ex power::expand_add_2(add const & a) const ex const & r=(*cit0).rest; ex const & c=(*cit0).coeff; - ASSERT(!is_ex_exactly_of_type(r,add)); - ASSERT(!is_ex_exactly_of_type(r,power)|| + GINAC_ASSERT(!is_ex_exactly_of_type(r,add)); + GINAC_ASSERT(!is_ex_exactly_of_type(r,power)|| !is_ex_exactly_of_type(ex_to_power(r).exponent,numeric)|| !ex_to_numeric(ex_to_power(r).exponent).is_pos_integer()|| !is_ex_exactly_of_type(ex_to_power(r).basis,add)|| @@ -624,7 +624,7 @@ ex power::expand_add_2(add const & a) const } } - ASSERT(sum.size()==(a.seq.size()*(a.seq.size()+1))/2); + GINAC_ASSERT(sum.size()==(a.seq.size()*(a.seq.size()+1))/2); // second part: add terms coming from overall_factor (if != 0) if (!a.overall_coeff.is_equal(exZERO())) { @@ -634,7 +634,7 @@ ex power::expand_add_2(add const & a) const sum.push_back(expair(ex_to_numeric(a.overall_coeff).power_dyn(numTWO()),exONE())); } - ASSERT(sum.size()==(a_nops*(a_nops+1))/2); + GINAC_ASSERT(sum.size()==(a_nops*(a_nops+1))/2); return (new add(sum))->setflag(status_flags::dynallocated); } diff --git a/ginac/print.cpp b/ginac/print.cpp index f797dc6b..1df9cd2f 100644 --- a/ginac/print.cpp +++ b/ginac/print.cpp @@ -46,14 +46,14 @@ namespace GiNaC { void ex::print(ostream & os, unsigned upper_precedence) const { debugmsg("ex print",LOGLEVEL_PRINT); - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); bp->print(os,upper_precedence); } void ex::dbgprint(void) const { debugmsg("ex dbgprint",LOGLEVEL_PRINT); - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); bp->dbgprint(); } diff --git a/ginac/printcsrc.cpp b/ginac/printcsrc.cpp index a162ad8a..2d0ccfd3 100644 --- a/ginac/printcsrc.cpp +++ b/ginac/printcsrc.cpp @@ -51,7 +51,7 @@ namespace GiNaC { void ex::printcsrc(ostream & os, unsigned type, const char *var_name) const { debugmsg("ex print csrc", LOGLEVEL_PRINT); - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); switch (type) { case csrc_types::ctype_float: os << "float "; diff --git a/ginac/printraw.cpp b/ginac/printraw.cpp index 7c66c1bb..31f56065 100644 --- a/ginac/printraw.cpp +++ b/ginac/printraw.cpp @@ -50,7 +50,7 @@ namespace GiNaC { void ex::printraw(ostream & os) const { debugmsg("ex printraw",LOGLEVEL_PRINT); - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); os << "ex("; bp->printraw(os); os << ")"; diff --git a/ginac/printtree.cpp b/ginac/printtree.cpp index a7b09723..99cf56e0 100644 --- a/ginac/printtree.cpp +++ b/ginac/printtree.cpp @@ -45,7 +45,7 @@ namespace GiNaC { void ex::printtree(ostream & os, unsigned indent) const { debugmsg("ex printtree",LOGLEVEL_PRINT); - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); // os << "refcount=" << bp->refcount << " "; bp->printtree(os,indent); } @@ -53,7 +53,7 @@ void ex::printtree(ostream & os, unsigned indent) const void ex::dbgprinttree(void) const { debugmsg("ex dbgprinttree",LOGLEVEL_PRINT); - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); bp->dbgprinttree(); } diff --git a/ginac/relational.cpp b/ginac/relational.cpp index f63a297f..76652e98 100644 --- a/ginac/relational.cpp +++ b/ginac/relational.cpp @@ -130,8 +130,8 @@ int relational::nops() const ex & relational::let_op(int const i) { - ASSERT(i>=0); - ASSERT(i<2); + GINAC_ASSERT(i>=0); + GINAC_ASSERT(i<2); return i==0 ? lh : rh; } @@ -170,7 +170,7 @@ ex relational::simplify_ncmul(exvector const & v) const int relational::compare_same_type(basic const & other) const { - ASSERT(is_exactly_of_type(other, relational)); + GINAC_ASSERT(is_exactly_of_type(other, relational)); relational const & oth=static_cast(const_cast(other)); int cmpval; @@ -192,13 +192,13 @@ int relational::compare_same_type(basic const & other) const unsigned relational::return_type(void) const { - ASSERT(lh.return_type()==rh.return_type()); + GINAC_ASSERT(lh.return_type()==rh.return_type()); return lh.return_type(); } unsigned relational::return_type_tinfo(void) const { - ASSERT(lh.return_type_tinfo()==rh.return_type_tinfo()); + GINAC_ASSERT(lh.return_type_tinfo()==rh.return_type_tinfo()); return lh.return_type_tinfo(); } diff --git a/ginac/series.cpp b/ginac/series.cpp index 5822825f..a390dd15 100644 --- a/ginac/series.cpp +++ b/ginac/series.cpp @@ -97,7 +97,7 @@ series::series(ex const &var_, ex const &point_, epvector const &ops_) : basic(TINFO_series), seq(ops_), var(var_), point(point_) { debugmsg("series constructor from ex,ex,epvector", LOGLEVEL_CONSTRUCT); - ASSERT(is_ex_exactly_of_type(var_, symbol)); + GINAC_ASSERT(is_ex_exactly_of_type(var_, symbol)); } @@ -627,7 +627,7 @@ ex power::series(symbol const & s, ex const & point, int order) const * @return an expression holding a series object */ ex ex::series(symbol const &s, ex const &point, int order) const { - ASSERT(bp!=0); + GINAC_ASSERT(bp!=0); return bp->series(s, point, order); } diff --git a/ginac/simp_lor.cpp b/ginac/simp_lor.cpp index d488e6dd..05f96ae1 100644 --- a/ginac/simp_lor.cpp +++ b/ginac/simp_lor.cpp @@ -103,7 +103,7 @@ simp_lor::simp_lor(simp_lor_types const t, ex const & i1, ex const & i2) : { debugmsg("simp_lor constructor from simp_lor_types,ex,ex",LOGLEVEL_CONSTRUCT); tinfo_key=TINFO_simp_lor; - ASSERT(all_of_type_lorentzidx()); + GINAC_ASSERT(all_of_type_lorentzidx()); } simp_lor::simp_lor(simp_lor_types const t, string const & n, ex const & i1) : @@ -111,7 +111,7 @@ simp_lor::simp_lor(simp_lor_types const t, string const & n, ex const & i1) : { debugmsg("simp_lor constructor from simp_lor_types,string,ex",LOGLEVEL_CONSTRUCT); tinfo_key=TINFO_simp_lor; - ASSERT(all_of_type_lorentzidx()); + GINAC_ASSERT(all_of_type_lorentzidx()); } simp_lor::simp_lor(simp_lor_types const t, string const & n, exvector const & iv) : @@ -119,7 +119,7 @@ simp_lor::simp_lor(simp_lor_types const t, string const & n, exvector const & iv { debugmsg("simp_lor constructor from simp_lor_types,string,exvector",LOGLEVEL_CONSTRUCT); tinfo_key=TINFO_simp_lor; - ASSERT(all_of_type_lorentzidx()); + GINAC_ASSERT(all_of_type_lorentzidx()); } simp_lor::simp_lor(simp_lor_types const t, string const & n, exvector * ivp) : @@ -127,7 +127,7 @@ simp_lor::simp_lor(simp_lor_types const t, string const & n, exvector * ivp) : { debugmsg("simp_lor constructor from simp_lor_types,string,exvector*",LOGLEVEL_CONSTRUCT); tinfo_key=TINFO_simp_lor; - ASSERT(all_of_type_lorentzidx()); + GINAC_ASSERT(all_of_type_lorentzidx()); } ////////// @@ -239,7 +239,7 @@ ex simp_lor::eval(int level) const int simp_lor::compare_same_type(basic const & other) const { - ASSERT(other.tinfo() == TINFO_simp_lor); + GINAC_ASSERT(other.tinfo() == TINFO_simp_lor); const simp_lor *o = static_cast(&other); if (type==o->type) { if (name==o->name) { @@ -252,7 +252,7 @@ int simp_lor::compare_same_type(basic const & other) const bool simp_lor::is_equal_same_type(basic const & other) const { - ASSERT(other.tinfo() == TINFO_simp_lor); + GINAC_ASSERT(other.tinfo() == TINFO_simp_lor); const simp_lor *o = static_cast(&other); if (type!=o->type) return false; if (name!=o->name) return false; @@ -329,7 +329,7 @@ simp_lor lor_vec(string const & n, ex const & mu) ex simplify_simp_lor_mul(ex const & m, scalar_products const & sp) { - ASSERT(is_ex_exactly_of_type(m,mul)); + GINAC_ASSERT(is_ex_exactly_of_type(m,mul)); exvector v_contracted; // collect factors in an exvector, store squares twice @@ -354,11 +354,11 @@ ex simplify_simp_lor_mul(ex const & m, scalar_products const & sp) if (is_ex_exactly_of_type(*it,simp_lor) && (ex_to_simp_lor(*it).type==simp_lor::simp_lor_g)) { simp_lor const & g=ex_to_simp_lor(*it); - ASSERT(g.seq.size()==2); + GINAC_ASSERT(g.seq.size()==2); idx const & first_idx=ex_to_lorentzidx(g.seq[0]); idx const & second_idx=ex_to_lorentzidx(g.seq[1]); // g_{mu,mu} should have been contracted in simp_lor::eval() - ASSERT(!first_idx.is_equal(second_idx)); + GINAC_ASSERT(!first_idx.is_equal(second_idx)); ex saved_g=*it; // save to restore it later // try to contract first index @@ -371,7 +371,7 @@ ex simplify_simp_lor_mul(ex const & m, scalar_products const & sp) *it=saved_g; } else { // a contracted index should occur exactly once - ASSERT(replacements==1); + GINAC_ASSERT(replacements==1); *it=exONE(); something_changed=true; } @@ -387,7 +387,7 @@ ex simplify_simp_lor_mul(ex const & m, scalar_products const & sp) *it=saved_g; } else { // a contracted index should occur exactly once - ASSERT(replacements==1); + GINAC_ASSERT(replacements==1); *it=exONE(); something_changed=true; } @@ -408,8 +408,8 @@ ex simplify_simp_lor_mul(ex const & m, scalar_products const & sp) (ex_to_simp_lor(*it2).type==simp_lor::simp_lor_vec)) { simp_lor const & vec1=ex_to_simp_lor(*it1); simp_lor const & vec2=ex_to_simp_lor(*it2); - ASSERT(vec1.seq.size()==1); - ASSERT(vec2.seq.size()==1); + GINAC_ASSERT(vec1.seq.size()==1); + GINAC_ASSERT(vec2.seq.size()==1); lorentzidx const & idx1=ex_to_lorentzidx(vec1.seq[0]); lorentzidx const & idx2=ex_to_lorentzidx(vec2.seq[0]); if (idx1.is_symbolic() && @@ -506,10 +506,10 @@ void scalar_products::debugprint(void) const spmapkey scalar_products::make_key(simp_lor const & v1, simp_lor const & v2) { - ASSERT(v1.type==simp_lor::simp_lor_vec); - ASSERT(v2.type==simp_lor::simp_lor_vec); + GINAC_ASSERT(v1.type==simp_lor::simp_lor_vec); + GINAC_ASSERT(v2.type==simp_lor::simp_lor_vec); lorentzidx anon=ex_to_lorentzidx(v1.seq[0]).create_anonymous_representative(); - ASSERT(anon.is_equal_same_type(ex_to_lorentzidx(v2.seq[0]).create_anonymous_representative())); + GINAC_ASSERT(anon.is_equal_same_type(ex_to_lorentzidx(v2.seq[0]).create_anonymous_representative())); return spmapkey(strstrpair(v1.name,v2.name),anon); } diff --git a/ginac/structure.cpp b/ginac/structure.cpp index 55ec5828..539eaf76 100644 --- a/ginac/structure.cpp +++ b/ginac/structure.cpp @@ -125,13 +125,13 @@ void structure::printcsrc(ostream & os, unsigned type, unsigned upper_precedence int structure::compare_same_type(basic const & other) const { - ASSERT(is_of_type(other, structure)); + GINAC_ASSERT(is_of_type(other, structure)); return 0; // all structures are the same } bool structure::is_equal_same_type(basic const & other) const { - ASSERT(is_of_type(other, structure)); + GINAC_ASSERT(is_of_type(other, structure)); return true; // all structures are the same } diff --git a/ginac/structure.pl b/ginac/structure.pl index b6137d0b..2ae1625a 100755 --- a/ginac/structure.pl +++ b/ginac/structure.pl @@ -354,8 +354,8 @@ int ${STRUCTURE}::nops() const ex & ${STRUCTURE}::let_op(int const i) { - ASSERT(i>=0); - ASSERT(i=0); + GINAC_ASSERT(i (const_cast(other)); int cmpval; @@ -460,7 +460,7 @@ ${compare_statements} bool ${STRUCTURE}::is_equal_same_type(basic const & other) const { - ASSERT(is_of_type(other,${STRUCTURE})); + GINAC_ASSERT(is_of_type(other,${STRUCTURE})); ${STRUCTURE} const & o=static_cast<${STRUCTURE} const &> (const_cast(other)); ${is_equal_statements} diff --git a/ginac/symbol.cpp b/ginac/symbol.cpp index 2d42b5af..f1dc18df 100644 --- a/ginac/symbol.cpp +++ b/ginac/symbol.cpp @@ -168,13 +168,13 @@ ex symbol::eval(int level) const ex symbol::subs(lst const & ls, lst const & lr) const { - ASSERT(ls.nops()==lr.nops()); -#ifdef DOASSERT + GINAC_ASSERT(ls.nops()==lr.nops()); +#ifdef DO_GINAC_ASSERT for (int i=0; i(&other); if (serial==o->serial) return 0; return serial < o->serial ? -1 : 1; @@ -196,7 +196,7 @@ int symbol::compare_same_type(basic const & other) const bool symbol::is_equal_same_type(basic const & other) const { - ASSERT(is_of_type(other,symbol)); + GINAC_ASSERT(is_of_type(other,symbol)); const symbol *o = static_cast(&other); return serial==o->serial; } diff --git a/ginac/utils.h b/ginac/utils.h index 814654c6..3c33162e 100644 --- a/ginac/utils.h +++ b/ginac/utils.h @@ -53,7 +53,7 @@ inline unsigned rotate_left_31(unsigned n) if (n & 0x80000000U) { n=(n & 0x7FFFFFFFU) | 0x00000001U; } - ASSERT(n<0x80000000U); + GINAC_ASSERT(n<0x80000000U); return n; }