You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# The following test block tries to call all methods in base/linalg/triangular.jl in order for a combination of input element types. Keep the ordering when adding code.
29
35
@testsetfor elty1 in (Float32, Float64, BigFloat, ComplexF32, ComplexF64, Complex{BigFloat}, Int)
30
36
# Begin loop for first Triangular matrix
@@ -1078,4 +1084,50 @@ end
1078
1084
end
1079
1085
end
1080
1086
1087
+
@testset"addition/subtraction of mixed triangular"begin
1088
+
for A in (Hermitian(rand(4, 4)), Diagonal(rand(5)))
1089
+
for T in (UpperTriangular, LowerTriangular,
1090
+
UnitUpperTriangular, UnitLowerTriangular)
1091
+
B =T(A)
1092
+
M =Matrix(B)
1093
+
R = B - B'
1094
+
if A isa Diagonal
1095
+
@test R isa Diagonal
1096
+
end
1097
+
@test R == M - M'
1098
+
R = B + B'
1099
+
if A isa Diagonal
1100
+
@test R isa Diagonal
1101
+
end
1102
+
@test R == M + M'
1103
+
C =MyTriangular(B)
1104
+
@test C - C'== M - M'
1105
+
@test C + C'== M + M'
1106
+
end
1107
+
end
1108
+
@testset"unfilled parent"begin
1109
+
@testsetfor T in (UpperTriangular, LowerTriangular,
1110
+
UnitUpperTriangular, UnitLowerTriangular)
1111
+
F =Matrix{BigFloat}(undef, 2, 2)
1112
+
B =T(F)
1113
+
isupper = B isa Union{UpperTriangular, UnitUpperTriangular}
1114
+
B[1+!isupper, 1+isupper] =2
1115
+
if!(B isa Union{UnitUpperTriangular, UnitLowerTriangular})
1116
+
B[1,1] = B[2,2] =3
1117
+
end
1118
+
M =Matrix(B)
1119
+
# These are broken, as triu/tril don't work with
1120
+
# unfilled adjoint matrices
1121
+
# See https://github.com/JuliaLang/julia/pull/55312
0 commit comments