Error in my symmetrization patch.

Chris Dams chrisd at sci.kun.nl
Wed Nov 20 23:26:46 CET 2002


Hello,

Remember the symmetrization patch I sent about a week or so ago? Well it
has an error and actually only works on terms of which the coefficient is
not unity. On terms that have a coefficient equal to 1, it removes in a
rather arbitrary way, one of the factors. Sorry for killing your library.
Fortunately a patch is attached that is supposed to solve it.

Greetings,
Chris Dams
-------------- next part --------------
*** indexed.cpp	Wed Nov 20 22:15:06 2002
--- indexed.cpp.modified	Wed Nov 20 22:20:53 2002
***************
*** 838,850 ****
  
  	symminfo(const ex & symmterm_, const ex & orig_)
  	{
! 		if (is_a<mul>(orig_)) {
  			ex tmp = orig_.op(orig_.nops()-1);
  			orig = orig_ / tmp;
  		} else 
  			orig = orig_;
  
! 		if (is_a<mul>(symmterm_)) {
  			coeff = symmterm_.op(symmterm_.nops()-1);
  			symmterm = symmterm_ / coeff;
  		} else {
--- 838,850 ----
  
  	symminfo(const ex & symmterm_, const ex & orig_)
  	{
! 		if (is_a<mul>(orig_) && is_a<numeric>(orig_.op(orig_.nops()-1))) {
  			ex tmp = orig_.op(orig_.nops()-1);
  			orig = orig_ / tmp;
  		} else 
  			orig = orig_;
  
! 		if (is_a<mul>(symmterm_) && is_a<numeric>(symmterm_.op(symmterm_.nops()-1))) {
  			coeff = symmterm_.op(symmterm_.nops()-1);
  			symmterm = symmterm_ / coeff;
  		} else {


More information about the GiNaC-devel mailing list