Skip to content

Commit

Permalink
Loop in copyfirstrow!
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub committed Apr 20, 2024
1 parent e641472 commit 0fe575c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/fillalgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,12 @@ end
_firstcol(C::AbstractMatrix) = first(eachcol(C))

function copyfirstrow!(C)
C[begin+1:end, :] .= permutedims(_firstrow(C))
# C[begin+1:end, ind] .= permutedims(_firstrow(C))
# we loop here as the aliasing check isn't smart enough to
# detect that the two sides don't alias, and ends up materializing the RHS
for (ind, v) in pairs(_firstrow(C))
C[begin+1:end, ind] .= Ref(v)
end
return C
end
_firstrow(C::AbstractMatrix) = first(eachrow(C))
Expand Down

0 comments on commit 0fe575c

Please sign in to comment.