@@ -405,6 +405,13 @@ arrayts = (Array, JLArray)
405
405
@test size (b) == size (a)
406
406
@test blocksize (b) == blocksize (a)
407
407
408
+ # Regression test for https://github.com/ITensor/BlockSparseArrays.jl/issues/98
409
+ a = dev (BlockSparseArray {elt} (undef))
410
+ b = similar (a, Float64, (Base. OneTo (1 ),))
411
+ @test b isa BlockSparseVector{Float64}
412
+ @test size (b) == (1 ,)
413
+ @test blocksize (b) == (1 ,)
414
+
408
415
a = dev (BlockSparseArray {elt} (undef, [2 , 3 ], [3 , 4 ]))
409
416
b = @view a[[Block (2 ), Block (1 )], [Block (2 ), Block (1 )]]
410
417
c = @view b[Block (1 , 1 )]
@@ -1126,6 +1133,15 @@ arrayts = (Array, JLArray)
1126
1133
@test reshape (a[Block (2 , 1 )], 8 ) == b[Block (2 )]
1127
1134
@test blockstoredlength (b) == 2
1128
1135
@test storedlength (b) == 17
1136
+
1137
+ # Zero-dimensional limit (check for ambiguity errors).
1138
+ # Regression test for https://github.com/ITensor/BlockSparseArrays.jl/issues/98.
1139
+ a = dev (BlockSparseArray {elt} (undef, ()))
1140
+ a[Block ()] = dev (randn (elt, ()))
1141
+ b = blockreshape (a)
1142
+ @test a[Block ()] == b[Block ()]
1143
+ @test blockstoredlength (b) == 1
1144
+ @test storedlength (b) == 1
1129
1145
end
1130
1146
@testset " show" begin
1131
1147
vectort_elt = arrayt{elt,1 }
0 commit comments