You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The vector class has four functions to get iterators:
begin, end, rbegin, rend
each of these has a const version and a non-const version.
The Matrix<> class inherits these iterators, which is good, but should add two more sets of iterators, for rowind and col. The same should be done for CRSSparsity
Created by jaeandersson at: 2011-01-12T14:31:07 Last updated at: 2012-02-27T20:59:00
// Loop over rowsfor(int i=0; i<ret.size1(); ++i){
// Loop over nonzerosfor(int el=ret.rowind(i); el<ret.rowind(i+1); ++el){
// Get columnint j=ret.col(el);
// Get the nonzero of the dense matrixint el_dense = j+i*ret.size2();
// Save to mapping
mapping_dense[el_dense] = mapping[el];
}
}
becomes (pseudo-ish code):
// Loop over rowsfor (it = ret.NZ()) {
// Get the nonzero of the dense matrixint el_dense = it->col + (it->row)*ret.size2();
// Save to mapping
mapping_dense[it.dense] = mapping[el];
}
The text was updated successfully, but these errors were encountered:
The vector class has four functions to get iterators:
begin, end, rbegin, rend
each of these has a const version and a non-const version.
The Matrix<> class inherits these iterators, which is good, but should add two more sets of iterators, for rowind and col. The same should be done for CRSSparsity
Created by jaeandersson at: 2011-01-12T14:31:07
Last updated at: 2012-02-27T20:59:00
The text was updated successfully, but these errors were encountered: