Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid materializing arrays in bidiag matmul #55450

Merged
merged 13 commits into from
Sep 10, 2024
4 changes: 3 additions & 1 deletion stdlib/LinearAlgebra/src/LinearAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,9 @@ matprod_dest(A::Diagonal, B::Diagonal, TS) = _matprod_dest_diag(B, TS)
_matprod_dest_diag(A, TS) = similar(A, TS)
function _matprod_dest_diag(A::SymTridiagonal, TS)
n = size(A, 1)
Tridiagonal(similar(A, TS, n-1), similar(A, TS, n), similar(A, TS, n-1))
ev = similar(A, TS, max(0, n-1))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes ev allocation for n==0

dv = similar(A, TS, n)
Tridiagonal(ev, dv, similar(ev))
end

# Special handling for adj/trans vec
Expand Down
Loading