@@ -38,6 +38,9 @@ const elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
38
38
@test axes (a, 1 ) isa GradedOneTo
39
39
@test axes (view (a, 1 : 4 , 1 : 4 , 1 : 4 , 1 : 4 ), 1 ) isa GradedOneTo
40
40
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))
41
44
for b in (a + a, 2 * a)
42
45
@test size (b) == (4 , 4 , 4 , 4 )
43
46
@test blocksize (b) == (2 , 2 , 2 , 2 )
@@ -54,11 +57,23 @@ const elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
54
57
@test 2 * Array (a) == b
55
58
end
56
59
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))
57
63
b = similar (a, ComplexF64)
64
+ @test b isa BlockSparseArray{ComplexF64}
58
65
@test eltype (b) === ComplexF64
59
66
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
+
60
72
# Test mixing graded axes and dense axes
61
73
# 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))
62
77
for b in (a + Array (a), Array (a) + a)
63
78
@test size (b) == (4 , 4 , 4 , 4 )
64
79
@test blocksize (b) == (2 , 2 , 2 , 2 )
@@ -73,6 +88,9 @@ const elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
73
88
@test 2 * Array (a) == b
74
89
end
75
90
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))
76
94
b = a[2 : 3 , 2 : 3 , 2 : 3 , 2 : 3 ]
77
95
@test size (b) == (2 , 2 , 2 , 2 )
78
96
@test blocksize (b) == (2 , 2 , 2 , 2 )
0 commit comments