From d321cced11521832636925c14f5e606698e18735 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Mon, 28 Oct 2024 14:50:33 +0530 Subject: [PATCH] inline __muldiag_nonzeroalpha! for Diagonal destination --- stdlib/LinearAlgebra/src/diagonal.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/LinearAlgebra/src/diagonal.jl b/stdlib/LinearAlgebra/src/diagonal.jl index 9f49b09d10537..55377306dc7cf 100644 --- a/stdlib/LinearAlgebra/src/diagonal.jl +++ b/stdlib/LinearAlgebra/src/diagonal.jl @@ -491,11 +491,11 @@ end end out end - @inline function __muldiag_nonzeroalpha!(out, D1::Diagonal, D2::Diagonal, alpha::Number, beta::Number) d1 = D1.diag d2 = D2.diag # this method is only called with beta == true + # we hardcode beta == true in the loop to reduce the @stable_muladdmul branches isone(beta) || throw(ArgumentError("beta must satisfy isone(beta)")) @inbounds for i in eachindex(d1, d2) @stable_muladdmul _modify!(MulAddMul(alpha,true), d1[i] * d2[i], out, (i,i))