Skip to content

Commit 28eed78

Browse files
committed
Skip symmetry check in converting Symmetric to SymTridiagonal
1 parent 0a253be commit 28eed78

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/tridiag.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,10 @@ function (::Type{SymTri})(A::AbstractMatrix) where {SymTri <: SymTridiagonal}
111111
checksquare(A)
112112
du = diag(A, 1)
113113
d = diag(A)
114-
dl = diag(A, -1)
115-
if _checksymmetric(d, du, dl)
116-
SymTri(d, du)
117-
else
114+
if !(A isa Symmetric || _checksymmetric(d, du, diag(A, -1)))
118115
throw(ArgumentError("matrix is not symmetric; cannot convert to SymTridiagonal"))
119116
end
117+
return SymTri(d, du)
120118
end
121119

122120
_checksymmetric(d, du, dl) = all(((x, y),) -> x == transpose(y), zip(du, dl)) && all(issymmetric, d)

0 commit comments

Comments
 (0)