1212LU (factors:: AbstractMatrix{T} , ipiv:: Vector{BlasInt} , info:: BlasInt ) where {T} = LU {T,typeof(factors)} (factors, ipiv, info)
1313
1414# StridedMatrix
15- function lufact! (A:: StridedMatrix{T} , pivot:: Union{Type{ Val{false}}, Type{ Val{true}}} = Val{ true } ) where T<: BlasFloat
16- if pivot === Val{ false }
15+ function lufact! (A:: StridedMatrix{T} , pivot:: Union{Val{false}, Val{true}} = Val ( true ) ) where T<: BlasFloat
16+ if pivot === Val ( false )
1717 return generic_lufact! (A, pivot)
1818 end
1919 lpt = LAPACK. getrf! (A)
2020 return LU {T,typeof(A)} (lpt[1 ], lpt[2 ], lpt[3 ])
2121end
2222
2323"""
24- lufact!(A, pivot=Val{ true} ) -> LU
24+ lufact!(A, pivot=Val( true) ) -> LU
2525
2626`lufact!` is the same as [`lufact`](@ref), but saves space by overwriting the
2727input `A`, instead of creating a copy. An [`InexactError`](@ref)
2828exception is thrown if the factorization produces a number not representable by the
2929element type of `A`, e.g. for integer types.
3030"""
31- lufact! (A:: StridedMatrix , pivot:: Union{Type{ Val{false}}, Type{ Val{true}}} = Val{ true } ) = generic_lufact! (A, pivot)
32- function generic_lufact! (A:: StridedMatrix{T} , :: Type{ Val{Pivot}} = Val{ true } ) where {T,Pivot}
31+ lufact! (A:: StridedMatrix , pivot:: Union{Val{false}, Val{true}} = Val ( true ) ) = generic_lufact! (A, pivot)
32+ function generic_lufact! (A:: StridedMatrix{T} , :: Val{Pivot} = Val ( true ) ) where {T,Pivot}
3333 m, n = size (A)
3434 minmn = min (m,n)
3535 info = 0
7979
8080# floating point types doesn't have to be promoted for LU, but should default to pivoting
8181lufact (A:: Union{AbstractMatrix{T}, AbstractMatrix{Complex{T}}} ,
82- pivot:: Union{Type{ Val{false}}, Type{ Val{true}}} = Val{ true } ) where {T<: AbstractFloat } =
82+ pivot:: Union{Val{false}, Val{true}} = Val ( true ) ) where {T<: AbstractFloat } =
8383 lufact! (copy (A), pivot)
8484
8585# for all other types we must promote to a type which is stable under division
8686"""
87- lufact(A [,pivot=Val{ true} ]) -> F::LU
87+ lufact(A [,pivot=Val( true) ]) -> F::LU
8888
8989Compute the LU factorization of `A`.
9090
@@ -135,7 +135,7 @@ julia> F[:L] * F[:U] == A[F[:p], :]
135135true
136136```
137137"""
138- function lufact (A:: AbstractMatrix{T} , pivot:: Union{Type{ Val{false}}, Type{ Val{true} }} ) where T
138+ function lufact (A:: AbstractMatrix{T} , pivot:: Union{Val{false}, Val{true}} ) where T
139139 S = typeof (zero (T)/ one (T))
140140 AA = similar (A, S, size (A))
141141 copy! (AA, A)
@@ -146,13 +146,13 @@ function lufact(A::AbstractMatrix{T}) where T
146146 S = typeof (zero (T)/ one (T))
147147 AA = similar (A, S, size (A))
148148 copy! (AA, A)
149- F = lufact! (AA, Val{ false } )
149+ F = lufact! (AA, Val ( false ) )
150150 if F. info == 0
151151 return F
152152 else
153153 AA = similar (A, S, size (A))
154154 copy! (AA, A)
155- return lufact! (AA, Val{ true } )
155+ return lufact! (AA, Val ( true ) )
156156 end
157157end
158158
@@ -162,11 +162,11 @@ lufact(F::LU) = F
162162lu (x:: Number ) = (one (x), x, 1 )
163163
164164"""
165- lu(A, pivot=Val{ true} ) -> L, U, p
165+ lu(A, pivot=Val( true) ) -> L, U, p
166166
167167Compute the LU factorization of `A`, such that `A[p,:] = L*U`.
168168By default, pivoting is used. This can be overridden by passing
169- `Val{ false} ` for the second argument.
169+ `Val( false) ` for the second argument.
170170
171171See also [`lufact`](@ref).
172172
@@ -185,7 +185,7 @@ julia> A[p, :] == L * U
185185true
186186```
187187"""
188- function lu (A:: AbstractMatrix , pivot:: Union{Type{ Val{false}}, Type{ Val{true}}} = Val{ true } )
188+ function lu (A:: AbstractMatrix , pivot:: Union{Val{false}, Val{true}} = Val ( true ) )
189189 F = lufact (A, pivot)
190190 F[:L ], F[:U ], F[:p ]
191191end
319319# Tridiagonal
320320
321321# See dgttrf.f
322- function lufact! (A:: Tridiagonal{T} , pivot:: Union{Type{ Val{false}}, Type{ Val{true}}} = Val{ true } ) where T
322+ function lufact! (A:: Tridiagonal{T} , pivot:: Union{Val{false}, Val{true}} = Val ( true ) ) where T
323323 n = size (A, 1 )
324324 info = 0
325325 ipiv = Vector {BlasInt} (n)
@@ -334,7 +334,7 @@ function lufact!(A::Tridiagonal{T}, pivot::Union{Type{Val{false}}, Type{Val{true
334334 end
335335 for i = 1 : n- 2
336336 # pivot or not?
337- if pivot === Val{ false } || abs (d[i]) >= abs (dl[i])
337+ if pivot === Val ( false ) || abs (d[i]) >= abs (dl[i])
338338 # No interchange
339339 if d[i] != 0
340340 fact = dl[i]/ d[i]
@@ -357,7 +357,7 @@ function lufact!(A::Tridiagonal{T}, pivot::Union{Type{Val{false}}, Type{Val{true
357357 end
358358 if n > 1
359359 i = n- 1
360- if pivot === Val{ false } || abs (d[i]) >= abs (dl[i])
360+ if pivot === Val ( false ) || abs (d[i]) >= abs (dl[i])
361361 if d[i] != 0
362362 fact = dl[i]/ d[i]
363363 dl[i] = fact
0 commit comments