Boost logo

Ublas :

From: Jeremy Conlin (jeremit0_at_[hidden])
Date: 2008-06-09 15:16:57


On Mon, Jun 9, 2008 at 2:24 PM, Jesse Manning <manning.jesse_at_[hidden]>
wrote:

> This is the most straight forward way I can think of.
>
> typedef ublas::matrix<double> Mat_t;
> typedef ublas::matrix_row<Mat_t> Row_t;
> typedef Mat_t::size_type size_t;
>
> Mat_t data(10, 3);
> // fill out matrix here
>
> for (size_t index = 0, end = data.size1(); index != end; ++index)
> {
> Row_t row(ublas::row(data, index));
>
> row /= ublas::norm_2(row);
> }
>

That's simple enough. I have a bad habit of not using typedefs. Using
typedefs as you have illustrated makes it much cleaner.

Thanks,
Jeremy