Boost logo

Ublas :

Subject: [ublas] mix matrix slice with matrix range
From: Kraus Philipp (philipp.kraus_at_[hidden])
Date: 2010-07-12 17:57:01


I have a NxM matrix and I would like to extract some rows / columns. I
have try to use the matrix_slice command, but I need specify only the
rows / columns and need the full range for columns / rows:

For illustrating (not syntactic correct):

unsigned int rows[5];
// dynamic fill rows[i]

ublas::matrix_slice< ublas::matrix<double> > extract(mymatrix,
ublas::slice(rows), ublas::range(0, mymatrix::size2()-1));

// create
ublas::matrix<double> newmatrix = extract;

How can I create a new matrix with the full row / column range from
some columns / rows?