Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjoint for vectors may use trailing axes of the parent #52379

Merged
merged 3 commits into from
Dec 5, 2023
Merged

Conversation

jishnub
Copy link
Contributor

@jishnub jishnub commented Dec 3, 2023

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> 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.

@jishnub jishnub added the linear algebra Linear algebra label Dec 3, 2023
Copy link
Member

@dkarrasch dkarrasch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me.

@dkarrasch dkarrasch added the merge me PR is reviewed. Merge when all tests are passing label Dec 5, 2023
@N5N3 N5N3 merged commit d0e7ec0 into master Dec 5, 2023
8 checks passed
@N5N3 N5N3 deleted the jishnub/adjaxes branch December 5, 2023 14:54
@giordano giordano removed the merge me PR is reviewed. Merge when all tests are passing label Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear algebra Linear algebra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Axes for transposed OffsetArray vector incorrect due to LinearAlgebra method
4 participants