Commit 66e9410
Add a fully typed Diagonal constructor from
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 <[email protected]>AbstractMatrixes (#52487)1 parent b4eefd0 commit 66e9410
2 files changed
+8
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
| |||
102 | 101 | | |
103 | 102 | | |
104 | 103 | | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
53 | 60 | | |
54 | 61 | | |
55 | 62 | | |
| |||
0 commit comments