Skip to content

Commit aa24ee0

Browse files
committed
Merge pull request #14008 from JuliaLang/yyc/triangular-convert
Make constructors of Triangular matrices no op if the arguments is already of the right type
2 parents 2d01b1c + 8067ec4 commit aa24ee0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

base/linalg/triangular.jl

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
abstract AbstractTriangular{T,S<:AbstractMatrix} <: AbstractMatrix{T} # could be renamed to Triangular when than name has been fully deprecated
66

77
# First loop through all methods that don't need special care for upper/lower and unit diagonal
8-
for t in (:LowerTriangular, :UnitLowerTriangular, :UpperTriangular, :UnitUpperTriangular)
8+
for t in (:LowerTriangular, :UnitLowerTriangular, :UpperTriangular,
9+
:UnitUpperTriangular)
910
@eval begin
1011
immutable $t{T,S<:AbstractMatrix} <: AbstractTriangular{T,S}
1112
data::S
1213
end
14+
$t(A::$t) = A
1315
function $t(A::AbstractMatrix)
1416
Base.LinAlg.chksquare(A)
1517
return $t{eltype(A), typeof(A)}(A)

0 commit comments

Comments
 (0)