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
using SparseArrays
a =spzeros(2^32)
a[rand(UInt16,6)] =rand(6)
# this variant is very slow, on bigger Arrays error@time (m,i)=findmax(a)
# this variant is quick, also on bigger Arrays# todo correct result if only negative values in a@timebegin
(m1,tmp) =findmax(findnz(a)[2])
i1 =findnz(a)[1][tmp]
end@show m i m1 i1
versioninfo()
Julia Version 1.6.0
Commit f9720dc (2021-03-24 12:55 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
Environment:
JULIA_EDITOR = code
JULIA_NUM_THREADS =
The text was updated successfully, but these errors were encountered:
fredrikekre
changed the title
findmax on SparseArray works bad or not (on big Arrays)
Missing optimization for findmax/findmin on SparseVector
Oct 27, 2021
Output:
21.400888 seconds (9 allocations: 224 bytes)
0.000028 seconds (14 allocations: 784 bytes)
m = 0.8275944812507452
i = 51128
m1 = 0.8275944812507452
i1 = 51128
51128
Julia Version 1.6.0
Commit f9720dc (2021-03-24 12:55 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
Environment:
JULIA_EDITOR = code
JULIA_NUM_THREADS =
The text was updated successfully, but these errors were encountered: