<div dir="ltr"><div>Thanks a lot.</div><div><br></div><div>After reading that DM decomposition can be eventually be added to Matrix, the toyectic package becomes useless by definition,</div><div>so that repo is discarded right away.<br></div><br><div>It could be great to have Matrix::dulmage_mendelsohn() to do something similar as what you would do in octave/matlab/python.</div><div><br></div><div>And once again, I never used Rcpp on a scale that is not "elemental".<br></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><div dir="ltr"><div style="font-size:small"><span><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="font-size:small"><div><span style="font-size:24pt;font-family:"arial black",sans-serif;color:rgb(60,59,110);line-height:12px">———</span><span style="font-size:24pt;font-family:"arial black",sans-serif;color:rgb(178,34,52);line-height:12px">———</span><br></div><b>Mauricio 'Pachá' Vargas Sepúlveda</b><br></div>Site: <a href="https://pacha.dev" target="_blank">pacha.dev</a></div><div>Blog: <a href="https://pacha.dev/blog" target="_blank">pacha.dev/blog</a></div></div></div></div></div></div></div></div></span></div></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 10:18 AM 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>
Mauricio,<br>
<br>
On 25 March 2020 at 10:06, Mauricio Vargas wrote:<br>
| Dear Dr. Maechler<br>
| <br>
| Thanks a lot.<br>
| <br>
| You can find the code here:<br>
| <a href="https://github.com/pachamaltese/dulmagemendelsohn/blob/master/src/cs_dmperm.c" rel="noreferrer" target="_blank">https://github.com/pachamaltese/dulmagemendelsohn/blob/master/src/cs_dmperm.c</a><br>
| <br>
| And this part is already in Matrix:<br>
| <a href="https://github.com/pachamaltese/dulmagemendelsohn/blob/master/src/cs.h" rel="noreferrer" target="_blank">https://github.com/pachamaltese/dulmagemendelsohn/blob/master/src/cs.h</a><br>
| <br>
| You are right about the tangent with respect to Rcpp.<br>
| <br>
| So far, I cannot make it work in R, but it works from shell, so I really<br>
| appreciate your interest to make the code reproducible.<br>
<br>
You should be able to find several articles at the Rcpp Gallery that show hot<br>
to do that. You can "practice" with functions from packages that are already<br>
exported as Martin may be able to export one for you. To expect Martin, who<br>
doesn't even code much in C++, to fix your package for you may not be an<br>
entirely realistic, or fair, expectation.<br>
<br>
Dirk<br>
<br>
| <br>
| Best,<br>
| <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>
| 你爱科学数据专吗?你走<a href="http://pacha.hk" rel="noreferrer" target="_blank">pacha.hk</a><br>
| <br>
| <br>
| On Wed, Mar 25, 2020 at 8:36 AM Martin Maechler <<a href="mailto:maechler@stat.math.ethz.ch" target="_blank">maechler@stat.math.ethz.ch</a>><br>
| wrote:<br>
| <br>
| ><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.<br>
| > CSparse<br>
| > > already has a function to do this, and it's not exported in Matrix<br>
| > 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<br>
| > 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<br>
| > 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: <<br>
| > <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>
| > ><br>
| ><br>
| _______________________________________________<br>
| Rcpp-devel mailing list<br>
| <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">Rcpp-devel@lists.r-forge.r-project.org</a><br>
| <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" rel="noreferrer" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
-- <br>
<a href="http://dirk.eddelbuettel.com" rel="noreferrer" target="_blank">http://dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a><br>
</blockquote></div>