Skip to content
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

Fix summary for cases of mixed indices-types #20431

Merged
merged 1 commit into from
Feb 5, 2017
Merged

Fix summary for cases of mixed indices-types #20431

merged 1 commit into from
Feb 5, 2017

Conversation

timholy
Copy link
Member

@timholy timholy commented Feb 3, 2017

Fixes the following error:

julia> using OffsetArrays

julia> A = OffsetArray(rand(8,8), 2:9, 2:9)
OffsetArrays.OffsetArray{Float64,2,Array{Float64,2}} with indices 2:9×2:9:
 0.59856   0.434083   0.022313  0.843017   0.662765  0.979731  0.799594   0.546849
 0.823333  0.647455   0.785434  0.518239   0.184666  0.372712  0.421522   0.747545
 0.481929  0.710678   0.850665  0.42117    0.896602  0.456684  0.656202   0.205752
 0.554909  0.688436   0.555525  0.0713352  0.421323  0.733525  0.583583   0.642215
 0.363932  0.497752   0.388032  0.388487   0.919134  0.849249  0.0560365  0.960816
 0.538841  0.191339   0.236292  0.501244   0.87405   0.47807   0.109504   0.494278
 0.514059  0.621262   0.979369  0.958913   0.828713  0.16438   0.284372   0.270563
 0.810203  0.0258329  0.146011  0.345866   0.215814  0.912965  0.433246   0.31008 

