@@ -1099,4 +1099,33 @@ end
1099
1099
@test opnorm (S, Inf ) == opnorm (Matrix (S), Inf )
1100
1100
end
1101
1101
1102
+ @testset " block-bidiagonal matrix indexing" begin
1103
+ dv = [ones (4 ,3 ), ones (2 ,2 ).* 2 , ones (2 ,3 ).* 3 , ones (4 ,4 ).* 4 ]
1104
+ evu = [ones (4 ,2 ), ones (2 ,3 ).* 2 , ones (2 ,4 ).* 3 ]
1105
+ evl = [ones (2 ,3 ), ones (2 ,2 ).* 2 , ones (4 ,3 ).* 3 ]
1106
+ T = Tridiagonal (evl, dv, evu)
1107
+ # check that all the matrices along a column have the same number of columns,
1108
+ # and the matrices along a row have the same number of rows
1109
+ for j in axes (T, 2 ), i in 2 : size (T, 1 )
1110
+ @test size (T[i,j], 2 ) == size (T[1 ,j], 2 )
1111
+ @test size (T[i,j], 1 ) == size (T[i,1 ], 1 )
1112
+ if j < i- 1 || j > i + 1
1113
+ @test iszero (T[i,j])
1114
+ end
1115
+ end
1116
+
1117
+ @testset " non-standard axes" begin
1118
+ s = SizedArrays. SizedArray {(2,2)} ([1 2 ; 3 4 ])
1119
+ T = Tridiagonal (fill (s,3 ), fill (s,4 ), fill (s,3 ))
1120
+ @test @inferred (T[3 ,1 ]) isa typeof (s)
1121
+ @test all (iszero, T[3 ,1 ])
1122
+ end
1123
+
1124
+ # SymTridiagonal requires square diagonal blocks
1125
+ dv = [fill (i, i, i) for i in 1 : 3 ]
1126
+ ev = [ones (Int,1 ,2 ), ones (Int,2 ,3 )]
1127
+ S = SymTridiagonal (dv, ev)
1128
+ @test S == Array {Matrix{Int}} (S)
1129
+ end
1130
+
1102
1131
end # module TestTridiagonal
0 commit comments