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

Concatenation with I (UniformScaling) fails with numbers #666

Closed
mbauman opened this issue Sep 20, 2019 · 2 comments · Fixed by JuliaLang/julia#41394
Closed

Concatenation with I (UniformScaling) fails with numbers #666

mbauman opened this issue Sep 20, 2019 · 2 comments · Fixed by JuliaLang/julia#41394
Labels
bug Something isn't working

Comments

@mbauman
Copy link
Member

mbauman commented Sep 20, 2019

This works:

julia> [I     [2,3]
        [4 5] [6]]
3×3 Array{Int64,2}:
 1  0  2
 0  1  3
 4  5  6

And this works:

julia> [[1 0; 0 1] [2,3]
        [4 5]      6]
3×3 Array{Int64,2}:
 1  0  2
 0  1  3
 4  5  6

But this fails:

julia> [I     [2,3]
        [4 5] 6]
ERROR: DimensionMismatch("mismatch in dimension 1 (expected 1 got 2)")
Stacktrace:
 [1] cat_shape(::Tuple{Bool,Bool}, ::Tuple{}, ::Tuple{Int64}, ::Tuple{Int64}) at ./abstractarray.jl:1421
 [2] _cat_t(::Val{2}, ::Type, ::UniformScaling{Bool}, ::Vararg{Any,N} where N) at ./abstractarray.jl:1441
 [3] #cat_t#103(::Val{2}, ::typeof(Base.cat_t), ::Type{Any}, ::UniformScaling{Bool}, ::Vararg{Any,N} where N) at ./abstractarray.jl:1438
 [4] (::Base.var"#kw##cat_t")(::NamedTuple{(:dims,),Tuple{Val{2}}}, ::typeof(Base.cat_t), ::Type{Any}, ::UniformScaling{Bool}, ::Vararg{Any,N} where N) at ./none:0
 [5] typed_hcat(::Type, ::UniformScaling{Bool}, ::Array{Int64,1}) at ./abstractarray.jl:1548
 [6] typed_hvcat(::Type{Any}, ::Tuple{Int64,Int64}, ::UniformScaling{Bool}, ::Vararg{Any,N} where N) at ./abstractarray.jl:1738
 [7] hvcat(::Tuple{Int64,Int64}, ::UniformScaling{Bool}, ::Vararg{Any,N} where N) at ./abstractarray.jl:1716
 [8] top-level scope at REPL[42]:1
@mbauman mbauman added the bug Something isn't working label Sep 20, 2019
@dkarrasch
Copy link
Member

The problem is that it should be calling
https://github.com/JuliaLang/julia/blob/b13c64ab0098d283e9713ce7adfbaf6c26a9ff23/stdlib/LinearAlgebra/src/uniformscaling.jl#L328

but it doesn't because Numbers don't match the signature. So I wonder if it's sufficient to add Number in there, or whether we need to promote numbers to UniformScalings first.

@remi147

This comment has been minimized.

@KristofferC KristofferC transferred this issue from JuliaLang/julia Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants