Closed kokitsuyuzaki closed 3 years ago
Hi, Constantin
I found that CRAN einsum cannot use in implicit mode without explicit indicator (->). https://github.com/const-ae/einsum/blob/a5e1152fac2b15d36f691f357f9ca586a49c51be/man/einsum.Rd#L16-L18
It'll be fine, implicit mode is sometimes misleading. However, CRAN einsum can actually be performed in different meaning like below.
For example, in Numpy's einsum, implicit mode just shows the whole data.
# Numpy (Python) import numpy as np data = np.random.rand(3, 4) np.einsum('ij', data) # array([[0.50142663, 0.845945 , 0.36696267, 0.00643327], # [0.14395742, 0.73767592, 0.81586026, 0.40644605], # [0.12538026, 0.92932431, 0.2329707 , 0.10398253]])
However, in CRAN einsum, it is interpreted as the summation over the indices i and j.
# einsum (R) library("einsum") data <- array(runif(3*4), dim=c(3,4)) einsum('ij', data) # [1] 2.951262
Wouldn't it be more trouble-free to ban equation_strings containing "->"? For example, how about including the following argument check?
if(length(grep("->", "equation_string")) == 0){ stop("Please make sure that equation_string has explicit indicator (->)") }
Thanks for the report. I added the check that you suggested :)
Hi, Constantin
I found that CRAN einsum cannot use in implicit mode without explicit indicator (->). https://github.com/const-ae/einsum/blob/a5e1152fac2b15d36f691f357f9ca586a49c51be/man/einsum.Rd#L16-L18
It'll be fine, implicit mode is sometimes misleading. However, CRAN einsum can actually be performed in different meaning like below.
For example, in Numpy's einsum, implicit mode just shows the whole data.
However, in CRAN einsum, it is interpreted as the summation over the indices i and j.
Wouldn't it be more trouble-free to ban equation_strings containing "->"? For example, how about including the following argument check?