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

Lazy identities via FillArrays #94

Merged
merged 18 commits into from
May 4, 2023
9 changes: 7 additions & 2 deletions src/operators_lazytensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,13 @@ function _tp_matmul_mid!(result, a::AbstractMatrix, loc::Integer, b, α::Number,
size(b, loc) == size(a, 2) && size(result, loc) == size(a, 1) || throw(DimensionMismatch("Dimensions of Eye matrix do not match subspace dimensions."))
d = min(size(a)...)

rmul!(result, β)
@strided result_r[:, 1:d, :] .+= α .* br[:, 1:d, :]
if !iszero(β)
amilsted marked this conversation as resolved.
Show resolved Hide resolved
rmul!(result, β)
@strided result_r[:, 1:d, :] .+= α .* br[:, 1:d, :]
else
fill!(result, zero(eltype(result)))
@strided result_r[:, 1:d, :] .= α .* br[:, 1:d, :]
end

return result
end
Expand Down