[Rcppdevel] DulmageMendelsohn decomposition in R via Rcpp
Dirk Eddelbuettel
edd at debian.org
Wed Mar 25 13:00:31 CET 2020
On 25 March 2020 at 12:36, Martin Maechler wrote:

 Dear Mauricio (et al),

 I'm the maintainer of the 'Matrix' package (and just reading
 digests of Rcppdevel, hence no "proper reply").
Nice! In the StackOverflow thread leading up to this, I actualy mentioned
that the CSparse files that the OP desires are already in Matrix.
Maybe you can export the (Clevel) function(s) he needs. If you set up normal
export in Matrix, we can pick it up pretty easily. There are some other
packages using it, inter alia expm where Vincent did this with some gentle
guidance from me (though he chose to not credit me, oh well). I see you
maintain that now too...
 This looks quite interesting and relevant to me,
 and I'd be interested to add this decomposition to the Matrix
 package, so would be happy if you already have code for parts of
 it.

 As CSparce, Matrix uses simple C though, and hence this posting
 is only peripherally related to Rcpp.
For package interop Rcpp can help as well. I have two simple packages
(RApiDatetime, RApiSerialize) exporting C level code which other (Rcppusing)
packages import. They provide working examples which Mauricio could
study/copy. We have also the grandfather of them all at the C level (matrix +
lme4) and a few more (zoo + xts) plus surely a few I do not remember now...
Dirk
 Best regards,

 Martin Maechler
 ETH Zurich and R Core team


 > Date: Wed, 25 Mar 2020 01:22:16 0300
 > From: Mauricio Vargas <mvargas at dcc.uchile.cl>
 > To: rcppdevel at rforge.wuwien.ac.at
 > Subject: [Rcppdevel] DulmageMendelsohn decomposition in R via Rcpp

 > Dear community

 > Dr. Eddelbuettel suggested me to ask here.

 > I am trying to implement *DulmageMendelsohn decomposition* in R. CSparse
 > already has a function to do this, and it's not exported in Matrix so I
 > took the C files and tried to use them in R.

 > I decided to sketch this into an R Package with Rcpp:
 > https://github.com/pachamaltese/dulmagemendelsohn

 > The final goal is to find a permutation matrix, so that the original matrix
 > is rearranged into a block diagonal matrix:

 > matrix_input < matrix(
 > c(0,0,7,0,0,
 > 0,0,0,0,3,
 > 5,0,0,1,0,
 > 0,0,2,0,0,
 > 0,1,0,0,0),
 > ncol = 5, nrow = 5
 > )

 > dm_decomposition < function(matrix_input) {
 > # the actual decomposition happens here
 > # ... "MAGIC" ...

 > # but here is an example output
 > matrix(
 > c(0,7,0,0,0,
 > 5,0,1,0,0,
 > 0,2,0,0,0,
 > 0,0,0,0,3,
 > 0,0,0,1,0),
 > ncol = 5, nrow = 5
 > )
 > }

 > dm_decomposition(matrix_input)

 > Can you please provide me some guidance to get this working?

 > I am by no means a C/C++ expert, I just have experience with statistics an
 > writing R packages.


 > *Mauricio Vargas Sepúlveda 帕夏*
 > Do you like Data Science? visit pacha.hk

 >  next part 
 > An HTML attachment was scrubbed...
 > URL: <http://lists.rforge.rproject.org/pipermail/rcppdevel/attachments/20200325/d88b3c55/attachment0001.html>
 _______________________________________________
 Rcppdevel mailing list
 Rcppdevel at lists.rforge.rproject.org
 https://lists.rforge.rproject.org/cgibin/mailman/listinfo/rcppdevel

http://dirk.eddelbuettel.com  @eddelbuettel  edd at debian.org
More information about the Rcppdevel
mailing list