@@ -1228,4 +1228,56 @@ end
12281228 @test_throws BoundsError B[LinearAlgebra. BandIndex (0 ,size (B,1 )+ 1 )]
12291229end
12301230
1231+ @testset " fillband!" begin
1232+ @testset " uplo = :U" begin
1233+ B = Bidiagonal (zeros (4 ), zeros (3 ), :U )
1234+ LinearAlgebra. fillband! (B, 2 , 1 , 1 )
1235+ @test all (== (2 ), diagview (B,1 ))
1236+ LinearAlgebra. fillband! (B, 3 , 0 , 0 )
1237+ @test all (== (3 ), diagview (B,0 ))
1238+ @test all (== (2 ), diagview (B,1 ))
1239+ LinearAlgebra. fillband! (B, 4 , 0 , 1 )
1240+ @test all (== (4 ), diagview (B,0 ))
1241+ @test all (== (4 ), diagview (B,1 ))
1242+ @test_throws ArgumentError LinearAlgebra. fillband! (B, 3 , - 1 , 0 )
1243+
1244+ LinearAlgebra. fillstored! (B, 1 )
1245+ LinearAlgebra. fillband! (B, 0 , - 3 , 3 )
1246+ @test iszero (B)
1247+ LinearAlgebra. fillband! (B, 0 , - 10 , 10 )
1248+ @test iszero (B)
1249+ LinearAlgebra. fillstored! (B, 1 )
1250+ B2 = copy (B)
1251+ LinearAlgebra. fillband! (B, 0 , - 1 , - 3 )
1252+ @test B == B2
1253+ LinearAlgebra. fillband! (B, 0 , 10 , 10 )
1254+ @test B == B2
1255+ end
1256+
1257+ @testset " uplo = :L" begin
1258+ B = Bidiagonal (zeros (4 ), zeros (3 ), :L )
1259+ LinearAlgebra. fillband! (B, 2 , - 1 , - 1 )
1260+ @test all (== (2 ), diagview (B,- 1 ))
1261+ LinearAlgebra. fillband! (B, 3 , 0 , 0 )
1262+ @test all (== (3 ), diagview (B,0 ))
1263+ @test all (== (2 ), diagview (B,- 1 ))
1264+ LinearAlgebra. fillband! (B, 4 , - 1 , 0 )
1265+ @test all (== (4 ), diagview (B,0 ))
1266+ @test all (== (4 ), diagview (B,- 1 ))
1267+ @test_throws ArgumentError LinearAlgebra. fillband! (B, 3 , 0 , 1 )
1268+
1269+ LinearAlgebra. fillstored! (B, 1 )
1270+ LinearAlgebra. fillband! (B, 0 , - 3 , 3 )
1271+ @test iszero (B)
1272+ LinearAlgebra. fillband! (B, 0 , - 10 , 10 )
1273+ @test iszero (B)
1274+ LinearAlgebra. fillstored! (B, 1 )
1275+ B2 = copy (B)
1276+ LinearAlgebra. fillband! (B, 0 , - 1 , - 3 )
1277+ @test B == B2
1278+ LinearAlgebra. fillband! (B, 0 , 10 , 10 )
1279+ @test B == B2
1280+ end
1281+ end
1282+
12311283end # module TestBidiagonal
0 commit comments