Boost logo

Ublas :

From: Michael Stevens (mail_at_[hidden])
Date: 2005-08-16 07:55:08


Hi Neal,

On Tuesday 16 August 2005 13:02, Neal Becker wrote:
> I need a way to construct large vectors of complex numbers. I want to
> bypass the wasteful default construction of the complex elements. What
> would be the preferred way to do this using ublas? Has anyone already done
> this?

I have thought about this before. My feeling is that this is another issue
with the "over encapsulation" of 'std::complex.' There is no reason why
'std::complex' should initialise to zero in it's default constructor. The
class has no invariants to maintain, so it can have an uninitialised default
constructor just as the C++ builtin types do.

My "preferred" way would therefore be to use a 'complex' class which has an
initialised default constructor. Sadly there is way such a class can be
derived from 'std::complex', and no one want to rewrite all of complex. So it
would be nice to force uBLAS to avoid any kind of construction.

Sadly not even the STL allocator interface of the storage types allows this.
The only way to do this would be to write a special version of
'unbounded_array' which avoids the standard conforming default construction
of elements.

Michael

-- 
___________________________________
Michael Stevens Systems Engineering
34128 Kassel, Germany
Phone/Fax: +49 561 5218038
Navigation Systems, Estimation  and
                 Bayesian Filtering
    http://bayesclasses.sf.net
___________________________________