Commit d0e7ec0
authored
Adjoint for vectors may use trailing axes of the parent (#52379)
Close #52373, or at least the part that may be addressed here. After
this, the first axis for an `Adjoint(parent::AbstractVector)` will be
the second axis of the `parent`. This will change the type of the axis
where the parent array type specializes `axes(A, d)`. In the short term,
this would improve type-stability in cases such as
```julia
julia> A = OffsetArray([1,2], 2);
julia> @code_typed axes(A')[1]
CodeInfo(
1 ─ %1 = $(Expr(:boundscheck))::Bool
│ %2 = Base.getfield(t, i, %1)::OffsetArrays.IdOffsetRange{Int64, Base.OneTo{Int64}}
└── return %2
) => OffsetArrays.IdOffsetRange{Int64, Base.OneTo{Int64}}
```
where the result is now concretely inferred instead of being a small
`Union`.
In principle, with
JuliaArrays/StaticArrays.jl#916, this would make
the axes of the adjoint of a `StaticVector` statically sized.1 parent 28b252a commit d0e7ec0
File tree
3 files changed
+11
-3
lines changed- stdlib/LinearAlgebra
- src
- test
- test
3 files changed
+11
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
327 | | - | |
| 327 | + | |
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
90 | | - | |
| 93 | + | |
91 | 94 | | |
92 | 95 | | |
93 | 96 | | |
94 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
95 | 102 | | |
96 | 103 | | |
97 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
406 | | - | |
| 406 | + | |
| 407 | + | |
407 | 408 | | |
408 | 409 | | |
409 | 410 | | |
| |||
0 commit comments