<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 14, 2013 at 2:56 PM, Sanjay Govindjee <span dir="ltr"><<a href="mailto:s_g@berkeley.edu" target="_blank">s_g@berkeley.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":2ap">When I pre-allocated, I preallocated sufficient on and off and off processor memory for<br>
all possible non-zero patterns. So I assume that there will not be any mallocs necessary.<br>
Or am I mis-understanding how the preallocation works?</div></blockquote></div><br>You need to _insert_ values there, otherwise they will be compressed out in the first assembly. It's not really the allocation that's expensive, it's the contiguous storage, which is important for performance elsewhere. If you insert explicit zeros the first time you assemble, then you won't need to set MAT_NEW_NONZERO_LOCATIONS.</div>
</div>