-
Notifications
You must be signed in to change notification settings - Fork 120
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
conversion to pointer not defined for SubArray{Float64, 1, Vector{Float64}, Tuple{UnitRange{UInt64}}, true}
#219
Comments
This is, sort of, reasonable: to efficiently calculate distance, Distances.jl (note that the error is triggered from within that package) uses BLAS matrix multiplication routines. These routines require that the memory layout for the matrix is regular. Which is not the case in your situation. To fix it, try using |
However, everything works fine when I change the type of the index: So, I'm very confused about why the type of the index (
That would allocate a new matrix, right? I specifically don't want to allocate a new matrix because I need to extract tens of thousands of different slices of julia> using BenchmarkTools
julia> data = rand(1000);
julia> @benchmark data[1:600]
BenchmarkTools.Trial: 10000 samples with 199 evaluations.
Range (min … max): 520.452 ns … 61.369 μs ┊ GC (min … max): 0.00% … 96.91%
Time (median): 867.467 ns ┊ GC (median): 0.00%
Time (mean ± σ): 2.051 μs ± 7.376 μs ┊ GC (mean ± σ): 52.44% ± 14.08%
█▂▄ ▁
███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▃▁▁▁▁▄▁▁▁▁▃▁▄▄▃▅▄▃▅▇▇▆▇ █
520 ns Histogram: log(frequency) by time 52.4 μs <
Memory estimate: 4.81 KiB, allocs estimate: 1.
julia> @benchmark @view data[1:600]
BenchmarkTools.Trial: 10000 samples with 994 evaluations.
Range (min … max): 33.188 ns … 1.336 μs ┊ GC (min … max): 0.00% … 95.67%
Time (median): 34.657 ns ┊ GC (median): 0.00%
Time (mean ± σ): 37.477 ns ± 37.798 ns ┊ GC (mean ± σ): 3.13% ± 3.04%
▄▇█▆▆▄▄▂▄▄▅▄▃▁ ▁ ▂
██████████████▇▇▆▅▆▅▅██▇▇▇▇▇▆▇▇▆▆▆▅▅▄▄▅▁▄▅▇▇▇████▇▇▇▇▆▆▆▆▆▆ █
33.2 ns Histogram: log(frequency) by time 59.1 ns <
Memory estimate: 48 bytes, allocs estimate: 1.
julia>
Initially, I wanted to report this straight to the main Julia repo (since the error appears inside |
Thanks for the detailed investigation! |
Yeah, I've already replaced |
I'm trying to run clustering on a view with indices of type
UInt64
, but getting the error in the title.Code:
Output:
/Users/forcebru/test/uint64_view.jl:11
is the last line of the code above.The text was updated successfully, but these errors were encountered: