From: Martin Reuter <mreuter@gm...>  20101222 22:33:55

Yes, std::sqrt seems to work, only need one sqrt anyway. Now I just need a fast way of computing the inverse of a complex 4x4 matrix. using vnl_inverse gives an error: In function ‘vnl_matrix_fixed<T, 4u, 4u> vnl_inverse(const vnl_matrix_fixed<T, 4u, 4u>&) [with T = std::complex<double>]’: vnl_inverse.h:114: error: no match for ‘operator==’ in ‘det == 0’ looks like it cannot deal with complex fixed matrices? Martin On Wed, 20101222 at 20:50 +0000, Peter Vanroose wrote: > > is this (cpoly_roots) computationally efficient, or a lot > > of overhead (have to solve this very often). > > I guess it's indeed a lot of overhead, certainly for something as simple as square root. Didn't measure this, though. > > > > Another idea I had is to convert to std::complex and use > > the provided sqrt function? Does that make sense? > > Of course. That's probably a lot better. But I'm not familiar enough with std::sqrt(std::complex<T>) to be sure about this; e.g.: which of the two square roots is returned by this function? > > > > This brings me to another question about vcl_complex. Is > > that a wrapper around std::complex? > > Yes. Or better said: it is (in most cases) just a #define for std::complex. > So the two are (or should be) identical. > > > > The vnl:numerics documentation says this: > > "Compliance with the ANSI standard C++ library > > The current draft of the ANSI standard (as at May 1996) > > includes classes for 1dimensional vectors (valarray<T>) > > and complex numbers (complex<T>). > > There is no standard for matrices. > > The current vnl classes are not implemented in terms of > > valarray, as there is a potential performance hit, > > but in the future they might be." > > > > So what's with complex ?? > > There is no vnl_complex, just vcl_complex (which is std::complex). > > >  Peter. > > > > > > > > > > > > > > > > > > 