Registered Member
|
newb here. Does Eigen support slices? (i.e., can eigen represent a slice of a vector or matrix without copying pass this to an algorithm, and can an algorithm
that operates on an eigen container operate on a slice with no change to the algorithm interface)? |
Moderator
|
if by slice you mean a row, a column, or a block submatrix, then yes, but you have to template your functions, e.g.:
template<typename DerivedA, typename DerivedB> void foo(const MatrixBase<DerivedA>& a, const MatrixBase<DerivedB>& b); MatrixXf m(10,10); foo(m.col(2), m.block(1,2,7,5)); |
Registered Member
|
How about a subset of a vector, or a strided view of a vector (e.g., every 2nd element)?
|
Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]