diff --git a/Project.toml b/Project.toml index 8d945ce..a93530e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "StridedViews" uuid = "4db3bf67-4bd7-4b4e-b153-31dc3fb37143" authors = ["Lukas Devos ", "Jutho Haegeman "] -version = "0.2.1" +version = "0.2.2" [deps] CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" @@ -15,8 +15,12 @@ CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" StridedViewsCUDAExt = "CUDA" [compat] +Aqua = "0.8" CUDA = "4,5" +LinearAlgebra = "1.6" PackageExtensionCompat = "1" +Random = "1.6" +Test = "1.6" julia = "1.6" [extras] diff --git a/src/stridedview.jl b/src/stridedview.jl index f63e727..1bed746 100644 --- a/src/stridedview.jl +++ b/src/stridedview.jl @@ -171,6 +171,13 @@ end sreshape(a::AbstractArray, newsize::Dims) = sreshape(StridedView(a), newsize) +function sreshape(a::LinearAlgebra.AdjointAbsVec, newsize::Dims) + return sreshape(conj(StridedView(adjoint(a))), newsize) +end +function sreshape(a::LinearAlgebra.TransposeAbsVec, newsize::Dims) + return sreshape(StridedView(transpose(a)), newsize) +end + # Other methods: `similar`, `copy` #---------------------------------- function Base.similar(a::StridedView, ::Type{T}, dims::NTuple{N,Int}) where {N,T} diff --git a/test/runtests.jl b/test/runtests.jl index 499dad7..83a998f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -111,6 +111,15 @@ Random.seed!(1234) end end +@testset "transpose and adjoint with vector StridedView" begin + @testset for T in (Float32, Float64, Complex{Float32}, Complex{Float64}) + A = randn(T, (60,)) + + @test sreshape(transpose(A), (1, length(A))) == transpose(A) + @test sreshape(adjoint(A), (1, length(A))) == adjoint(A) + end +end + @testset "elementwise conj, transpose and adjoint" begin @testset for T in (Float32, Float64, Complex{Float32}, Complex{Float64}) A = [rand(T) for i in 1:5, b in 1:4, c in 1:3, d in 1:2] @@ -206,5 +215,4 @@ end end using Aqua -Aqua.test_all(StridedViews; - project_toml_formatting=(VERSION >= v"1.9")) +Aqua.test_all(StridedViews)