@@ -1246,4 +1246,56 @@ end
12461246 end
12471247end
12481248
1249+ @testset " fillband!" begin
1250+ @testset " uplo = :U" begin
1251+ B = Bidiagonal (zeros (4 ), zeros (3 ), :U )
1252+ LinearAlgebra. fillband! (B, 2 , 1 , 1 )
1253+ @test all (== (2 ), diagview (B,1 ))
1254+ LinearAlgebra. fillband! (B, 3 , 0 , 0 )
1255+ @test all (== (3 ), diagview (B,0 ))
1256+ @test all (== (2 ), diagview (B,1 ))
1257+ LinearAlgebra. fillband! (B, 4 , 0 , 1 )
1258+ @test all (== (4 ), diagview (B,0 ))
1259+ @test all (== (4 ), diagview (B,1 ))
1260+ @test_throws ArgumentError LinearAlgebra. fillband! (B, 3 , - 1 , 0 )
1261+
1262+ LinearAlgebra. fillstored! (B, 1 )
1263+ LinearAlgebra. fillband! (B, 0 , - 3 , 3 )
1264+ @test iszero (B)
1265+ LinearAlgebra. fillband! (B, 0 , - 10 , 10 )
1266+ @test iszero (B)
1267+ LinearAlgebra. fillstored! (B, 1 )
1268+ B2 = copy (B)
1269+ LinearAlgebra. fillband! (B, 0 , - 1 , - 3 )
1270+ @test B == B2
1271+ LinearAlgebra. fillband! (B, 0 , 10 , 10 )
1272+ @test B == B2
1273+ end
1274+
1275+ @testset " uplo = :L" begin
1276+ B = Bidiagonal (zeros (4 ), zeros (3 ), :L )
1277+ LinearAlgebra. fillband! (B, 2 , - 1 , - 1 )
1278+ @test all (== (2 ), diagview (B,- 1 ))
1279+ LinearAlgebra. fillband! (B, 3 , 0 , 0 )
1280+ @test all (== (3 ), diagview (B,0 ))
1281+ @test all (== (2 ), diagview (B,- 1 ))
1282+ LinearAlgebra. fillband! (B, 4 , - 1 , 0 )
1283+ @test all (== (4 ), diagview (B,0 ))
1284+ @test all (== (4 ), diagview (B,- 1 ))
1285+ @test_throws ArgumentError LinearAlgebra. fillband! (B, 3 , 0 , 1 )
1286+
1287+ LinearAlgebra. fillstored! (B, 1 )
1288+ LinearAlgebra. fillband! (B, 0 , - 3 , 3 )
1289+ @test iszero (B)
1290+ LinearAlgebra. fillband! (B, 0 , - 10 , 10 )
1291+ @test iszero (B)
1292+ LinearAlgebra. fillstored! (B, 1 )
1293+ B2 = copy (B)
1294+ LinearAlgebra. fillband! (B, 0 , - 1 , - 3 )
1295+ @test B == B2
1296+ LinearAlgebra. fillband! (B, 0 , 10 , 10 )
1297+ @test B == B2
1298+ end
1299+ end
1300+
12491301end # module TestBidiagonal
0 commit comments