<div dir="ltr">Thanks Dirk, lots of useful information there.  I wonder whether the sparse ingestion <br><div>problem would best be solved with multiple passes -- it seems one would want</div><div>to learn the dimensions and the number of nonzero elements per row to</div><div>allocate the index vectors, and then populate them and the data vector with a final pass.  </div><div>Or one could use a buffering strategy to grow the index vectors as needed in a</div><div>one-pass approach.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 10, 2021 at 11:19 PM Dirk Eddelbuettel <<a href="mailto:edd@debian.org">edd@debian.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Vincent,<br>
<br>
In the broad terms of the question the best answer may be a simple "sure".<br>
More seriously, there have been many approaches.  Consider for example the<br>
recent Rcpp Gallery post lead by Zach (with some edits by me):<br>
  <a href="https://gallery.rcpp.org/articles/sparse-matrix-class/" rel="noreferrer" target="_blank">https://gallery.rcpp.org/articles/sparse-matrix-class/</a><br>
<br>
It's focus on not copying <i,p,x> again if we already have them as R vectors,<br>
which is a fair point. If the goal is to get to SuperLU via (Rcpp)Armadillo<br>
then I do not think you can avoid the (internal) copies.  As always, the<br>
answer may be "it depends".<br>
<br>
Hope this helps, happy to refine,  Dirk<br>
<br>
-- <br>
<a href="https://dirk.eddelbuettel.com" rel="noreferrer" target="_blank">https://dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a><br>
</blockquote></div>

<br>
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255)">The information in this e-mail is intended only for the person to whom it is</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255)"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255)">addressed. If you believe this e-mail was sent to you in error and the e-mail</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255)"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255)">contains patient information, please contact the Partners </span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255)">Compliance</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255)"> HelpLine at</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255)"><a href="http://www.partners.org/complianceline" rel="noreferrer" style="color:rgb(17,85,204);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255)" target="_blank">http://www.partners.org/<wbr>complianceline</a><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255)"> . If the e-mail was sent to you in error</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255)"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255)">but does not contain patient information, please contact the sender and properly</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255)"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;background-color:rgb(255,255,255)">dispose of the e-mail.</span>