I’m getting a ReadOnlyMemoryError
from:
julia> t .-= t[1]
ERROR: ReadOnlyMemoryError()
Stacktrace:
[1] - at ./float.jl:397 [inlined]
[2] _broadcast_getindex_evalf at ./broadcast.jl:578 [inlined]
[3] _broadcast_getindex at ./broadcast.jl:551 [inlined]
[4] getindex at ./broadcast.jl:511 [inlined]
[5] macro expansion at ./broadcast.jl:843 [inlined]
[6] macro expansion at ./simdloop.jl:73 [inlined]
[7] copyto! at ./broadcast.jl:842 [inlined]
[8] copyto! at ./broadcast.jl:797 [inlined]
[9] materialize!(::SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true}, ::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(-),Tuple{SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true},Float64}}) at ./broadcast.jl:756
[10] top-level scope at none:0
julia> typeof(t)
SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true}
I can’t reproduce the error with
parent = rand(100)
t = view(parent, 1:100)
t .-= t[1]
despite the fact that the two t
s (my original one and this one) have the same types and dimensions.
But, I’ve created a MWE (involving the real data that causes this), it’s just 5 LOC, requires JuliaDB
& DataDeps
(to fetch the data), and is available as a gist here.
Hope someone can figure out where the problem is!