I'm doing a simulation where I must calculate many averages and I thought that using boost::accumulators would be a good idea. The problem is that one of the quantities I want to average is a symmetric matrix, whose diagonal is known beforehand. SO I just need to calculate the averages for Q[i][j] if i < j.
At first I got the impression that I could use a
using namespace boost::accumulators;
using namespace boost::numeric::ublas;
typedef accumulator_set<double, stats<tag::mean> > accumulator;
symmetric_matrix<accumulator, lower> foo; // a symmetric matrix of accumulators
to hold my accumulators. But then it occurred to me that this symmetric_matrix structure might be adequate to hold numerical values only (they have arithmetic operations defined) or are optimized for this kind of data in some way. Is this right?
If symmetric_matrix from boost are not adequate, I need a data structure that can hold the lower triangle of a symmetric matrix without the diagonal, and it must be suitable to hold the accumulators and have a nice matrix like syntax. Is this readily available from some library? If not, is there an easy implementation for this kind of structure around?
Try the Boost uBLAS Triangular matrix. Here is an example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With