You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can fix this by changing partialcholesky! to check whether it hits the diagonal special case:
functionpartialcholesky!(F::AdaptiveCholeskyFactors{T,<:BandedMatrix}, n::Int) where T
if n > F.ncols
_,u =bandwidths(F.data.array)
resizedata!(F.data,n+u,n+u);
ncols = F.ncols
kr = ncols+1:n
factors =view(F.data.data,kr,kr)
banded_chol!(factors, UpperTriangular)
# multiply remaining columns
kr2 =max(n-u+1,kr[1]):n
U1 =UpperTriangular(view(F.data.data,kr2,kr2))
B =view(F.data.data,kr2,n+1:n+u)
ldiv!(U1',B)
if u >0muladd!(-one(T),B',B,one(T),view(F.data.data,n+1:n+u,n+1:n+u))
else# Diagonal special casemuladd!(-one(T),zeros(T,0,0),zeros(T,0,0),one(T),view(F.data.data,n+1:n+u,n+1:n+u))
end
F.ncols = n
end
F
end
The only change is the else case of the if statement at the bottom. A more proper fix I suppose would be to fix this upstream in ArrayLayouts. The issue is basically that it's handing an empty banded matrix with bandwidths (0,-1) which breaks MulAdd somewhere. (the placement of the if statement should happen sooner for efficiency and we can avoid muladd altogether in the diagonal case if we special case it but it's more clear what breaks for this comment when written this way)
Basically two options:
Is this what you want MulAdd to do when given a degenerate banded matrix in which case I can clean the above up and turn it into a PR here or
Is this something to instead fix upstream in ArrayLayouts.jl?
The text was updated successfully, but these errors were encountered: