-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Labelled slice fails in Julia 1.4.0 #83
Comments
What do you mean? Looks like a type definition is missing: https://github.com/SciML/LabelledArrays.jl/blob/master/test/lsliced.jl#L72
|
Le 23 juil. 2020 à 13:48, Christopher Rackauckas ***@***.***> a écrit :
The regular array example fails also.
What do you mean?
That the example that follows "For regular arrays with labeled rows and columns: » in https://github.com/SciML/LabelledArrays.jl
will also generate an error on my computer
julia> A = @LSliced [1 2; 3 4; 5 6] (:a,:b,:c), (:x, :y)
3×2 LArray{Int64,2,Array{Int64,2},Tuple{(:a, :b, :c),(:x, :y)}}:
Error showing value of type LArray{Int64,2,Array{Int64,2},Tuple{(:a, :b, :c),(:x, :y)}}:
ERROR: ArgumentError: invalid index: :a of type Symbol
Stacktrace:
[1] to_index(::Symbol) at ./indices.jl:297
[2] to_index(::LinearIndices{2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}}, ::Symbol) at ./indices.jl:274
[3] to_indices at ./indices.jl:325 [inlined]
[4] to_indices at ./indices.jl:321 [inlined]
[5] getindex at ./abstractarray.jl:980 [inlined]
[6] (::LabelledArrays.var"#53#54"{Tuple{Int64,Int64},LinearIndices{2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}}})(::Tuple{Symbol,Symbol,Symbol}) at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:37
[7] findfirst(::LabelledArrays.var"#53#54"{Tuple{Int64,Int64},LinearIndices{2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}}}, ::Tuple{Tuple{Symbol,Symbol,Symbol},Tuple{Symbol,Symbol}}) at ./array.jl:1776
[8] lazypair at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:35 [inlined]
[9] getindex at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:30 [inlined]
[10] isassigned(::LabelledArrays.PrintWrapper{Int64,2,typeof(LabelledArrays.lazypair),LArray{Int64,2,Array{Int64,2},Tuple{(:a, :b, :c),(:x, :y)}}}, ::Int64, ::Int64) at ./abstractarray.jl:404
[11] alignment(::IOContext{REPL.Terminals.TTYTerminal}, ::LabelledArrays.PrintWrapper{Int64,2,typeof(LabelledArrays.lazypair),LArray{Int64,2,Array{Int64,2},Tuple{(:a, :b, :c),(:x, :y)}}}, ::UnitRange{Int64}, ::UnitRange{Int64}, ::Int64, ::Int64, ::Int64) at ./arrayshow.jl:67
[12] print_matrix(::IOContext{REPL.Terminals.TTYTerminal}, ::LabelledArrays.PrintWrapper{Int64,2,typeof(LabelledArrays.lazypair),LArray{Int64,2,Array{Int64,2},Tuple{(:a, :b, :c),(:x, :y)}}}, ::String, ::String, ::String, ::String, ::String, ::String, ::Int64, ::Int64) at ./arrayshow.jl:189
[13] print_matrix at ./arrayshow.jl:162 [inlined]
[14] print_array at ./arrayshow.jl:310 [inlined]
[15] show(::IOContext{REPL.Terminals.TTYTerminal}, ::LArray{Int64,2,Array{Int64,2},Tuple{(:a, :b, :c),(:x, :y)}}) at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:51
[16] show(::IOContext{REPL.Terminals.TTYTerminal}, ::MIME{Symbol("text/plain")}, ::LArray{Int64,2,Array{Int64,2},Tuple{(:a, :b, :c),(:x, :y)}}) at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:42
[17] display(::REPL.REPLDisplay{REPL.LineEditREPL}, ::MIME{Symbol("text/plain")}, ::LArray{Int64,2,Array{Int64,2},Tuple{(:a, :b, :c),(:x, :y)}}) at /Users/dutilleu/.julia/packages/OhMyREPL/7qVFi/src/output_prompt_overwrite.jl:6
[18] display(::REPL.REPLDisplay, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:141
[19] display(::Any) at ./multimedia.jl:323
[20] #invokelatest#1 at ./essentials.jl:712 [inlined]
[21] invokelatest at ./essentials.jl:711 [inlined]
[22] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:161
[23] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:146
[24] (::REPL.var"#do_respond#38"{Bool,REPL.var"#48#57"{REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:729
[25] #invokelatest#1 at ./essentials.jl:712 [inlined]
[26] invokelatest at ./essentials.jl:711 [inlined]
[27] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/LineEdit.jl:2354
[28] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:1055
[29] run_repl(::REPL.AbstractREPL, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:206
[30] (::Base.var"#764#766"{Bool,Bool,Bool,Bool})(::Module) at ./client.jl:383
[31] #invokelatest#1 at ./essentials.jl:712 [inlined]
[32] invokelatest at ./essentials.jl:711 [inlined]
[33] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:367
[34] exec_options(::Base.JLOptions) at ./client.jl:305
[35] _start() at ./client.jl:484
…
Looks like a type definition is missing: https://github.com/SciML/LabelledArrays.jl/blob/master/test/lsliced.jl#L72
z = @LSliced Float64 (4,2) (:a,:b,:c,:d), (:x, :y)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Yes but what about with the element type like I pointed to? |
Le 23 juil. 2020 à 13:58, Christopher Rackauckas ***@***.***> a écrit :
Yes but what about with the element type like I pointed to?
julia> z = @LSliced Float64 (4,2) (:a,:b,:c,:d), (:x, :y)
4×2 LArray{Float64,2,Array{Float64,2},Tuple{(:a, :b, :c, :d),(:x, :y)}}:
Error showing value of type LArray{Float64,2,Array{Float64,2},Tuple{(:a, :b, :c, :d),(:x, :y)}}:
ERROR: ArgumentError: invalid index: :a of type Symbol
Stacktrace:
[1] to_index(::Symbol) at ./indices.jl:297
[2] to_index(::LinearIndices{2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}}, ::Symbol) at ./indices.jl:274
[3] to_indices at ./indices.jl:325 [inlined]
[4] to_indices at ./indices.jl:321 [inlined]
[5] getindex at ./abstractarray.jl:980 [inlined]
[6] (::LabelledArrays.var"#53#54"{Tuple{Int64,Int64},LinearIndices{2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}}})(::NTuple{4,Symbol}) at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:37
[7] findfirst(::LabelledArrays.var"#53#54"{Tuple{Int64,Int64},LinearIndices{2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}}}, ::Tuple{NTuple{4,Symbol},Tuple{Symbol,Symbol}}) at ./array.jl:1776
[8] lazypair at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:35 [inlined]
[9] getindex at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:30 [inlined]
[10] isassigned(::LabelledArrays.PrintWrapper{Float64,2,typeof(LabelledArrays.lazypair),LArray{Float64,2,Array{Float64,2},Tuple{(:a, :b, :c, :d),(:x, :y)}}}, ::Int64, ::Int64) at ./abstractarray.jl:404
[11] alignment(::IOContext{REPL.Terminals.TTYTerminal}, ::LabelledArrays.PrintWrapper{Float64,2,typeof(LabelledArrays.lazypair),LArray{Float64,2,Array{Float64,2},Tuple{(:a, :b, :c, :d),(:x, :y)}}}, ::UnitRange{Int64}, ::UnitRange{Int64}, ::Int64, ::Int64, ::Int64) at ./arrayshow.jl:67
[12] print_matrix(::IOContext{REPL.Terminals.TTYTerminal}, ::LabelledArrays.PrintWrapper{Float64,2,typeof(LabelledArrays.lazypair),LArray{Float64,2,Array{Float64,2},Tuple{(:a, :b, :c, :d),(:x, :y)}}}, ::String, ::String, ::String, ::String, ::String, ::String, ::Int64, ::Int64) at ./arrayshow.jl:189
[13] print_matrix at ./arrayshow.jl:162 [inlined]
[14] print_array at ./arrayshow.jl:310 [inlined]
[15] show(::IOContext{REPL.Terminals.TTYTerminal}, ::LArray{Float64,2,Array{Float64,2},Tuple{(:a, :b, :c, :d),(:x, :y)}}) at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:51
[16] show(::IOContext{REPL.Terminals.TTYTerminal}, ::MIME{Symbol("text/plain")}, ::LArray{Float64,2,Array{Float64,2},Tuple{(:a, :b, :c, :d),(:x, :y)}}) at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:42
[17] display(::REPL.REPLDisplay{REPL.LineEditREPL}, ::MIME{Symbol("text/plain")}, ::LArray{Float64,2,Array{Float64,2},Tuple{(:a, :b, :c, :d),(:x, :y)}}) at /Users/dutilleu/.julia/packages/OhMyREPL/7qVFi/src/output_prompt_overwrite.jl:6
[18] display(::REPL.REPLDisplay, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:141
[19] display(::Any) at ./multimedia.jl:323
[20] #invokelatest#1 at ./essentials.jl:712 [inlined]
[21] invokelatest at ./essentials.jl:711 [inlined]
[22] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:161
[23] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:146
[24] (::REPL.var"#do_respond#38"{Bool,REPL.var"#48#57"{REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:729
[25] #invokelatest#1 at ./essentials.jl:712 [inlined]
[26] invokelatest at ./essentials.jl:711 [inlined]
[27] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/LineEdit.jl:2354
[28] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:1055
[29] run_repl(::REPL.AbstractREPL, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:206
[30] (::Base.var"#764#766"{Bool,Bool,Bool,Bool})(::Module) at ./client.jl:383
[31] #invokelatest#1 at ./essentials.jl:712 [inlined]
[32] invokelatest at ./essentials.jl:711 [inlined]
[33] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:367
[34] exec_options(::Base.JLOptions) at ./client.jl:305
[35] _start() at ./client.jl:484
…
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
What version are you on? Julia v1.4 and the latest LabelledArrays? |
Le 23 juil. 2020 à 14:04, Christopher Rackauckas ***@***.***> a écrit :
What version are you on? Julia v1.4 and the latest LabelledArrays?
julia> versioninfo()
Julia Version 1.4.0
Commit b8e9a9ecc6 (2020-03-21 16:36 UTC)
(@v1.4) pkg> status LabelledArrays
Status `~/.julia/environments/v1.4/Project.toml`
[2ee39098] LabelledArrays v1.3.0
I installed LabelledArrays this morning.
…
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Sorry I never got around to this, too many other packages. Personally I have switched to using DimensionalData.jl for this. You can pass a tuple wrapped in Val into a dimension I've been meaning to put in a PR removing the sliced mode here, and directing people to DimentionalData.jl, which is probably a better fit for this kind of functionality as it's all about dimensional slicing, I just hadn't started writing it yet when I wrote the sliced mode here. |
that probably makes sense. |
Ok, I'll need to improve the docs a little for this at DimensionalData.jl as this functionality is only a few weeks old, then I'll clean up here. |
Friendly ping that this is an issue for me. I managed without it, but just saying this fine piece of machinery is useful to me as well. |
Like @yakir12, I friendly disagree here with the idea to remove this in favor of DimensionalData.jl As far as i know, DimensionalData.jl only allows named dimensions (I could be wrong). using LabelledArrays
z = @LArray [1.,2.,3.] (a = 1:2, b = 2:3)
julia> z.a
2-element view(::Vector{Float64}, 1:2) with eltype Float64:
1.0
2.0
julia> z.b
2-element view(::Array{Float64,1}, 2:3) with eltype Float64:
2.0
3.0 Why i think this is useful for For example if This package helps the syntax alot. |
Wouldn't ComponentArrays.jl do that well? |
Yes it does, somehow completely missed the existence of that package. Thank you very much! |
Hi,
When trying the examples of Labelled slices given here:
https://github.com/SciML/LabelledArrays.jl
I get errors. Here is how it goes:
julia> ABC = @SLSliced (3,2) (:a,:b,:c), (:x, :y)
SLArray{Tuple{3,2},Tuple{(:a, :b, :c),(:x, :y)},N,L,Syms} where Syms where L where N
julia> A = ABC([1 2; 3 4; 5 6])
3×2 SLArray{Tuple{3,2},Int64,2,6,Tuple{(:a, :b, :c),(:x, :y)}} with indices SOneTo(3)×SOneTo(2):
Error showing value of type SLArray{Tuple{3,2},Int64,2,6,Tuple{(:a, :b, :c),(:x, :y)}}:
ERROR: ArgumentError: invalid index: :a of type Symbol
Stacktrace:
[1] to_index(::Symbol) at ./indices.jl:297
[2] to_index(::LinearIndices{2,Tuple{StaticArrays.SOneTo{3},StaticArrays.SOneTo{2}}}, ::Symbol) at ./indices.jl:274
[3] to_indices at ./indices.jl:325 [inlined]
[4] to_indices at ./indices.jl:321 [inlined]
[5] getindex at ./abstractarray.jl:980 [inlined]
[6] (::LabelledArrays.var"#53#54"{Tuple{Int64,Int64},LinearIndices{2,Tuple{StaticArrays.SOneTo{3},StaticArrays.SOneTo{2}}}})(::Tuple{Symbol,Symbol,Symbol}) at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:37
[7] findfirst(::LabelledArrays.var"#53#54"{Tuple{Int64,Int64},LinearIndices{2,Tuple{StaticArrays.SOneTo{3},StaticArrays.SOneTo{2}}}}, ::Tuple{Tuple{Symbol,Symbol,Symbol},Tuple{Symbol,Symbol}}) at ./array.jl:1776
[8] lazypair at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:35 [inlined]
[9] getindex at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:30 [inlined]
[10] isassigned(::LabelledArrays.PrintWrapper{Int64,2,typeof(LabelledArrays.lazypair),SLArray{Tuple{3,2},Int64,2,6,Tuple{(:a, :b, :c),(:x, :y)}}}, ::Int64, ::Int64) at ./abstractarray.jl:404
[11] alignment(::IOContext{REPL.Terminals.TTYTerminal}, ::LabelledArrays.PrintWrapper{Int64,2,typeof(LabelledArrays.lazypair),SLArray{Tuple{3,2},Int64,2,6,Tuple{(:a, :b, :c),(:x, :y)}}}, ::UnitRange{Int64}, ::UnitRange{Int64}, ::Int64, ::Int64, ::Int64) at ./arrayshow.jl:67
[12] print_matrix(::IOContext{REPL.Terminals.TTYTerminal}, ::LabelledArrays.PrintWrapper{Int64,2,typeof(LabelledArrays.lazypair),SLArray{Tuple{3,2},Int64,2,6,Tuple{(:a, :b, :c),(:x, :y)}}}, ::String, ::String, ::String, ::String, ::String, ::String, ::Int64, ::Int64) at ./arrayshow.jl:189
[13] print_matrix at ./arrayshow.jl:162 [inlined]
[14] print_array at ./arrayshow.jl:310 [inlined]
[15] show(::IOContext{REPL.Terminals.TTYTerminal}, ::SLArray{Tuple{3,2},Int64,2,6,Tuple{(:a, :b, :c),(:x, :y)}}) at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:51
[16] show(::IOContext{REPL.Terminals.TTYTerminal}, ::MIME{Symbol("text/plain")}, ::SLArray{Tuple{3,2},Int64,2,6,Tuple{(:a, :b, :c),(:x, :y)}}) at /Users/dutilleu/.julia/packages/LabelledArrays/74Tbn/src/LabelledArrays.jl:42
[17] display(::REPL.REPLDisplay{REPL.LineEditREPL}, ::MIME{Symbol("text/plain")}, ::SLArray{Tuple{3,2},Int64,2,6,Tuple{(:a, :b, :c),(:x, :y)}}) at /Users/dutilleu/.julia/packages/OhMyREPL/7qVFi/src/output_prompt_overwrite.jl:6
[18] display(::REPL.REPLDisplay, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:141
[19] display(::Any) at ./multimedia.jl:323
[20] #invokelatest#1 at ./essentials.jl:712 [inlined]
[21] invokelatest at ./essentials.jl:711 [inlined]
[22] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:161
[23] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:146
[24] (::REPL.var"#do_respond#38"{Bool,REPL.var"#48#57"{REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:729
[25] #invokelatest#1 at ./essentials.jl:712 [inlined]
[26] invokelatest at ./essentials.jl:711 [inlined]
[27] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/LineEdit.jl:2354
[28] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:1055
[29] run_repl(::REPL.AbstractREPL, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:206
[30] (::Base.var"#764#766"{Bool,Bool,Bool,Bool})(::Module) at ./client.jl:383
[31] #invokelatest#1 at ./essentials.jl:712 [inlined]
[32] invokelatest at ./essentials.jl:711 [inlined]
[33] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:367
[34] exec_options(::Base.JLOptions) at ./client.jl:305
[35] _start() at ./client.jl:484
The regular array example fails also.
I am running:
Julia Version 1.4.0
Commit b8e9a9ecc6 (2020-03-21 16:36 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin18.6.0)
CPU: Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-8.0.1 (ORCJIT, haswell)
Any idea?
Kind regards,
Guillaume
The text was updated successfully, but these errors were encountered: