
Ublas : 
Subject: Re: [ublas] [bindings][lapack] Initial highlevel solve
From: Rutger ter Borg (rutger_at_[hidden])
Date: 20090325 04:07:34
Rutger ter Borg wrote:
>
> I have thought about this, I guess this would become feasible if stuff
> mentioned in http://lists.boost.org/MailArchives/ublas/2009/03/3367.php is
> implemented. I.e., if is_bindable_vector<T> is a true_type, we could use
> an alternative traits implementation or dispatch (or something along that
> line). This would enable us to use a vector as if it is a matrix in a
> transparent way.
>
What could be done, is writing a matrix traits on the basis of vector
traits, something like
matrix_traits< T, enable_if<...L> >
matrix_traits< T, enable_if< is_bindable_vector< T > >::type >:
vector_as_matrix< T, remove_const<T> >
matrix_traits< T, enable_if< is_bindable_matrix< T > >::type >:
matrix_detail_traits< T, remove_const<T> >
template< typename T, typename M >
vector_as_matrix {
...
static pointer storage( matrix_type& m ) {
return vector_traits<T>::storage( m );
}
static ptrdiff_t num_columns( matrix_type& m ) {
return 1;
}
static ptrdiff_t num_rows( matrix_type& m ) {
return vector_traits<T>::size( m );
}
...
}
and then, all bindable_vectors would be addressable as Mx1 matrices, adding
trans would give 1xN.
Cheers,
Rutger