Boost logo

Ublas :

Subject: [ublas] std::accumulate with vector and matrix
From: Kraus Philipp (philipp.kraus_at_[hidden])
Date: 2010-12-03 16:33:46


I have a std::vector< ublas::matrix<T> > and std::vector<
ublas::vector<T> >. How can I use the std::accumulate for summerize
over the vector. Vector and matrix data have both the same size.
I would like to create (for example with the vector)

std::vector< ublas::vector<T> > x;
ublas::vector<T> sum = x[0];
fill x with data
for (std::size_t i=1; i < x.size(); ++i)
     sum += x[i];

I wouldn't use a loop, so how can I use the std::accumulate?