Boost logo

Boost :

From: jhrwalter (walter_at_[hidden])
Date: 2002-02-12 03:46:25

--- In boost_at_y..., Toon Knapen <toon.knapen_at_s...> wrote:
> Currently, real matrices can be assigned to complex matrices due to
> automatic conversion from double to complex. The other direction
> is not supported. To make following code work :
> numerics::matrix< std::complex< double > > complex_matrix(8,3);
> numerics::matrix< double > double_matrix(8,3);
> double_matrix[0] = complex_matrix[0] ;

Couldn't this be done with
double_matrix[0] = complex_matrix[0].real() ;
double_matrix[0] = numerics::detail::real(complex_matrix[0]) ;
> I patched following files (2 patches follow):

[Patch snipped]
Based on our earlier discussion
( we've recently
added expression templates for real(vector/matrix) and imag
(vector/matrix). You'll find the changes in boost CVS. If I've
understood your problem correctly, this should help also.

> I also noticed the use of the iterating_assign in vector_assign.
> you also consider a specialisation to use a memcpy when the
> are equal and POD types ?
This only would work if the rhs in vector_assign would be simple
(i.e. another vector). But such an assignment should be handled by
the corresponding assignment operator in the the vector class
already. IMO the first place to use memcpy as an optimization would
be in storage.h for example.

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