problem with simplify_indexed plus patch

Chris Dams chrisd at sci.kun.nl
Tue Jan 28 18:36:20 CET 2003


Hello,

I encountered the problem that after calling simplify_indexed, some of the
symbols used in indices appeared three times in some of the terms. Before
simplify_indexed was called this was not the case. The problem seems to be
that in the function rename_dummy_indices, indices are compared by calling
ex_is_equal on two of them. However, it may happen that the indices that
are compared this way have the same value but different dimension. If that
happens, they are considered not to be the same, but as far as dummy
indices renaming is concerned but I think they should be considered the
same. The attached patch is supposed to fix this.

Greetings,
Chris Dams
-------------- next part --------------
Index: ex.h
===================================================================
RCS file: /home/cvs/GiNaC/ginac/ex.h,v
retrieving revision 1.54.2.8
diff -r1.54.2.8 ex.h
482a483,486
> struct op0_is_equal : public std::binary_function<ex, ex, bool> {
> 	bool operator() (const ex &lh, const ex &rh) const { return lh.op(0).is_equal(rh.op(0)); }
> };
> 
Index: indexed.cpp
===================================================================
RCS file: /home/cvs/GiNaC/ginac/indexed.cpp,v
retrieving revision 1.65.2.15
diff -r1.65.2.15 indexed.cpp
39a40
> #include "symbol.h"
535c536
< 			if (find_if(global_dummy_indices.begin(), global_dummy_indices.end(), bind2nd(ex_is_equal(), *it)) == global_dummy_indices.end()) {
---
> 			if (find_if(global_dummy_indices.begin(), global_dummy_indices.end(), bind2nd(op0_is_equal(), *it)) == global_dummy_indices.end()) {
908c909
< {
---
> {	
1093a1095
> 


More information about the GiNaC-devel mailing list