Boost logo

Boost :

From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2002-02-12 06:39:30


jhrwalter wrote:

> --- In boost_at_y..., Toon Knapen <toon.knapen_at_s...> wrote:
>
>>Currently, real matrices can be assigned to complex matrices due to
>>
> the
>
>>automatic conversion from double to complex. The other direction
>>
> however
>
>>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() ;
>
> or
>
> double_matrix[0] = numerics::detail::real(complex_matrix[0]) ;
>
> already?

Is real() a member-function of matrix_row ? or is there a free function
real() that takes a matrix_row as an argument ? I can't find it. What's
even more, apparently the square bracket operator on a matrix are
apparantly not supported anymore. On my latest checkout following does
not work anymore

vector< double > vector( 3 );
matrix< double > matrix(8,3);
matrix[0] = vector;

>>I patched following files (2 patches follow):
>>
>
> [Patch snipped]
>
> Based on our earlier discussion
> (http://groups.yahoo.com/group/boost/message/21527) 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.
>

Great if you had added the functionality already. Can you provide a
small example to show me how to use it ?

>
>>I also noticed the use of the iterating_assign in vector_assign.
>>
> Would
>
>>you also consider a specialisation to use a memcpy when the
>>
> value_types
>
>>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.
>
> Regards
>
> Joerg
>
>
>
> Info: http://www.boost.org Send unsubscribe requests to: <mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk