JuliaStats / PDMats.jl

Uniform Interface for positive definite matrices of various structures
Other
104 stars 43 forks source link

v0.11.8 could be breaking for downstream packages #160

Closed simsurace closed 2 years ago

simsurace commented 2 years ago

Some code in ApproximateGPs broke silently, see https://github.com/JuliaGaussianProcesses/ApproximateGPs.jl/issues/131.

devmotion commented 2 years ago

The changes in 0.11.8 (https://github.com/JuliaStats/PDMats.jl/compare/v0.11.7...v0.11.8) are non-breaking. This is also confirmed by a simple example such as

julia> using LinearAlgebra

julia> chol_lower(a::Cholesky) = a.uplo === 'L' ? a.L : a.U'                                                                                                                                                                                

julia> chol_upper(a::Cholesky) = a.uplo === 'U' ? a.U : a.L'                                                                                                                    

julia> function chol_lower_new(a::Cholesky)                                                                                                                                                                                                 
           return a.uplo === 'L' ? LowerTriangular(a.factors) : LowerTriangular(a.factors')               
       end                                                                                                                                                                                                                                  

julia> function chol_upper_new(a::Cholesky)                                                                                                                                                                                                 
           return a.uplo === 'U' ? UpperTriangular(a.factors) : UpperTriangular(a.factors')
       end

julia> A = (a = randn(5, 5); a * a' + I);

julia> CL = Cholesky(LowerTriangular(A));

julia> CU = Cholesky(UpperTriangular(A));

julia> CL.uplo
'L': ASCII/Unicode U+004C (category Lu: Letter, uppercase)

julia> CU.uplo
'U': ASCII/Unicode U+0055 (category Lu: Letter, uppercase)

julia> chol_lower(CL) == chol_lower_new(CL)
true

julia> chol_lower(CU) == chol_lower_new(CU)
true

julia> chol_upper(CL) == chol_upper_new(CL)
true

julia> chol_upper(CU) == chol_upper_new(CU)
true

It seems ApproximateGPs relies on some internals and/or this is an issue with AD systems.

simsurace commented 2 years ago

Thanks for checking!