Boost logo

Boost :

Subject: Re: [boost] Review request: extended complex number library
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-03-07 17:10:39

On 03/07/2012 11:42 AM, Matthieu Schaller wrote:
> Dear all,
> Thanks for your comments.
> How about having a boost::real<T> (or whatever you want to name it),
> that references a complex number with an imaginary part set to 0?
> This could in principle be done but I don't think that it is a good
> thing to do. boost::real<> would be a wrapper around the double type
> say. Now, this would require to rewrite all the mathematical functions
> for this type. Furthermore, people doing numerical sciences will
> probably not be keen to drop the use of native POD variable for simple
> calculations.
> It is true that some functions could be modified to return complex
> values instead of NaNs but this would come at a performance cost when
> performing real only computations.

How does that not apply to boost::imaginary<T>?

A complex has a real and imaginary part.
boost::imaginary<T> is a complex with an imaginary part set to 0.
The counterpart for the real part should also exist.

Boost list run by bdawes at, gregod at, cpdaniel at, john at