<div dir="ltr"><div>Dear Dr. Maechler</div><div><br></div><div>Thanks a lot.</div><div><br></div><div>You can find the code here:</div><div><a href="https://github.com/pachamaltese/dulmagemendelsohn/blob/master/src/cs_dmperm.c">https://github.com/pachamaltese/dulmagemendelsohn/blob/master/src/cs_dmperm.c</a></div><div><br></div><div>And this part is already in Matrix:</div><div><a href="https://github.com/pachamaltese/dulmagemendelsohn/blob/master/src/cs.h">https://github.com/pachamaltese/dulmagemendelsohn/blob/master/src/cs.h</a></div><div><br></div><div>You are right about the tangent with respect to Rcpp.</div><div><br></div><div>So far, I cannot make it work in R, but it works from shell, so I really appreciate your interest to make the code reproducible.</div><div><br></div><div>Best,<br></div><div><br></div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div style="font-size:small"><div dir="ltr" style="font-size:12.8px"><div style="font-size:small"><div><span style="font-size:24pt;font-family:"arial black",sans-serif;color:rgb(1,104,179);line-height:13.8px">——</span><span style="font-size:24pt;font-family:"arial black",sans-serif;color:rgb(238,58,67);line-height:13.8px">———</span></div><div><br></div><i>Mauricio Vargas Sepúlveda 帕夏</i><br></div>Do you like Data Science? visit <a href="http://pacha.hk/" target="_blank">pacha.hk</a></div><div dir="ltr" style="font-size:12.8px">你爱科学数据专吗?你走<a href="http://pacha.hk/" target="_blank">pacha.hk</a></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 25, 2020 at 8:36 AM Martin Maechler <<a href="mailto:maechler@stat.math.ethz.ch">maechler@stat.math.ethz.ch</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>
Dear Mauricio (et al),<br>
<br>
I'm the maintainer of the 'Matrix' package (and just reading<br>
digests of Rcpp-devel, hence no "proper reply").<br>
<br>
This looks quite interesting and relevant to me,<br>
and I'd be interested to add this decomposition to the Matrix<br>
package, so would be happy if you already have code for parts of<br>
it.<br>
<br>
As CSparce, Matrix uses simple C though, and hence this posting<br>
is only peripherally related to Rcpp.<br>
<br>
Best regards,<br>
<br>
Martin Maechler<br>
ETH Zurich and R Core team<br>
<br>
<br>
> Date: Wed, 25 Mar 2020 01:22:16 -0300<br>
> From: Mauricio Vargas <<a href="mailto:mvargas@dcc.uchile.cl" target="_blank">mvargas@dcc.uchile.cl</a>><br>
> To: <a href="mailto:rcpp-devel@r-forge.wu-wien.ac.at" target="_blank">rcpp-devel@r-forge.wu-wien.ac.at</a><br>
> Subject: [Rcpp-devel] Dulmage-Mendelsohn decomposition in R via Rcpp<br>
<br>
> Dear community<br>
<br>
> Dr. Eddelbuettel suggested me to ask here.<br>
<br>
> I am trying to implement *Dulmage-Mendelsohn decomposition* in R. CSparse<br>
> already has a function to do this, and it's not exported in Matrix so I<br>
> took the C files and tried to use them in R.<br>
<br>
> I decided to sketch this into an R Package with Rcpp:<br>
> <a href="https://github.com/pachamaltese/dulmagemendelsohn" rel="noreferrer" target="_blank">https://github.com/pachamaltese/dulmagemendelsohn</a><br>
<br>
> The final goal is to find a permutation matrix, so that the original matrix<br>
> is rearranged into a block diagonal matrix:<br>
<br>
> matrix_input <- matrix(<br>
> c(0,0,7,0,0,<br>
> 0,0,0,0,3,<br>
> 5,0,0,1,0,<br>
> 0,0,2,0,0,<br>
> 0,1,0,0,0),<br>
> ncol = 5, nrow = 5<br>
> )<br>
<br>
> dm_decomposition <- function(matrix_input) {<br>
> # the actual decomposition happens here<br>
> # ... "MAGIC" ...<br>
<br>
> # but here is an example output<br>
> matrix(<br>
> c(0,7,0,0,0,<br>
> 5,0,1,0,0,<br>
> 0,2,0,0,0,<br>
> 0,0,0,0,3,<br>
> 0,0,0,1,0),<br>
> ncol = 5, nrow = 5<br>
> )<br>
> }<br>
<br>
> dm_decomposition(matrix_input)<br>
<br>
> Can you please provide me some guidance to get this working?<br>
<br>
> I am by no means a C/C++ expert, I just have experience with statistics an<br>
> writing R packages.<br>
<br>
<br>
> *Mauricio Vargas Sepúlveda 帕夏*<br>
> Do you like Data Science? visit <a href="http://pacha.hk" rel="noreferrer" target="_blank">pacha.hk</a><br>
<br>
> -------------- next part --------------<br>
> An HTML attachment was scrubbed...<br>
> URL: <<a href="http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20200325/d88b3c55/attachment-0001.html" rel="noreferrer" target="_blank">http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20200325/d88b3c55/attachment-0001.html</a>><br>
</blockquote></div>