patch for complex conj of additions.

Chris Dams chrisd at sci.kun.nl
Fri Jul 2 15:49:20 CEST 2004


Dear GiNaCers,

I found out that complex conjugating a-a*gamma5 gives a--a*gamma5. This is
because the minus in front of a*gamm5 is stored inside the add while the
minus that comes from cc-ing a*gamma5 is stored in the multiplication.
These are not cancelled. The solution is to have a separate add::conjugate
function. A patch is attached.

Best,
Chris
-------------- next part --------------
Index: ginac/add.cpp
===================================================================
RCS file: /home/cvs/GiNaC/ginac/add.cpp,v
retrieving revision 1.73
diff -r1.73 add.cpp
384a385,410
> ex add::conjugate() const
> {
> 	exvector *v = 0;
> 	for (int i=0; i<nops(); ++i) {
> 		if (v) {
> 			v->push_back(op(i).conjugate());
> 			continue;
> 		}
> 		ex term = op(i);
> 		ex ccterm = term.conjugate();
> 		if (are_ex_trivially_equal(term, ccterm))
> 			continue;
> 		v = new exvector;
> 		v->reserve(nops());
> 		for (int j=0; j<i; ++j)
> 			v->push_back(op(j));
> 		v->push_back(ccterm);
> 	}
> 	if (v) {
> 		ex result = add(*v);
> 		delete v;
> 		return result;
> 	}
> 	return *this;
> }
> 
Index: ginac/add.h
===================================================================
RCS file: /home/cvs/GiNaC/ginac/add.h,v
retrieving revision 1.43
diff -r1.43 add.h
59a60
> 	ex conjugate() const;


More information about the GiNaC-devel mailing list