@@ -30,28 +30,21 @@ function Base.show(io::IO, mime::MIME{Symbol("text/plain")}, F::LU)
3030end
3131
3232# LU decomposition
33- function lu (A:: StaticMatrix , pivot:: Union{Val{false},Val{true}} = Val (true ); check = true )
34- L, U, p = _lu (A, pivot, check)
35- LU (L, U, p)
36- end
37-
38- # For the square version, return explicit lower and upper triangular matrices.
39- # We would do this for the rectangular case too, but Base doesn't support that.
40- function lu (A:: StaticMatrix{N,N} , pivot:: Union{Val{false},Val{true}} = Val (true );
41- check = true ) where {N}
42- L, U, p = _lu (A, pivot, check)
43- LU (LowerTriangular (L), UpperTriangular (U), p)
44- end
33+ for pv in (:true , :false )
34+ # ... define each `pivot::Val{true/false}` method individually to avoid ambiguties
35+ @eval function lu (A:: StaticMatrix , pivot:: Val{$pv} ; check = true )
36+ L, U, p = _lu (A, pivot, check)
37+ LU (L, U, p)
38+ end
4539
46- @static if VERSION >= v " 1.7-DEV"
47- # disambiguation
48- for p in (:true , :false )
49- @eval function lu (A:: StaticMatrix{N,N} , pivot:: Val{$p} ; check = true ) where {N}
50- Base. @invoke lu (A:: StaticMatrix{N,N} where N,
51- pivot:: Union{Val{false},Val{true}} ; check)
52- end
40+ # For the square version, return explicit lower and upper triangular matrices.
41+ # We would do this for the rectangular case too, but Base doesn't support that.
42+ @eval function lu (A:: StaticMatrix{N,N} , pivot:: Val{$pv} ; check = true ) where {N}
43+ L, U, p = _lu (A, pivot, check)
44+ LU (LowerTriangular (L), UpperTriangular (U), p)
5345 end
5446end
47+ lu (A:: StaticMatrix ; check = true ) = lu (A, Val (true ); check= check)
5548
5649# location of the first zero on the diagonal, 0 when not found
5750function _first_zero_on_diagonal (A:: StaticMatrix{M,N,T} ) where {M,N,T}
0 commit comments