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

LinearAlgebra kron test fails in the REPL on backports-release-1.11 #1103

Closed
topolarity opened this issue Oct 30, 2024 · 6 comments
Closed
Labels
bug Something isn't working

Comments

@topolarity
Copy link
Member

topolarity commented Oct 30, 2024

Try running this test from LinearAlgebra in the REPL:

julia> using Test, LinearAlgebra

julia> @testset "zeros in kron with block matrices" begin
           D = Diagonal(1:4)
           B = reshape([ones(2,2), ones(3,2), ones(2,3), ones(3,3)], 2, 2)
           @test kron(D, B) == kron(Array(D), B)
           @test kron(B, D) == kron(B, Array(D))
           D2 = Diagonal([ones(2,2), ones(3,3)])
           @test kron(D, D2) == Diagonal([diag(D2); 2diag(D2)])
           @test kron(D2, D) == Diagonal([ones(2,2), fill(2.0,2,2), ones(3,3), fill(2.0,3,3)])
       end

fails with:

zeros in kron with block matrices: Test Failed at REPL[3]:7
  Expression: kron(D, D2) == Diagonal([diag(D2); 2 * diag(D2)])
   Evaluated: Diagonal([[1.0 1.0; 1.0 1.0], [1.0 1.0 1.0; 1.0 1.0 1.0; 1.0 1.0 1.0], [2.0 2.0; 2.0 2.0], [2.0 2.0 2.0; 2.0 2.0 2.0; 2.0 2.0 2.0], [3.0 3.0; 3.0 3.0], [3.0 3.0 3.0; 3.0 3.0 3.0; 3.0 3.0 3.0], [4.0 4.0; 4.0 4.0], [4.0 4.0 4.0; 4.0 4.0 4.0; 4.0 4.0 4.0]]) == Diagonal([[1.0 1.0; 1.0 1.0], [1.0 1.0 1.0; 1.0 1.0 1.0; 1.0 1.0 1.0], [2.0 2.0; 2.0 2.0], [2.0 2.0 2.0; 2.0 2.0 2.0; 2.0 2.0 2.0]])

This is on latest nightly, where this was supposed to already be fixed (#55941 and JuliaLang/julia#56229):

julia> versioninfo()
Julia Version 1.12.0-DEV.1514
Commit e4dc9d357a1 (2024-10-29 17:18 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 12 × 12th Gen Intel(R) Core(TM) i7-1255U
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, alderlake)
Threads: 1 default, 0 interactive, 1 GC (on 12 virtual cores)

This same test also segfaults in 1.11

@topolarity topolarity added the bug Something isn't working label Oct 30, 2024
@topolarity
Copy link
Member Author

cc @jishnub

@topolarity topolarity changed the title LinearAlgebra kron test fails in the REPL on nightly, segfaults on 1.11 LinearAlgebra kron test fails in the REPL on nightly Oct 30, 2024
@jishnub
Copy link
Collaborator

jishnub commented Oct 30, 2024

Did you alter the testset somehow? This example seems to be a mix of the tests on v1.11.1:
https://github.com/JuliaLang/julia/blob/8f5b7ca12ad48c6d740e058312fc8cf2bbe67848/stdlib/LinearAlgebra/test/diagonal.jl#L1326-L1334
and master:
https://github.com/JuliaLang/julia/blob/9850a3881221a57a382e98c9b9ae2bf97ac3966d/stdlib/LinearAlgebra/test/diagonal.jl#L1445-L1453
The tests are a bit different, as on v1.11, D = Diagonal(1:2) and on master, D = Diagonal(1:4). I am able to run both of these blocks successfully on nightly v"1.12.0-DEV.1510".

@topolarity
Copy link
Member Author

topolarity commented Oct 30, 2024

Oh! That's the problem. I took this from 1.11 (backports) which doesn't have JuliaLang/julia#56229

@topolarity
Copy link
Member Author

Actually this test is what's on backports-release-1.11. The Diagonal(1:4) was added when JuliaLang/julia#56229 was back-ported

It sounds like the test needs fixing?

@topolarity topolarity changed the title LinearAlgebra kron test fails in the REPL on nightly LinearAlgebra kron test fails in the REPL on backports-release-1.11 Oct 30, 2024
@jishnub
Copy link
Collaborator

jishnub commented Oct 30, 2024

Thanks! I have pushed a fixed commit JuliaLang/julia@23cb128, and the updated tests pass locally for me.

@topolarity
Copy link
Member Author

Awesome - thanks @jishnub

@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
Development

No branches or pull requests

2 participants