Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub committed Feb 19, 2025
1 parent 17c7dc8 commit abdb8b9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/diagonal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ _copy_diag(M::T, ::T) where {T<:Lmul} = copyto!(_similar(M.B), M)
_copy_diag(M, _) = copy(M)
_bidiagonal(A::Bidiagonal) = A
function _bidiagonal(A)
# we assume that the matrix is indeed bidiagonal
# we assume that the matrix is indeed bidiagonal,
# so that the conversion is lossless
if iszero(view(A, diagind(A, -1)))
uplo = :U
else
Expand All @@ -81,6 +82,8 @@ function copy(M::Lmul{<:DiagonalLayout,<:BidiagonalLayout})
B = _bidiagonal(M.B)
_copy_diag(Lmul(M.A, B), M)
end
# we assume that the matrix is indeed tridiagonal,
# so that the conversion is lossless
_tridiagonal(A::Tridiagonal) = A
_tridiagonal(A) = Tridiagonal(A)

Check warning on line 88 in src/diagonal.jl

View check run for this annotation

Codecov / codecov/patch

src/diagonal.jl#L88

Added line #L88 was not covered by tests
function copy(M::Rmul{<:TridiagonalLayout,<:DiagonalLayout})
Expand All @@ -91,6 +94,8 @@ function copy(M::Lmul{<:DiagonalLayout,<:TridiagonalLayout})
B = _tridiagonal(M.B)
_copy_diag(Lmul(M.A, B), M)
end
# we assume that the matrix is indeed symmetric tridiagonal,
# so that the conversion is lossless
_symtridiagonal(A::SymTridiagonal) = A
_symtridiagonal(A) = SymTridiagonal(A)

Check warning on line 100 in src/diagonal.jl

View check run for this annotation

Codecov / codecov/patch

src/diagonal.jl#L100

Added line #L100 was not covered by tests
function copy(M::Rmul{<:SymTridiagonalLayout,<:DiagonalLayout})
Expand Down

0 comments on commit abdb8b9

Please # to comment.