@@ -38,6 +38,9 @@ const elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
3838 @test axes (a, 1 ) isa GradedOneTo
3939 @test axes (view (a, 1 : 4 , 1 : 4 , 1 : 4 , 1 : 4 ), 1 ) isa GradedOneTo
4040
41+ d1 = gradedrange ([U1 (0 ) => 2 , U1 (1 ) => 2 ])
42+ d2 = gradedrange ([U1 (0 ) => 2 , U1 (1 ) => 2 ])
43+ a = randn_blockdiagonal (elt, (d1, d2, d1, d2))
4144 for b in (a + a, 2 * a)
4245 @test size (b) == (4 , 4 , 4 , 4 )
4346 @test blocksize (b) == (2 , 2 , 2 , 2 )
@@ -54,11 +57,23 @@ const elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
5457 @test 2 * Array (a) == b
5558 end
5659
60+ d1 = gradedrange ([U1 (0 ) => 2 , U1 (1 ) => 2 ])
61+ d2 = gradedrange ([U1 (0 ) => 2 , U1 (1 ) => 2 ])
62+ a = randn_blockdiagonal (elt, (d1, d2, d1, d2))
5763 b = similar (a, ComplexF64)
64+ @test b isa BlockSparseArray{ComplexF64}
5865 @test eltype (b) === ComplexF64
5966
67+ a = BlockSparseVector {Float64} (undef, gradedrange ([U1 (0 ) => 1 , U1 (1 ) => 1 ]))
68+ b = similar (a, Float32)
69+ @test b isa BlockSparseVector{Float32}
70+ @test eltype (b) == Float32
71+
6072 # Test mixing graded axes and dense axes
6173 # in addition/broadcasting.
74+ d1 = gradedrange ([U1 (0 ) => 2 , U1 (1 ) => 2 ])
75+ d2 = gradedrange ([U1 (0 ) => 2 , U1 (1 ) => 2 ])
76+ a = randn_blockdiagonal (elt, (d1, d2, d1, d2))
6277 for b in (a + Array (a), Array (a) + a)
6378 @test size (b) == (4 , 4 , 4 , 4 )
6479 @test blocksize (b) == (2 , 2 , 2 , 2 )
@@ -73,6 +88,9 @@ const elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
7388 @test 2 * Array (a) == b
7489 end
7590
91+ d1 = gradedrange ([U1 (0 ) => 2 , U1 (1 ) => 2 ])
92+ d2 = gradedrange ([U1 (0 ) => 2 , U1 (1 ) => 2 ])
93+ a = randn_blockdiagonal (elt, (d1, d2, d1, d2))
7694 b = a[2 : 3 , 2 : 3 , 2 : 3 , 2 : 3 ]
7795 @test size (b) == (2 , 2 , 2 , 2 )
7896 @test blocksize (b) == (2 , 2 , 2 , 2 )
0 commit comments