* Implementation of GiNaC's indices. */
/*
- * GiNaC Copyright (C) 1999-2010 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2021 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
return *this;
else {
idx *copy = duplicate();
- copy->setflag(status_flags::dynallocated);
copy->clearflag(status_flags::hash_calculated);
copy->value = mapped_value;
return *copy;
/** By default, basic::evalf would evaluate the index value but we don't want
* a.1 to become a.(1.0). */
-ex idx::evalf(int level) const
+ex idx::evalf() const
{
return *this;
}
ex idx::subs(const exmap & m, unsigned options) const
{
// First look for index substitutions
- exmap::const_iterator it = m.find(*this);
+ auto it = m.find(*this);
if (it != m.end()) {
// Substitution index->index
idx *i_copy = duplicate();
i_copy->value = it->second;
i_copy->clearflag(status_flags::hash_calculated);
- return i_copy->setflag(status_flags::dynallocated);
+ return *i_copy;
}
// None, substitute objects in value (not in dimension)
idx *i_copy = duplicate();
i_copy->value = subsed_value;
i_copy->clearflag(status_flags::hash_calculated);
- return i_copy->setflag(status_flags::dynallocated);
+ return *i_copy;
}
/** Implementation of ex::diff() for an index always returns 0.
idx *i_copy = duplicate();
i_copy->dim = new_dim;
i_copy->clearflag(status_flags::hash_calculated);
- return i_copy->setflag(status_flags::dynallocated);
+ return *i_copy;
}
ex idx::minimal_dim(const idx & other) const
varidx *i_copy = duplicate();
i_copy->covariant = !i_copy->covariant;
i_copy->clearflag(status_flags::hash_calculated);
- return i_copy->setflag(status_flags::dynallocated);
+ return *i_copy;
}
ex spinidx::toggle_dot() const
spinidx *i_copy = duplicate();
i_copy->dotted = !i_copy->dotted;
i_copy->clearflag(status_flags::hash_calculated);
- return i_copy->setflag(status_flags::dynallocated);
+ return *i_copy;
}
ex spinidx::toggle_variance_dot() const
i_copy->covariant = !i_copy->covariant;
i_copy->dotted = !i_copy->dotted;
i_copy->clearflag(status_flags::hash_calculated);
- return i_copy->setflag(status_flags::dynallocated);
+ return *i_copy;
}
//////////
// Find dummy pairs and free indices
it = v.begin(); itend = v.end();
- exvector::const_iterator last = it++;
+ auto last = it++;
while (it != itend) {
if (is_dummy_pair(*it, *last)) {
out_dummy.push_back(*last);