-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
confusion about the smooth_gaussian_kernel.cpp with mnnCorrect() #20
Comments
Is there an actual error you want to report, or are you just poking around in the C++ code for fun? It's fine if it's the latter, I just want to know. |
In the source code with the package , It run fine and didn't throw any error,So It isn't an actual error, I just very confused with the C++ code. In my opinion ,It should throw an error but the paragram didn't in fact. Can you give me some hints about this problem? I wonder I have demonstrate this problem or not? |
The existing logic is correct, the number of columns of
Clearly the current code is working correctly, so you should just do whatever it's doing. |
Your installation is quite out of date compared to the code in this repository. For example, the corresponding R code is now: Lines 453 to 456 in 719f63a
|
I want to implement the mnnCorrect() function with R(without C++), so I read the source code of smooth_gaussian_kernel.cpp. In the smooth_gaussian_kernel function:
const size_t ngenes=averaged.nrow();
const size_t nmnn=averaged.ncol();
if (nmnn!=index.size()) { throw std::runtime_error("'index' must have length equal to number of rows in 'averaged'"); }
the variable nmnn represents the column of "averaged", why it should be equal to number of rows in "averaged" in the if condition?
When I debug the .cpp source file with lldb, I found I have to transpose the "averaged" before I call the smooth_gaussion_kernel function in the smooth_gaussian_kernel.cpp, otherwise It will throw the error
'index' must have length equal to number of rows in 'averaged'
. but in the R code where mnnCorrect call this C++ function.function (data1, data2, mnn1, mnn2, tdata2, sigma) { vect <- data1[mnn1, , drop = FALSE] - data2[mnn2, , drop = FALSE] cell.vect <- .Call(cxx_smooth_gaussian_kernel, vect, mnn2 - 1L, tdata2, sigma) t(cell.vect) }
It didn't transpose the vect(in my simulation data,the number of columns of vect represents the number of genes ), but it give the correct result and didn't throw an error, I get confused and dont know why this happens? In a word, I have two problems,
if n_genes==index.size()
instead ofif (nmnn!=index.size())
,Originally posted by @yuxiaokang-source in #18 (comment)
The text was updated successfully, but these errors were encountered: