|
Ublas : |
From: Manuel González Castro (iinmgc00_at_[hidden])
Date: 2007-03-30 11:53:21
Hi Karl,
> Thanks for this contribution. I am planning to add it, but ...
I fixed an error in the function, the correct code (tested under gcc and
VC++ 7.1) is:
------------- start --------------
// y <- x
template < typename vector_type_x, typename vector_type_y >
void copy(const vector_type_x &x, vector_type_y &y )
{
#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS
BOOST_STATIC_ASSERT( ( is_same< typename traits::vector_traits<
vector_type_y >::value_type, typename traits::vector_traits<
vector_type_x >::value_type >::value ) ) ;
#else
BOOST_STATIC_ASSERT( ( is_same< typename vector_type_y::value_type,
typename vector_type_x::value_type >::value ) ) ;
#endif
assert( traits::vector_size( x ) == traits::vector_size( y ) ) ;
typedef typename vector_type_x::value_type value_type ;
const int n = traits::vector_size( x ) ;
const int stride_x = traits::vector_stride( x ) ;
const int stride_y = traits::vector_stride( y ) ;
const value_type *x_ptr = traits::vector_storage( x ) ;
value_type *y_ptr = traits::vector_storage( y ) ;
detail::copy( n, x_ptr, stride_x, y_ptr, stride_y ) ;
}
------------- end --------------
> I am also interested in seeing the performance difference
> between std::copy and blas::copy. I think many people on the
> list would be quite interested. Thanks!
I will post results in a few days.
Thanks,
Manuel