Skip to content

Commit

Permalink
Reland " Avoid materializing arrays in bidiag matmul #55450" (#55777)
Browse files Browse the repository at this point in the history
This relands #55450 and adds tests for the failing case noted in
https://github.com/JuliaLang/julia/issues/55727. The `addmul` tests that
were failing earlier pass with this change.

The issue in the earlier PR was that we were not exiting quickly for
`iszero(alpha)` in `_bibimul!` for small matrices, and were computing
the result as `C .= A * B * alpha + C * beta`. The problem with this is
that if `A * B` contains `NaN`s, this propagates to `C` even if `alpha
=== 0.0`. This is fixed now, and the result is only computed if
`!iszero(alpha)`.
  • Loading branch information
jishnub authored Sep 19, 2024
1 parent 1aff771 commit bcd2e0b
Show file tree
Hide file tree
Showing 5 changed files with 453 additions and 52 deletions.
4 changes: 3 additions & 1 deletion 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))
dv = similar(A, TS, n)
Tridiagonal(ev, dv, similar(ev))
end

# Special handling for adj/trans vec
Expand Down
Loading

0 comments on commit bcd2e0b

Please sign in to comment.