|
1 | | -using Test |
2 | | -using BlockSparseArrays |
3 | | -using BlockSparseArrays: BlockSparseArray, svd, BlockDiagonal, eachblockstoredindex |
4 | | -using BlockArrays |
5 | | -using Random |
| 1 | +using BlockArrays: Block, BlockedMatrix, BlockedVector, blocks, mortar |
| 2 | +using BlockSparseArrays: BlockSparseArray, BlockDiagonal, eachblockstoredindex, svd |
6 | 3 | using DiagonalArrays: diagonal |
7 | 4 | using LinearAlgebra: LinearAlgebra |
| 5 | +using Random: Random |
| 6 | +using Test: @inferred, @testset, @test |
8 | 7 |
|
9 | | -function test_svd(a, usv) |
| 8 | +function test_svd(a, usv; broken=false) |
10 | 9 | U, S, V = usv |
11 | | - |
12 | | - @test U * diagonal(S) * V' ≈ a |
| 10 | + @test U * diagonal(S) * V' ≈ a broken = broken |
13 | 11 | @test U' * U ≈ LinearAlgebra.I |
14 | 12 | @test V' * V ≈ LinearAlgebra.I |
15 | 13 | end |
|
41 | 39 | @testset "($m, $n) BlockDiagonal{$T}" for ((m, n), T) in |
42 | 40 | Iterators.product(blockszs, eltypes) |
43 | 41 | a = BlockDiagonal([rand(T, i, j) for (i, j) in zip(m, n)]) |
44 | | - usv = svd(a) |
45 | | - # TODO: `BlockDiagonal * Adjoint` errors |
46 | | - # TODO: This is broken because of https://github.com/JuliaLang/julia/issues/57034, |
47 | | - # fix and reenable. |
48 | | - #test_svd(a, usv) |
| 42 | + if VERSION ≥ v"1.11" |
| 43 | + usv = svd(a) |
| 44 | + # TODO: `BlockDiagonal * Adjoint` errors |
| 45 | + # TODO: This is broken because of https://github.com/JuliaLang/julia/issues/57034, |
| 46 | + # fix and reenable. |
| 47 | + test_svd(a, usv; broken=true) |
| 48 | + else |
| 49 | + # `svd(a)` depends on `diagind(::AbstractMatrix, ::IndexStyle)` |
| 50 | + # being defined, but it was only introduced in Julia v1.11. |
| 51 | + @test svd(a) broken = true |
| 52 | + end |
49 | 53 | end |
50 | 54 |
|
51 | 55 | # blocksparse |
|
0 commit comments