Re: Implementing ComplexArray class.
Posted by Joseph Wang-2 on
URL: http://quantlib.414.s1.nabble.com/Implementing-ComplexArray-class-tp11278p11280.html
在 Monday 02 October 2006 03:31,Luigi Ballabio 写道:
> On Sun, 2006-10-01 at 18:44 -0500, Joseph Wang wrote:
> > Looking over Numerical Recipes in C++, they suggest implementing a list
> > of N complex numbers as an array of 2*N floats because they argue that
> > you maintain control of how the complex number calculations are
> > implemented.
>
> That pretty much defeats the purpose of having a std::complex class in
> the standard library, doesn't it? It's like arguing that one should
> implement his own containers to maintain control.
That was my first reaction.
Any objections to creating an implementation agnostic ComplexArray class that
using valarray and complex? The reason for creating a separate class is that
I'd like to have a nice interface that interoperates with the Array class.