julia
3da897b1 - Don't access uninitialized indices in `tril!`/`triu!` for numeric arrays (#52528)

Commit
2 years ago
Don't access uninitialized indices in `tril!`/`triu!` for numeric arrays (#52528) This specializes the generic `triu!` and `tril!` methods for arrays of numbers, where a zero is known to exist. In such cases, we don't need to read the possibly uninitialized values of the elements at the indices that are to be assigned to. After this, the following would be possible: ```julia julia> M = Matrix{BigFloat}(undef, 3, 3) 3×3 Matrix{BigFloat}: #undef #undef #undef #undef #undef #undef #undef #undef #undef julia> triu!(M) 3×3 Matrix{BigFloat}: #undef #undef #undef 0.0 #undef #undef 0.0 0.0 #undef ```
Author
Parents
Loading