#include <iostream>
#include <armadillo>
using namespace std;
using namespace arma;
typedef sp_fmat::row_iterator it1_t;
int main(int argc, char** argv)
{
int dim = 10;
sp_fmat a(dim,dim);
sp_fmat b(dim,dim);
for(size_t i = 0; i < dim; i++)
a(i,i) = i*8;
a(2,3) = 3;
b = b -a;
cout<<b<<endl;
cout<<a<<endl;
for(it1_t it1 = a.begin_row(1); it1 != a.end_row(2);it1++)
cout<<*it1<<" "<<it1.row()<<" "<<it1.col()<<endl;
cout<<b.n_rows<<" "<<b.n_cols<<endl;
return 0;
}
Armadillo sparse matrix get the index of an element
最新推荐文章于 2022-03-28 21:22:17 发布