2121# The internal structure is as follows
2222# - _chol! returns the factor and info without checking positive definiteness
2323# - chol/chol! returns the factor and checks for positive definiteness
24- # - cholfact/cholfact! returns Cholesky with checking positive definiteness
24+ # - cholfact/cholfact! returns Cholesky without checking positive definiteness
2525
2626# FixMe? The dispatch below seems overly complicated. One simplification could be to
2727# merge the two Cholesky types into one. It would remove the need for Val completely but
@@ -207,8 +207,8 @@ chol(x::Number, args...) = ((C, info) = _chol!(x, nothing); @assertposdef C info
207207
208208# cholfact!. Destructive methods for computing Cholesky factorization of real symmetric
209209# or Hermitian matrix
210- # # No pivoting
211- function cholfact! (A:: RealHermSymComplexHerm , :: Type{Val{false}} )
210+ # # No pivoting (default)
211+ function cholfact! (A:: RealHermSymComplexHerm , :: Type{Val{false}} = Val{ false } )
212212 if A. uplo == ' U'
213213 CU, info = _chol! (A. data, UpperTriangular)
214214 Cholesky (CU. data, ' U' , info)
220220
221221# ## for StridedMatrices, check that matrix is symmetric/Hermitian
222222"""
223- cholfact!(A, [uplo::Symbol,] Val{false}) -> Cholesky
223+ cholfact!(A, Val{false}) -> Cholesky
224224
225225The same as [`cholfact`](@ref), but saves space by overwriting the input `A`,
226226instead of creating a copy. An [`InexactError`](@ref) exception is thrown if
@@ -239,18 +239,9 @@ julia> cholfact!(A)
239239ERROR: InexactError()
240240```
241241"""
242- function cholfact! (A:: StridedMatrix , uplo :: Symbol , :: Type{Val{false}} )
242+ function cholfact! (A:: StridedMatrix , :: Type{Val{false}} = Val{ false })
243243 ishermitian (A) || non_hermitian_error (" cholfact!" )
244- return cholfact! (Hermitian (A, uplo), Val{false })
245- end
246-
247- # ## Default to no pivoting (and storing of upper factor) when not explicit
248- cholfact! (A:: RealHermSymComplexHerm ) = cholfact! (A, Val{false })
249-
250- # ### for StridedMatrices, check that matrix is symmetric/Hermitian
251- function cholfact! (A:: StridedMatrix , uplo:: Symbol = :U )
252- ishermitian (A) || non_hermitian_error (" cholfact!" )
253- return cholfact! (Hermitian (A, uplo))
244+ return cholfact! (Hermitian (A), Val{false })
254245end
255246
256247
@@ -270,37 +261,34 @@ cholfact!(A::RealHermSymComplexHerm{<:Real}, ::Type{Val{true}};
270261
271262# ## for StridedMatrices, check that matrix is symmetric/Hermitian
272263"""
273- cholfact!(A, [uplo::Symbol,] Val{true}; tol = 0.0) -> CholeskyPivoted
264+ cholfact!(A, Val{true}; tol = 0.0) -> CholeskyPivoted
274265
275266The same as [`cholfact`](@ref), but saves space by overwriting the input `A`,
276267instead of creating a copy. An [`InexactError`](@ref) exception is thrown if the
277268factorization produces a number not representable by the element type of `A`,
278269e.g. for integer types.
279270"""
280- function cholfact! (A:: StridedMatrix , uplo :: Symbol , :: Type{Val{true}} ; tol = 0.0 )
271+ function cholfact! (A:: StridedMatrix , :: Type{Val{true}} ; tol = 0.0 )
281272 ishermitian (A) || non_hermitian_error (" cholfact!" )
282- return cholfact! (Hermitian (A, uplo ), Val{true }; tol = tol)
273+ return cholfact! (Hermitian (A), Val{true }; tol = tol)
283274end
284275
285276# cholfact. Non-destructive methods for computing Cholesky factorization of real symmetric
286277# or Hermitian matrix
287- # # No pivoting
288- cholfact (A:: RealHermSymComplexHerm{<:Real,<:StridedMatrix} , :: Type{Val{false}} ) =
289- cholfact! (copy_oftype (A, promote_type (typeof (chol (one (eltype (A)))),Float32)), Val{ false } )
278+ # # No pivoting (default)
279+ cholfact (A:: RealHermSymComplexHerm{<:Real,<:StridedMatrix} , :: Type{Val{false}} = Val{ false } ) =
280+ cholfact! (copy_oftype (A, promote_type (typeof (chol (one (eltype (A)))),Float32)))
290281
291282# ## for StridedMatrices, check that matrix is symmetric/Hermitian
292283"""
293- cholfact(A, [uplo::Symbol,] Val{false}) -> Cholesky
284+ cholfact(A, Val{false}) -> Cholesky
294285
295286Compute the Cholesky factorization of a dense symmetric positive definite matrix `A`
296287and return a `Cholesky` factorization. The matrix `A` can either be a [`Symmetric`](@ref) or [`Hermitian`](@ref)
297- `StridedMatrix` or a *perfectly* symmetric or Hermitian `StridedMatrix`. In the latter case,
298- the optional argument `uplo` may be `:L` for using the lower part or `:U` for the upper part of `A`.
299- The default is to use `:U`.
288+ `StridedMatrix` or a *perfectly* symmetric or Hermitian `StridedMatrix`.
300289The triangular Cholesky factor can be obtained from the factorization `F` with: `F[:L]` and `F[:U]`.
301290The following functions are available for `Cholesky` objects: [`size`](@ref), [`\\ `](@ref),
302291[`inv`](@ref), and [`det`](@ref).
303- A `PosDefException` exception is thrown in case the matrix is not positive definite.
304292
305293# Example
306294
@@ -331,18 +319,9 @@ julia> C[:L] * C[:U] == A
331319true
332320```
333321"""
334- function cholfact (A:: StridedMatrix , uplo:: Symbol , :: Type{Val{false}} )
335- ishermitian (A) || non_hermitian_error (" cholfact" )
336- return cholfact (Hermitian (A, uplo), Val{false })
337- end
338-
339- # ## Default to no pivoting (and storing of upper factor) when not explicit
340- cholfact (A:: RealHermSymComplexHerm{<:Real,<:StridedMatrix} ) = cholfact (A, Val{false })
341-
342- # ### for StridedMatrices, check that matrix is symmetric/Hermitian
343- function cholfact (A:: StridedMatrix , uplo:: Symbol = :U )
322+ function cholfact (A:: StridedMatrix , :: Type{Val{false}} = Val{false })
344323 ishermitian (A) || non_hermitian_error (" cholfact" )
345- return cholfact (Hermitian (A, uplo ))
324+ return cholfact (Hermitian (A))
346325end
347326
348327
@@ -353,22 +332,20 @@ cholfact(A::RealHermSymComplexHerm{<:Real,<:StridedMatrix}, ::Type{Val{true}}; t
353332
354333# ## for StridedMatrices, check that matrix is symmetric/Hermitian
355334"""
356- cholfact(A, [uplo::Symbol,] Val{true}; tol = 0.0) -> CholeskyPivoted
335+ cholfact(A, Val{true}; tol = 0.0) -> CholeskyPivoted
357336
358337Compute the pivoted Cholesky factorization of a dense symmetric positive semi-definite matrix `A`
359338and return a `CholeskyPivoted` factorization. The matrix `A` can either be a [`Symmetric`](@ref)
360339or [`Hermitian`](@ref) `StridedMatrix` or a *perfectly* symmetric or Hermitian `StridedMatrix`.
361- In the latter case, the optional argument `uplo` may be `:L` for using the lower part or `:U`
362- for the upper part of `A`. The default is to use `:U`.
363340The triangular Cholesky factor can be obtained from the factorization `F` with: `F[:L]` and `F[:U]`.
364341The following functions are available for `PivotedCholesky` objects:
365342[`size`](@ref), [`\\ `](@ref), [`inv`](@ref), [`det`](@ref), and [`rank`](@ref).
366343The argument `tol` determines the tolerance for determining the rank.
367344For negative values, the tolerance is the machine precision.
368345"""
369- function cholfact (A:: StridedMatrix , uplo :: Symbol , :: Type{Val{true}} ; tol = 0.0 )
346+ function cholfact (A:: StridedMatrix , :: Type{Val{true}} ; tol = 0.0 )
370347 ishermitian (A) || non_hermitian_error (" cholfact" )
371- return cholfact (Hermitian (A, uplo ), Val{true }; tol = tol)
348+ return cholfact (Hermitian (A), Val{true }; tol = tol)
372349end
373350
374351# # Number
0 commit comments