Skip to content

Commit

Permalink
unwrap patch in setproperties for Cholesky using parent
Browse files Browse the repository at this point in the history
  • Loading branch information
torfjelde committed Sep 7, 2023
1 parent bdd89ae commit 4b8db56
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/nonstandard.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ constructorof(::Type{<:Expr}) = (head, args) -> Expr(head, args...)::Expr
### Cholesky
setproperties(C::LinearAlgebra.Cholesky, patch::NamedTuple{()}) = C
function setproperties(C::LinearAlgebra.Cholesky, patch::NamedTuple{(:L,)})
return LinearAlgebra.Cholesky(C.uplo === 'U' ? permutedims(patch.L) : patch.L, C.uplo, C.info)
return LinearAlgebra.Cholesky(parent(C.uplo === 'U' ? permutedims(patch.L) : patch.L), C.uplo, C.info)
end
function setproperties(C::LinearAlgebra.Cholesky, patch::NamedTuple{(:U,)})
return LinearAlgebra.Cholesky(C.uplo === 'L' ? permutedims(patch.U) : patch.U, C.uplo, C.info)
return LinearAlgebra.Cholesky(parent(C.uplo === 'L' ? permutedims(patch.U) : patch.U), C.uplo, C.info)
end
function setproperties(C::LinearAlgebra.Cholesky, patch::NamedTuple{(:UL,)})
return LinearAlgebra.Cholesky(patch.UL, C.uplo, C.info)
return LinearAlgebra.Cholesky(parent(patch.UL), C.uplo, C.info)
end
function setproperties(C::LinearAlgebra.Cholesky, patch::NamedTuple)
throw(ArgumentError("Invalid patch for `Cholesky`: $(patch)"))
Expand Down

0 comments on commit 4b8db56

Please sign in to comment.