<div class="gmail_quote">On Mon, May 14, 2012 at 9:33 PM, Andrew Spott <span dir="ltr"><<a href="mailto:andrew.spott@gmail.com" target="_blank">andrew.spott@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
What is the best way to selectively add/remove columns/rows of a Mat?<br>
<br>
Is there a way to do it in place, or does it require essentially moving the values to a new matrix?<br></blockquote><div><br></div><div>If you only need to add/remove a small number of values, it's best to allocate for all that might be present and just store explicit zeros.</div>
<div><br></div><div>To add or remove rows, you are also changing the vector size that can be multiplied against, and the data structure must be rebuilt. This is why it's frequently preferable to use MatZeroRows (or a variant) instead of removing them from the data structure.</div>
</div>