<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:#3333FF;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:#3333FF;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:#3333FF;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:3.0cm 2.0cm 3.0cm 2.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="DA" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Will look at the RcppEigen package. For other purposes I already use the RBGL package which interfaces the boost graph library. However, the interface
 goes via S4 type methods – so everything is slow… ;)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Regards<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Søren<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"> Glenn Lawyer [mailto:lawyer@mpi-inf.mpg.de]
<br>
<b>Sent:</b> 24. juni 2012 19:56<br>
<b>To:</b> Søren Højsgaard<br>
<b>Cc:</b> rcpp-devel@lists.r-forge.r-project.org (rcpp-devel@r-forge.wu-wien.ac.at)<br>
<b>Subject:</b> Re: [Rcpp-devel] Using sparse matrices from the Matrix package in Rcpp<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I would suggest using the eigen library, Rccp has an interface to this. Alternately, you could link to the boost graph library.<br>
<br>
+glenn<br>
<br>
On 06/24/2012 06:12 PM, Søren Højsgaard wrote: <o:p></o:p></p>
<pre>Dear list<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>I have code for graph operations where I represent graphs as adjacency matrices (matrices with 0's and 1's). When graphs grow large storing all the 0's becomes uneconomical, so I want to use sparse matrices (from the Matrix package) for large graphs instead. Simple indexing operations like M[i,j] however are very slow, so I wonder if there are ways of dealing with sparse matrices (and rapid indexing) in the Rcpp framework. Apologies if I have overlooked posts on this topic.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Regards<o:p></o:p></pre>
<pre>Søren<o:p></o:p></pre>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>Rcpp-devel mailing list<o:p></o:p></pre>
<pre><a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><o:p></o:p></pre>
<pre><a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><o:p></o:p></pre>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<pre>-- <o:p></o:p></pre>
<pre>-----------------------------------<o:p></o:p></pre>
<pre>It is difficult to find a black cat in a dark room,<o:p></o:p></pre>
<pre>especially if there is no cat.<o:p></o:p></pre>
<pre>  -- Chinese proverb<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>  Dr. Glenn Lawyer                    <o:p></o:p></pre>
<pre>  +352 661 967 244              <o:p></o:p></pre>
<pre>  Max-Planck-Institut für Informatik<o:p></o:p></pre>
<pre>  Computational Biology and Applied Algorithmics<o:p></o:p></pre>
<pre>  Campus E1 4<o:p></o:p></pre>
<pre>  66123 Saarbrücken, Germany<o:p></o:p></pre>
<pre>  <a href="http://bioinf.mpi-inf.mpg.de/~lawyer">http://bioinf.mpi-inf.mpg.de/~lawyer</a><o:p></o:p></pre>
<pre><o:p> </o:p></pre>
</div>
</body>
</html>