You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for (auto k = indptr1[i]; k < indptr1[i + 1]; k++) {
if (indices1[k] == j) {
left_val = data1[k];
}
}
This seems like it could be replaced by a binary search, assuming that the inputs represent slots from a dgCMatrix; entries of i should always be sorted within each column specified by p.
This should be faster for any decently sized input matrix where you're getting >100 non-zero entries in each column (I don't know if this is particularly common?), and saves two lines as well.
(Not that I have any concerns about speed; I was trawling through the code for other reasons and just happened to notice this. Just something to consider.)
The text was updated successfully, but these errors were encountered:
Thanks a lot. I think that part of the code was translated directly from the Python and I forgot to go back and make any sort of optimization or C++ify it.
Would you be interested in creating a PR and adding yourself to the author list as a contributor in the DESCRIPTION? I already have a couple of tests around general_simplicial_set_intersection which calls the C++ code, so you wouldn't have to add any tests.
Looking at:
uwot/src/supervised.cpp
Lines 71 to 75 in 3e359a3
This seems like it could be replaced by a binary search, assuming that the inputs represent slots from a
dgCMatrix
; entries ofi
should always be sorted within each column specified byp
.This should be faster for any decently sized input matrix where you're getting >100 non-zero entries in each column (I don't know if this is particularly common?), and saves two lines as well.
(Not that I have any concerns about speed; I was trawling through the code for other reasons and just happened to notice this. Just something to consider.)
The text was updated successfully, but these errors were encountered: