Boost logo

Boost Users :

Subject: Re: [Boost-users] [uBLAS] Predefined subrange or project
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-03-09 04:09:02


On 09/03/2011 09:59, sguazt wrote:

> namespace ublas = ::boost::numeric::ublas;
>
> template<typename MatrixT>
> inline
> ublas::matrix_range<MatrixT> topleft(MatrixT& M)
> {
> return ublas::subrange(M, 0, 3, 0, 3);
> }
>
> and use this function just like the case here below:
>
>> matrix<double> A(9,9);
>> topleft(A) = zero_matrix<double>(3,3);
>>

You might want to provide a const overload as well.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net