From 09d96ab998987dd578dadcc0584dab1a141b4e3f Mon Sep 17 00:00:00 2001 From: ST John Date: Wed, 3 Nov 2021 17:31:16 +0200 Subject: [PATCH] deprecate CholType --- src/chol.jl | 5 ++--- src/deprecates.jl | 2 ++ src/pdmat.jl | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/chol.jl b/src/chol.jl index 01061a7..c95ea4c 100644 --- a/src/chol.jl +++ b/src/chol.jl @@ -1,9 +1,8 @@ -CholType{T,S<:AbstractMatrix} = Cholesky{T,S} chol_lower(a::Matrix) = cholesky(a).L # always use the stored cholesky factor, not a copy -chol_lower(a::CholType) = a.uplo === 'L' ? a.L : a.U' -chol_upper(a::CholType) = a.uplo === 'U' ? a.U : a.L' +chol_lower(a::Cholesky) = a.uplo === 'L' ? a.L : a.U' +chol_upper(a::Cholesky) = a.uplo === 'U' ? a.U : a.L' if HAVE_CHOLMOD CholTypeSparse{T} = SuiteSparse.CHOLMOD.Factor{T} diff --git a/src/deprecates.jl b/src/deprecates.jl index 8b510c0..366c854 100644 --- a/src/deprecates.jl +++ b/src/deprecates.jl @@ -9,3 +9,5 @@ using Base: @deprecate @deprecate add_scal(a::Matrix, b::AbstractPDMat, c::Real) pdadd(a, b, c) @deprecate full(x::AbstractPDMat) Matrix(x) + +@deprecate CholType Cholesky diff --git a/src/pdmat.jl b/src/pdmat.jl index 5990a5f..2260537 100644 --- a/src/pdmat.jl +++ b/src/pdmat.jl @@ -4,12 +4,12 @@ Full positive definite matrix together with a Cholesky factorization object. struct PDMat{T<:Real,S<:AbstractMatrix} <: AbstractPDMat{T} dim::Int mat::S - chol::CholType{T,S} + chol::Cholesky{T,S} - PDMat{T,S}(d::Int,m::AbstractMatrix{T},c::CholType{T,S}) where {T,S} = new{T,S}(d,m,c) + PDMat{T,S}(d::Int,m::AbstractMatrix{T},c::Cholesky{T,S}) where {T,S} = new{T,S}(d,m,c) end -function PDMat(mat::AbstractMatrix,chol::CholType{T,S}) where {T,S} +function PDMat(mat::AbstractMatrix,chol::Cholesky{T,S}) where {T,S} d = size(mat, 1) size(chol, 1) == d || throw(DimensionMismatch("Dimensions of mat and chol are inconsistent.")) @@ -18,7 +18,7 @@ end PDMat(mat::Matrix) = PDMat(mat, cholesky(mat)) PDMat(mat::Symmetric) = PDMat(Matrix(mat)) -PDMat(fac::CholType) = PDMat(Matrix(fac), fac) +PDMat(fac::Cholesky) = PDMat(Matrix(fac), fac) ### Conversion Base.convert(::Type{PDMat{T}}, a::PDMat) where {T<:Real} = PDMat(convert(AbstractArray{T}, a.mat))