Apply simd over eigen inner iterator of sparse matrix:
for(auto i = 0; i < smat.outerSize(); i++){
#pragma omp simd
for(SMat::InnerIterator iter(smat,i); it; ++it){
it.valueRef() = value;
}
}
This does not work due to an error with parenthetical initialization in for loop is incompatible with simd. Next I try:
SMat::InnerIterator iter(smat,i);
#pragma omp simd
for(;it;++it){ // error, declaration or initialization expected
for(it;it;++it){ // error, declaration or initialization expected
Then I google and search the documentation, only to encounter a phrase mentioning that simd is implicit when adding sparse matrices (so I know this is possible, and that somewhere in the templated bowels of eigen, there is a simd loop over the inner vector; but I don't know how to do it).
Next, I check and discover that Eigen has only three calls to omp in the entire code. Does this mean that Eigen is reliant only on compiler flags for simd activation?
Finally, I try changing the loop to canonical form (per comment below), and get a different error:
for(auto it = typename SMat::InnerIterator(smat,i); it; ++it)
// error: '#pragma omp simd' used with class iteration variable 'it'
What is the expected way to trigger or iterate over the inner vector in an Eigen::SparseMatrix<double> with simd?
for (auto it = Eigen::SparseMatrix<double>::InnerIterator(smat, i); it != false; ++it). - Daniel LangrInnerIteratoris indeed not documented at the moment. It could be made compatible to a standard random-access iterator (it lacks some operators likeit-diff,--it,it-=diff). For reference, the source is here: bitbucket.org/eigen/eigen/src/0fdf0e56237f92e5/Eigen/src/… - chtzInnerIteratoris mentioned in eigen.tuxfamily.org/dox/group__TutorialSparse.html, but that's a tutorial and doesn't detail the type properties. - Peter Cordes!=as an operator. - Zulan