This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[newb] slices?

Tags: None
(comma "," separated)
nbecker
Registered Member
Posts
4
Karma
0

[newb] slices?

Fri Jul 16, 2010 11:30 am
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)?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: [newb] slices?

Fri Jul 16, 2010 12:11 pm
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));
nbecker
Registered Member
Posts
4
Karma
0

Re: [newb] slices?

Fri Jul 16, 2010 12:16 pm
How about a subset of a vector, or a strided view of a vector (e.g., every 2nd element)?


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]