while (i != iend) {
n.add_ex("rest", i->rest);
n.add_ex("coeff", i->coeff);
- i++;
+ ++i;
}
n.add_ex("overall_coeff", overall_coeff);
}
for (epplist::const_iterator it=hashtab[i].begin();
it!=hashtab[i].end(); ++it) {
os << *it-seq.begin() << " ";
- this_bin_fill++;
+ ++this_bin_fill;
}
os << std::endl;
cum_fill += this_bin_fill;
cit=v.begin();
while (cit!=citend) {
if (cit->bp->tinfo()==tinfo()) {
- nexpairseqs++;
+ ++nexpairseqs;
noperands+=ex_to_expairseq(*cit).seq.size();
}
++cit;
cit = v.begin();
while (cit!=citend) {
if (cit->rest.bp->tinfo()==tinfo()) {
- nexpairseqs++;
+ ++nexpairseqs;
noperands += ex_to_expairseq((*cit).rest).seq.size();
}
++cit;
do {
last_numeric--;
} while (is_ex_exactly_of_type((*last_numeric).rest,numeric));
- last_numeric++;
+ ++last_numeric;
sort(last_numeric,seq.end(),expair_is_less());
}
}
unsigned hash=e.gethash();
unsigned hashindex;
if (is_a_numeric_hash(hash)) {
- hashindex=hashmask;
+ hashindex = hashmask;
} else {
- hashindex=hash & hashmask;
+ hashindex = hash & hashmask;
// last hashtab entry is reserved for numerics
- if (hashindex==hashmask) hashindex=0;
+ if (hashindex==hashmask) hashindex = 0;
}
GINAC_ASSERT(hashindex>=0);
GINAC_ASSERT((hashindex<hashtabsize)||(hashtabsize==0));
GINAC_ASSERT(new_hashtabsize<hashtabsize);
if (new_hashtabsize==0) {
hashtab.clear();
- hashtabsize=0;
+ hashtabsize = 0;
canonicalize();
return;
}
// shrink by a factor of 2
unsigned half_hashtabsize=hashtabsize/2;
- for (unsigned i=0; i<half_hashtabsize-1; ++i) {
+ for (unsigned i=0; i<half_hashtabsize-1; ++i)
hashtab[i].merge(hashtab[i+half_hashtabsize],epp_is_less());
- }
// special treatment for numeric hashes
hashtab[0].merge(hashtab[half_hashtabsize-1],epp_is_less());
- hashtab[half_hashtabsize-1]=hashtab[hashtabsize-1];
+ hashtab[half_hashtabsize-1] = hashtab[hashtabsize-1];
hashtab.resize(half_hashtabsize);
- hashtabsize=half_hashtabsize;
- hashmask=hashtabsize-1;
+ hashtabsize = half_hashtabsize;
+ hashmask = hashtabsize-1;
}
}
if (hashtabsize==0) return; // nothing to do
// calculate hashindex of element to be deleted
- unsigned hashindex=calc_hashindex((*element).rest);
+ unsigned hashindex = calc_hashindex((*element).rest);
// find it in hashtab and remove it
- epplist & eppl=hashtab[hashindex];
- epplist::iterator epplit=eppl.begin();
- bool erased=false;
+ epplist & eppl = hashtab[hashindex];
+ epplist::iterator epplit = eppl.begin();
+ bool erased = false;
while (epplit!=eppl.end()) {
if (*epplit == element) {
eppl.erase(epplit);
- erased=true;
+ erased = true;
break;
}
++epplit;
cout << "tried to erase " << element-seq.begin() << std::endl;
cout << "size " << seq.end()-seq.begin() << std::endl;
- unsigned hashindex=calc_hashindex((*element).rest);
- epplist & eppl=hashtab[hashindex];
+ unsigned hashindex = calc_hashindex((*element).rest);
+ epplist & eppl = hashtab[hashindex];
epplist::iterator epplit=eppl.begin();
bool erased=false;
while (epplit!=eppl.end()) {
if (*epplit == element) {
eppl.erase(epplit);
- erased=true;
+ erased = true;
break;
}
++epplit;
unsigned hashindex=calc_hashindex((*newpos).rest);
// find it in hashtab and modify it
- epplist & eppl=hashtab[hashindex];
+ epplist & eppl = hashtab[hashindex];
epplist::iterator epplit=eppl.begin();
while (epplit!=eppl.end()) {
if (*epplit == oldpos) {
void expairseq::sorted_insert(epplist & eppl, epp elem)
{
- epplist::iterator current=eppl.begin();
+ epplist::iterator current = eppl.begin();
while ((current!=eppl.end())&&((*(*current)).is_less(*elem))) {
++current;
}
// combine same terms, drop term with coeff 0, move numerics to end
// calculate size of hashtab
- hashtabsize=calc_hashtabsize(seq.size());
+ hashtabsize = calc_hashtabsize(seq.size());
// hashtabsize is a power of 2
- hashmask=hashtabsize-1;
+ hashmask = hashtabsize-1;
// allocate hashtab
hashtab.clear();
touched.reserve(seq.size());
for (unsigned i=0; i<seq.size(); ++i) touched[i]=false;
- unsigned number_of_zeroes=0;
+ unsigned number_of_zeroes = 0;
GINAC_ASSERT(!has_coeff_0());
build_hashtab_and_combine(first_numeric,last_non_zero,touched,number_of_zeroes);
if (!are_ex_trivially_equal((*cit).rest,subsed_ex)) {
// something changed, copy seq, subs and return it
- epvector *s=new epvector;
+ epvector *s = new epvector;
s->reserve(seq.size());
// copy parts of seq which are known not to have changed