Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
torfjelde and github-actions[bot] authored Sep 6, 2023
1 parent 035d592 commit 24076b5
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1062,14 +1062,22 @@ end
# TODO: Remove as soon as https://github.com/JuliaObjects/ConstructionBase.jl/pull/80 goes through.
ConstructionBase.setproperties(C::LinearAlgebra.Cholesky, ::NamedTuple{()}) = C
function ConstructionBase.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(
C.uplo === 'U' ? permutedims(patch.L) : patch.L, C.uplo, C.info
)
end
function ConstructionBase.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(
C.uplo === 'L' ? permutedims(patch.U) : patch.U, C.uplo, C.info
)
end
function ConstructionBase.setproperties(C::LinearAlgebra.Cholesky, patch::NamedTuple{(:UL,)})
function ConstructionBase.setproperties(
C::LinearAlgebra.Cholesky, patch::NamedTuple{(:UL,)}
)
return LinearAlgebra.Cholesky(patch.UL, C.uplo, C.info)
end
@nospecialize function ConstructionBase.setproperties(C::LinearAlgebra.Cholesky, patch::NamedTuple)
error("Can only patch one of :L, :U, :UL at the time")
@nospecialize function ConstructionBase.setproperties(
C::LinearAlgebra.Cholesky, patch::NamedTuple
)
return error("Can only patch one of :L, :U, :UL at the time")
end

0 comments on commit 24076b5

Please sign in to comment.