On Dec 21, 2012, at 3:16 PM, Nachiket Gokhale <gokhalen at gmail.com> wrote:
> I have a dense matrix A (100x100) and I want to extract a matrix B from it > consisting of the first N columns of A. Is there a better way to do it > than getting the column using MatGetColumnVector, followed by VecGetArray, > and MatSetValues? It could also be done using MatGetSubMatrix but is seems > to be more involved. MatGetSubMatrix() is exactly for this purpose and should not be particularly involved. Use ISCreateStride() to create an IS to indicate all the rows and and another ISCreateStride to indicate the 0 to N-1 columns. Barry > > Thanks, > > -Nachiket
