<div dir="ltr"><div dir="ltr">On Thu, Jun 18, 2020 at 4:22 PM Rakesh Halder <<a href="mailto:rhalder@umich.edu">rhalder@umich.edu</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi all,</div><div><br></div><div>I'm writing an algorithm using PETSc that requires part of an (N x k) matrix, where k << N. Specifically, my algorithm loops from j = 1 to k, and uses j columns of the matrix of a time. I've been creating a new matrix for each iteration, and use MatGetColumnVector to get the values for each column vector, scatter them into a new vector, and then use MatSetValue to populate my matrix. MatGetColumnVector is very slow, and I was thinking of using MatCreateSubMatrix. However, I'm not entirely sure how to get the correct IS that would allow me to create a submatrix using the first j columns of the matrix at a time. I'm running in parallel, and the matrix is an MPIAIJ matrix. I've looked at examples of MatCreateSubMatrix as well as examples including the use of IS, but I'm still not very sure how to use them.</div></div></blockquote><div><br></div><div>Use a ISStride of [0, N) for an MxN matrix for the column IS and you will get everything in the row, which is what you want.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Thanks,</div><div><br></div><div>Rakesh<br></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>