https://github.com/JuliaLang/julia
Revision 66e941073f400b92a6d8cf4d6bce5a6cb2d00b6c authored by Jishnu Bhattacharya on 27 December 2023, 06:36:28 UTC, committed by GitHub on 27 December 2023, 06:36:28 UTC
The following works after this PR:
```julia
julia> oftype(Diagonal(Float32[1,2]), [1 0; 0 2])
2×2 Diagonal{Float32, Vector{Float32}}:
 1.0   ⋅ 
  ⋅   2.0
```
This changes the behavior of the constructor to copy the diagonal, so
now
```julia
julia> D = Diagonal([1,2]);

julia> typeof(D)(D).diag === D.diag
false
```
whereas this used to be `true` previously. This probably doesn't matter
much, as in most non-trivial cases it'd be copied anyway, and this
conversion is unusual in the trivial case.

---------

Co-authored-by: Daniel Karrasch <daniel.karrasch@posteo.de>
1 parent b4eefd0
History
Tip revision: 66e941073f400b92a6d8cf4d6bce5a6cb2d00b6c authored by Jishnu Bhattacharya on 27 December 2023, 06:36:28 UTC
Add a fully typed Diagonal constructor from `AbstractMatrix`es (#52487)
Tip revision: 66e9410
File Mode Size
.devcontainer
.github
base
cli
contrib
deps
doc
etc
src
stdlib
test
.buildkite-external-version -rw-r--r-- 5 bytes
.clang-format -rw-r--r-- 3.3 KB
.clangd -rw-r--r-- 114 bytes
.codecov.yml -rw-r--r-- 52 bytes
.git-blame-ignore-revs -rw-r--r-- 371 bytes
.gitattributes -rw-r--r-- 65 bytes
.gitignore -rw-r--r-- 523 bytes
.mailmap -rw-r--r-- 12.7 KB
CITATION.bib -rw-r--r-- 513 bytes
CITATION.cff -rw-r--r-- 940 bytes
CONTRIBUTING.md -rw-r--r-- 23.4 KB
HISTORY.md -rw-r--r-- 372.8 KB
LICENSE.md -rw-r--r-- 1.3 KB
Make.inc -rw-r--r-- 55.9 KB
Makefile -rw-r--r-- 30.3 KB
NEWS.md -rw-r--r-- 8.3 KB
README.md -rw-r--r-- 7.4 KB
THIRDPARTY.md -rw-r--r-- 3.8 KB
VERSION -rw-r--r-- 11 bytes
julia.spdx.json -rw-r--r-- 35.8 KB
pkgimage.mk -rw-r--r-- 5.8 KB
sysimage.mk -rw-r--r-- 4.2 KB
typos.toml -rw-r--r-- 78 bytes

README.md

back to top