* Implementation of GiNaC's indexed expressions. */
/*
- * GiNaC Copyright (C) 1999-2015 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2020 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 inherited::compare_same_type(other);
}
-ex indexed::eval(int level) const
+ex indexed::eval() const
{
- // First evaluate children, then we will end up here again
- if (level > 1)
- return indexed(ex_to<symmetry>(symtree), evalchildren(level));
-
const ex &base = seq[0];
// If the base object is 0, the whole object is 0
// global functions
//////////
-struct idx_is_equal_ignore_dim : public std::binary_function<ex, ex, bool> {
+struct idx_is_equal_ignore_dim {
bool operator() (const ex &lh, const ex &rh) const
{
if (lh.is_equal(rh))
return free_indices;
}
-struct is_summation_idx : public std::unary_function<ex, bool> {
+struct is_summation_idx {
bool operator()(const ex & e)
{
return is_dummy_pair(e, e);
int remaining = local_size - global_size;
auto it = local_dummy_indices.begin(), itend = local_dummy_indices.end();
while (it != itend && remaining > 0) {
- if (is_exactly_a<T>(*it) && find_if(global_dummy_indices.begin(), global_dummy_indices.end(), bind2nd(idx_is_equal_ignore_dim(), *it)) == global_dummy_indices.end()) {
+ if (is_exactly_a<T>(*it) &&
+ find_if(global_dummy_indices.begin(), global_dummy_indices.end(),
+ [it](const ex &lh) { return idx_is_equal_ignore_dim()(lh, *it); }) == global_dummy_indices.end()) {
global_dummy_indices.push_back(*it);
global_size++;
remaining--;
}
/* Ordering that only compares the base expressions of indexed objects. */
-struct ex_base_is_less : public std::binary_function<ex, ex, bool> {
+struct ex_base_is_less {
bool operator() (const ex &lh, const ex &rh) const
{
return (is_a<indexed>(lh) ? lh.op(0) : lh).compare(is_a<indexed>(rh) ? rh.op(0) : rh) < 0;