|
Boost Users : |
Subject: [Boost-users] symmetric_matrix operation
From: Archie14 (admin_at_[hidden])
Date: 2009-05-26 13:50:53
I am very new to the whole Ublas library. I have two symmetric matrices and I
need to divide each element of the first matrix to the element in the second
matrix. I am now doing smth like this:
int _matrixsize;
symmetric_matrix<double> mfirst(_matrixsize);
symmetric_matrix<double> msecond(_matrixsize);
symmetric_matrix<double> ratio (_matrixsize);
for (int ifirst = 0; ifirst < _matrixsize; ifirst++)
for (int isecond = 0; isecond < _matrixsize; isecond++)
ratio(ifirst, isecond) = mfirst(ifirst, isecond) / msecond
(ifirst, isecond);
My questions are:
1. Can I use iterators (begin1, begin2) and if yes, then how? Examples in the
doc use above method of iterating through elements, without using iterators.
2. I did not find built-in operators in the symmetric_matrix to do this
division, but may be I overlooked smth or did not understand the docs?
3. If matrix "msecond" contains zeros - what is the "boost-way" to deal with
this?
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