#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
for (unsigned j = 0; j < m.size2 (); ++ j) {
matrix_column<matrix<double> > mc (m, j);
for (unsigned i = 0; i < mc.size (); ++ i)
mc (i) = 3 * i + j;
std::cout << mc << std::endl;
std::cout << "dddd" << std::endl;
matrix_row<matrix<double> > ma = row(m, j);
std::cout<<ma<<std::endl;
}
std::cout<<m<<std::endl;
matrix_row<matrix<double> > ma = row(m, 0);
row(m,1) = ma;
std::cout<<m<<std::endl;
}
boost sparse matrix row and column
最新推荐文章于 2018-11-29 16:51:17 发布