const-ae / einsum

Einstein Summation for Arrays in R
https://const-ae.github.io/einsum/
Other
10 stars 1 forks source link

Submission to CRAN (proposal) #1

Closed kokitsuyuzaki closed 3 years ago

kokitsuyuzaki commented 3 years ago

Hi,

Thanks for the great package. This is really useful when the data structure is complex. Do you have a plan to submit this package to the CRAN repository? I want to use this functionality by importing this package.

Regards,

const-ae commented 3 years ago

Hey,

thank you for the interest in the package. Yes, I actually did plan to submit it to CRAN, but then there were some problems with the CRAN checks. Specifically, the mathjaxr that I used to properly typeset the equations in the documentation was problematic. And then my main research projects, for which I wrote the package moved on, so I simply got busy with other stuff.

I think there might be several ways forward:

1) Figure out why I get the error message and fix it 2) Remove all references to \mjseqn{} from the documentation and replace them with normal \eqn{} references

It actually should be pretty straightforward, so I will try and see what I can do next week.


Alternatively, as an immediate solution, you can also use einsum_generator(equation_string, compile_function = FALSE) to generate the source code for a C++ program that you could paste into your R package :)

Best, Constantin

const-ae commented 3 years ago

Of course, you could speed up the process by helping me debug the issue if you want to :)

kokitsuyuzaki commented 3 years ago

It seems that \text in the man/einsum.Rd does not work for some reason. I replaced it to \textrm and R CMD build could be performed. I'm not familiar with mathjaxr though, in R running in terminal, the equations were not converted as shown below, but I wonder if they would be displayed more beautifully in a desktop version of R.

library(einum)
?einsum

Details:

     The following table show, how the Einstein notation abbreviates
     complex summation for arrays/matrices:

       ‘equation_string’                                    Formula
       --------                                       -------------             ------------
       ‘"ij,jk->ik"’                Y_{ik} = sum_{j}{A_{ij} B_{jk}}    Matrix multiplication
       ‘"ij->ji"’`                                        Y = A^{T}                Transpose
       ‘"ii->i"’                               y = \textrm{diag}(A)                 Diagonal
       ‘"ii->ii"’                            Y = \textrm{diag}(A) I  Diagonal times Identity
       ‘"ii->"’               y = \textrm{trace}(A) = sum_i{A_{ii}}                    Trace
       ‘"ijk,mjj->i"’     y_i = sum_{j}sum_{k}sum_{m}A_{ijk}B_{mjj}     Complex 3D operation
kokitsuyuzaki commented 3 years ago

Hi, Constantin

I confirmed that mathjaxr properly worked in the desktop R, although it does not work in the terminal R.

I checked the source code and looks good to register einsum to CRAN.

If there is no problem, could you accept my pull request and register einsum to CRAN?

Koki

スクリーンショット 2021-05-13 11 36 00 スクリーンショット 2021-05-13 11 35 52

const-ae commented 3 years ago

Thanks for your help. I have submitted einsum to CRAN. You can track the process via https://lockedata.github.io/cransays/articles/dashboard.html

const-ae commented 3 years ago

It's on CRAN https://CRAN.R-project.org/package=einsum 🎉 🥳

Thanks again for helping me push this over the finish line :)

kokitsuyuzaki commented 3 years ago

Congrats!!!

const-ae commented 3 years ago

Thanks :)