I have an std::vector and I want to convert it into a arma::rowvec
I've done:
vector<int> x = foo();
rowvec a;
vector<int>::const_iterator iter2;
int j = 0;
for(iter2 = x.begin(); iter2 != x.end(); ++iter2) {
a(j++,0) = *iter2;
}
a.print("a");
but I get:
error: Mat::operator(): out of bounds
terminate called after throwing an instance of 'std::logic_error'
what():
If instead of a(j++,0) = *iter2;
I use a << *iter2;
in final rowvec, I get only the last element.