-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Remove unnecessary restriction to StridedVecOrMat
#35929
Conversation
The "Strided array interface" https://docs.julialang.org/en/v1/manual/interfaces/#man-interface-strided-arrays-1 means that this is useful beyond these types
Note ArrayLayouts.jl also has an approach for pointers to adjoints of complex arrays by defining """
ConjPtr{T}
represents that the entry is the complex-conjugate of the pointed to entry.
"""
struct ConjPtr{T}
ptr::Ptr{T}
end
unsafe_convert(::Type{ConjPtr{T}}, Ac::Adjoint{<:Complex}) where T<:Complex = unsafe_convert(Ptr{T}, parent(Ac))
function unsafe_convert(::Type{ConjPtr{T}}, V::SubArray{T,2}) where {T,N,P}
kr, jr = parentindices(V)
unsafe_convert(Ptr{T}, view(parent(V)', jr, kr))
end |
Can this get merged so I can start testing all the packages I manage on Julia v1.5? |
It seems a test was requested. |
I'm a bit confused by the following: julia> strides(randn(4)')
(4, 1)
julia> strides([1 2 3 4])
(1, 1) Shouldn't |
Good question... but is there a case in which it matters? You're not allowed to multiply that first value by anything other than zero, are you? Is there a way in which |
Only because |
This is my main motivation: julia> strides(randn(4, 1)')
(4, 1)
julia> strides(randn(4)')
(4, 1) |
OK that's a strong argument. So I generalised I also added @mbauman Could you review the changes again please? |
I believe this is ready to merge now unless you want other changes made. |
Whitespace needs fixing. If this is not merged soon, I'll just push for a 1.5-RC1 since the only thing this "fixes" is a package that was doing type piracy anyway and could just be worked around in the package. |
The test failure looks unrelated |
Does "backport-1.5" mean it's not going to be in v1.5.0? If so I'll start working around the issue in ArrayLayouts.jl for v1.5-beta |
No, if it gets merged before 1.5.0 is released, then it will be in. |
* origin/master: (232 commits) Add passthrough for non-Markdown docs (JuliaLang#36091) Fix pointer to no longer assume contiguity (JuliaLang#36405) Ensure string-hashing is defined before it gets used (JuliaLang#36411) Make compilecache atomic (JuliaLang#36416) add a test for JuliaLang#30739 (JuliaLang#36395) Fix broken links in docstring of `repeat` (JuliaLang#36376) fix and de-dup cached calls to `methods_by_ftype` in compiler (JuliaLang#36404) ml-matches: skip unnecessary work, when possible (JuliaLang#36413) gf: fix some issues with the move from using a tree to a hash lookup of leaf types (JuliaLang#36413) Add news and manual entry for sincospi (JuliaLang#36403) Check axes in Array(::AbstractArray) (fixes JuliaLang#36220) (JuliaLang#36397) add versions of `code_typed` and `which` that accept tuple types (JuliaLang#36389) Fix spelling of readdir. (JuliaLang#36409) add sincospi (JuliaLang#35816) fix showing methods with unicode gensymed variable names (JuliaLang#36396) Add doctest: eachslice (JuliaLang#36386) fix documentation typo ("Ingeger") Refactor `abstract_eval` to separate out statements and values (JuliaLang#36350) fix return type of `get!` on `IdDict` (JuliaLang#36383) Allow single option with REPL.TerminalMenus (JuliaLang#36369) ...
* Remove unnecessary restriction to `StridedVecOrMat` The "Strided array interface" https://docs.julialang.org/en/v1/manual/interfaces/#man-interface-strided-arrays-1 means that this is useful beyond these types * Update adjtrans.jl * Add tests for adj/trans strides * Add tests, change strides(::Adjoint{<:Any,<:AbstractVector}) definition * stride(::AbstractrArray, k) for all k, add ConjPtr * Remove ConjPtr * Always throw an error if strides is not implemented * Update abstractarray.jl * Update blas.jl * Remove k < 1 special case * Also widen elsize to AbstractVecOrMat * Use strides for dim > ndims * Update stdlib/LinearAlgebra/test/blas.jl Co-authored-by: Matt Bauman <mbauman@gmail.com> (cherry picked from commit 6b2c7f1)
* Remove unnecessary restriction to `StridedVecOrMat` The "Strided array interface" https://docs.julialang.org/en/v1/manual/interfaces/#man-interface-strided-arrays-1 means that this is useful beyond these types * Update adjtrans.jl * Add tests for adj/trans strides * Add tests, change strides(::Adjoint{<:Any,<:AbstractVector}) definition * stride(::AbstractrArray, k) for all k, add ConjPtr * Remove ConjPtr * Always throw an error if strides is not implemented * Update abstractarray.jl * Update blas.jl * Remove k < 1 special case * Also widen elsize to AbstractVecOrMat * Use strides for dim > ndims * Update stdlib/LinearAlgebra/test/blas.jl Co-authored-by: Matt Bauman <mbauman@gmail.com>
The "Strided array interface" https://docs.julialang.org/en/v1/manual/interfaces/#man-interface-strided-arrays-1 means that this is useful beyond just
StridedVecOrMat
so there is no reason to be so restrictive.