complex conjugation

chrisd at sci.kun.nl chrisd at sci.kun.nl
Mon Nov 24 10:24:05 CET 2003


Hello,

On Sun, 23 Nov 2003, Richard B. Kreckel wrote:

> > I would say that just bluntly using the default behaviour, ignoring
> > possible problems, would be best.
>
> I guess that's right.  What about non-analytic functions?  We don't seem
> to have many, though, yet (just abs and csgn).

I already wrote the code for that and it looks like

static ex abs_conjugate(const ex & x)
{
	return abs(x);
}

REGISTER_FUNCTION(abs, eval_func(abs_eval).
                       evalf_func(abs_evalf).
                       print_func<print_latex>(abs_print_latex).
                       print_func<print_csrc_float>(abs_print_csrc_float).

print_func<print_csrc_double>(abs_print_csrc_float).
                       conjugate_func(abs_conjugate));

static ex csgn_conjugate(const ex&x)
{
   return csgn(x);
}

REGISTER_FUNCTION(csgn, eval_func(csgn_eval).
                        evalf_func(csgn_evalf).
                        series_func(csgn_series).
                        conjugate_func(csgn_conjugate));

The good news is that this already works fine. Currently I am hunting down
a segmentation fault in the complex conjugation of ncmuls.

Bye,
Chris Dams




More information about the GiNaC-list mailing list