<div class="gmail_quote">On Sat, Oct 1, 2011 at 02:33, behzad baghapour <span dir="ltr">&lt;<a href="mailto:behzad.baghapour@gmail.com">behzad.baghapour@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>I want to copy some elements of a calculated matrix (A) into another matrix (B) with DIFFERENT_NONZERO_PATTERN.</div></blockquote><div><br></div><div>Which &quot;some elements&quot;?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div>How could I efficiently do this?</div>
<div>Is this should be done after or before matrix assembly of (A)?</div></blockquote><div><br></div><div>You can only copy after assembling A.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div>Then, what is the sparse pattern of the matrix (A) after assembling and how is the correct access into its elements?</div></blockquote></div><br><div>You probably want MatGetSubMatrix().</div>