-
Notifications
You must be signed in to change notification settings - Fork 0
Description
When I tried ConstructDiffusionOperators() with 45k cells, first I encountered this error.
Error in diag(P) : no method for coercing this S4 class to a vector
From the source code, we see that base::diag() is called on a Matrix object which is returned by Doubly_stochastic() function in case matrix columns exceed 10k. If it was < 10k, it returns a dense matrix, otherwise it returns a sparse Matrix produced by sinkhorn_knopp_largedata().
LocalizedMarkerDetector/R/matrix_operation.R
Line 151 in c1f4c0d
| sinkhorn_knopp_largedata = function(A, niter = 100, tol = 1e-8, verb = FALSE) { |
At first I thought specifying Matrix::diag() to fix the error solves the problem, but then I found that the self-multiplication P <- P %*% P of the sparse Matrix takes too long after just 2 iterations. Instead, I think P should always be a dense matrix, so that its multiplication takes a fixed amount of time while taking advantage of OpenBLAS multi-threading.
Update:
I think I found another bug. In the tutorial, the next function fast_get_lmd() cannot take rho as a sparse Matrix. You need to coerce it to a dense matrix, otherwise this error happens.
Error: Not compatible with requested type: [type=S4; target=double].