yet another patch.

Chris Dams chrisd at sci.kun.nl
Fri Jul 2 17:39:17 CEST 2004


Hello again,

I think it is not good that conjugate(some expression) returns a function
while (some expression).conjugate() returns an expression. This is
inconsistent to what users are used to with, say, expand(e) and
e.expand(). They will be surprised that

	conjugate(some expression).expand()

does not expand anything.

Bye,
Chris
-------------- next part --------------
Index: 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: add.h
===================================================================
RCS file: /home/cvs/GiNaC/ginac/add.h,v
retrieving revision 1.43
diff -r1.43 add.h
59a60
> 	ex conjugate() const;
Index: ex.h
===================================================================
RCS file: /home/cvs/GiNaC/ginac/ex.h,v
retrieving revision 1.76
diff -r1.76 ex.h
754a755,757
> inline ex conjugate(const ex & thisex)
> { return thisex.conjugate(); }
> 
Index: inifcns.cpp
===================================================================
RCS file: /home/cvs/GiNaC/ginac/inifcns.cpp,v
retrieving revision 1.75
diff -r1.75 inifcns.cpp
51c51
< 	return conjugate(arg).hold();
---
> 	return conjugate_function(arg).hold();
69c69
< REGISTER_FUNCTION(conjugate, eval_func(conjugate_eval).
---
> REGISTER_FUNCTION(conjugate_function, eval_func(conjugate_eval).
72c72,73
<                        conjugate_func(conjugate_conjugate));
---
>                        conjugate_func(conjugate_conjugate).
>                        set_name("conjugate","conjugate"));
Index: inifcns.h
===================================================================
RCS file: /home/cvs/GiNaC/ginac/inifcns.h,v
retrieving revision 1.46
diff -r1.46 inifcns.h
32c32
< DECLARE_FUNCTION_1P(conjugate)
---
> DECLARE_FUNCTION_1P(conjugate_function)
Index: symbol.cpp
===================================================================
RCS file: /home/cvs/GiNaC/ginac/symbol.cpp,v
retrieving revision 1.55
diff -r1.55 symbol.cpp
227c227
< 		return GiNaC::conjugate(*this).hold();
---
> 		return GiNaC::conjugate_function(*this).hold();


More information about the GiNaC-devel mailing list