julia> V = view(A, 2:3, :)
Error showing value of type SubArray{Float64,2,OffsetArrays.OffsetArray{Float64,2,Array{Float64,2}},Tuple{UnitRange{Int64},Colon},false}:
ERROR: MethodError: no method matching inds2string(::Tuple{Int64,UnitRange{Int64}})
Closest candidates are:
  inds2string(::Tuple{Vararg{AbstractUnitRange,N}}) at show.jl:1485
 in _summary(::SubArray{Float64,2,OffsetArrays.OffsetArray{Float64,2,Array{Float64,2}},Tuple{UnitRange{Int64},Colon},false}, ::Tuple{Int64,UnitRange{Int64}}) at ./show.jl:1490
 in summary(::SubArray{Float64,2,OffsetArrays.OffsetArray{Float64,2,Array{Float64,2}},Tuple{UnitRange{Int64},Colon},false}) at ./show.jl:1488
 in #showarray#330(::Bool, ::Function, ::IOContext{Base.Terminals.TTYTerminal}, ::SubArray{Float64,2,OffsetArrays.OffsetArray{Float64,2,Array{Float64,2}},Tuple{UnitRange{Int64},Colon},false}, ::Bool) at ./show.jl:1599
 in display(::Base.REPL.REPLDisplay{Base.REPL.LineEditREPL}, ::MIME{Symbol("text/plain")}, ::SubArray{Float64,2,OffsetArrays.OffsetArray{Float64,2,Array{Float64,2}},Tuple{UnitRange{Int64},Colon},false}) at ./REPL.jl:132
 in display(::Base.REPL.REPLDisplay{Base.REPL.LineEditREPL}, ::SubArray{Float64,2,OffsetArrays.OffsetArray{Float64,2,Array{Float64,2}},Tuple{UnitRange{Int64},Colon},false}) at ./REPL.jl:135
 in display(::SubArray{Float64,2,OffsetArrays.OffsetArray{Float64,2,Array{Float64,2}},Tuple{UnitRange{Int64},Colon},false}) at ./multimedia.jl:143
 in print_response(::Base.Terminals.TTYTerminal, ::Any, ::Void, ::Bool, ::Bool, ::Void) at ./REPL.jl:154
 in print_response(::Base.REPL.LineEditREPL, ::Any, ::Void, ::Bool, ::Bool) at ./REPL.jl:139
 in (::Base.REPL.##22#23{Bool,Base.REPL.##33#42{Base.REPL.LineEditREPL,Base.REPL.REPLHistoryProvider},Base.REPL.LineEditREPL,Base.LineEdit.Prompt})(::Base.LineEdit.MIState, ::Base.AbstractIOBuffer{Array{UInt8,1}}, ::Bool) at ./REPL.jl:652
 in run_interface(::Base.Terminals.TTYTerminal, ::Base.LineEdit.ModalInterface) at ./LineEdit.jl:1579
 in run_frontend(::Base.REPL.LineEditREPL, ::Base.REPL.REPLBackendRef) at ./REPL.jl:903
 in run_repl(::Base.REPL.LineEditREPL, ::Base.##942#943) at ./REPL.jl:188
 in _start() at ./client.jl:360

@tkelman
Copy link
Contributor

tkelman commented Mar 1, 2017

This causes a test failure on 32 bit when backported to release-0.5:

$ usr/bin/julia test/runtests.jl linalg/bidiag
     * linalg/bidiag        Error During Test
  Test threw an exception of type MethodError
  Expression: sprint(show,BD) == "$(summary(BD)):\n diag:$(dstring)\n super:$(estring)"
  MethodError: no method matching getindex(::Tuple{Base.OneTo{Int32},Base.OneTo{Int32}}, ::CartesianIndex{2})
   in macro expansion; at .\broadcast.jl:127 [inlined]
   in macro expansion; at .\simdloop.jl:73 [inlined]
   in macro expansion; at .\broadcast.jl:123 [inlined]
   in _broadcast! at .\broadcast.jl:117
   in broadcast! at .\broadcast.jl:172 [inlined]
   in broadcast_t at .\broadcast.jl:228 [inlined]
   in broadcast at .\broadcast.jl:230 [inlined]
   in _summary(::Bidiagonal{Int32}, ::Tuple{Base.OneTo{Int32},Base.OneTo{Int32}}) at .\show.jl:1489
   in show(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::Bidiagonal{Int32}) at .\linalg\bidiag.jl:173
   in #sprint#316(::Void, ::Function, ::Int32, ::Function, ::Bidiagonal{Int32}, ::Vararg{Bidiagonal{Int32},N}) at .\strings\io.jl:37
   in macro expansion; at C:\cygwin64\home\Tony\julia32\test\linalg\bidiag.jl:54 [inlined]
   in anonymous at .\<missing>:?
   in include_from_node1 at .\loading.jl:488
   in macro expansion at .\util.jl:230 [inlined]
   in runtests(::String) at C:\cygwin64\home\Tony\julia32\test\testdefs.jl:7
   in (::Base.##622#623{##16#24,Tuple{String},Array{Any,1}})() at .\multi.jl:1030
   in run_work_thunk(::Base.##622#623{##16#24,Tuple{String},Array{Any,1}}, ::Bool) at .\multi.jl:1001
   in #remotecall_fetch#627 at .\multi.jl:1055
   in remotecall_fetch at .\multi.jl:1055
   in #remotecall_fetch#631 at .\multi.jl:1080
   in remotecall_fetch at .\multi.jl:1080
   in macro expansion at C:\cygwin64\home\Tony\julia32\test\runtests.jl:44 [inlined]
   in (::##15#23{Array{Any,1},UInt32})() at .\task.jl:360
ERROR: LoadError: LoadError: There was an error during testing
 in record(::Base.Test.FallbackTestSet, ::Base.Test.Error) at .\test.jl:397
 in do_test(::Base.Test.Threw, ::Expr) at .\test.jl:281
 in macro expansion; at C:\cygwin64\home\Tony\julia32\test\linalg\bidiag.jl:54 [inlined]
 in anonymous at .\<missing>:?
 in include_from_node1 at .\loading.jl:488
 in macro expansion at .\util.jl:230 [inlined]
 in runtests(::String) at C:\cygwin64\home\Tony\julia32\test\testdefs.jl:7
 in (::Base.##622#623{##16#24,Tuple{String},Array{Any,1}})() at .\multi.jl:1030
 in run_work_thunk(::Base.##622#623{##16#24,Tuple{String},Array{Any,1}}, ::Bool) at .\multi.jl:1001
 in #remotecall_fetch#627 at .\multi.jl:1055
 in remotecall_fetch at .\multi.jl:1055
 in #remotecall_fetch#631 at .\multi.jl:1080
 in remotecall_fetch at .\multi.jl:1080
 in macro expansion at C:\cygwin64\home\Tony\julia32\test\runtests.jl:44 [inlined]
 in (::##15#23{Array{Any,1},UInt32})() at .\task.jl:360
while loading C:\cygwin64\home\Tony\julia32\test\linalg/bidiag.jl, in expression starting on line 11
 in #remotecall_fetch#627 at .\multi.jl:1056
 in remotecall_fetch at .\multi.jl:1055
 in #remotecall_fetch#631 at .\multi.jl:1080
 in remotecall_fetch at .\multi.jl:1080
 in macro expansion at C:\cygwin64\home\Tony\julia32\test\runtests.jl:44 [inlined]
 in (::##15#23{Array{Any,1},UInt32})() at .\task.jl:360
 in sync_end at .\task.jl:311
 in macro expansion at .\task.jl:327 [inlined]
 in (::##11#19)() at C:\cygwin64\home\Tony\julia32\test\runtests.jl:37
 in cd(::##11#19, ::String) at .\file.jl:48
 in include_from_node1 at .\loading.jl:488
 in process_options at .\client.jl:265
 in _start at .\client.jl:321
while loading C:\cygwin64\home\Tony\julia32\test\runtests.jl, in expression starting on line 26

@timholy
Copy link
Member Author

timholy commented Mar 1, 2017

What if you change length.(indices) to map(length, indices)?

@pabloferz
Copy link
Contributor

What if you change length.(indices) to map(length, indices)?

That should do the trick given that there is no dot-broadcast over tuples on 0.5.

tkelman pushed a commit that referenced this pull request Mar 3, 2017
(cherry picked from commit 0eff50b)
ref #20431

use map(length, inds) instead of length.(inds) for release-0.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants