Skip to content

Commit

Permalink
better show
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed Feb 23, 2022
1 parent 80d92bb commit 2f4556c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "StrideArraysCore"
uuid = "7792a7ef-975c-4747-a70f-980b88e8d1da"
authors = ["Chris Elrod <[email protected]> and contributors"]
version = "0.2.11"
version = "0.2.12"

[deps]
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
Expand Down
4 changes: 2 additions & 2 deletions src/adjoints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function permute_dims_expr(perm, D, C, B, R)
end
Dnew, Cnew, Bnew, Rnew, s, x, o
end
@generated function Base.permutedims(A::PtrArray{S,D,T,N,C,B,R}, ::Val{P}) where {S,D,T,N,C,B,R,P}
@generated function Base.permutedims(A::AbstractPtrStrideArray{S,D,T,N,C,B,R}, ::Val{P}) where {S,D,T,N,C,B,R,P}
Dnew, Cnew, Bnew, Rnew, s, x, o = permute_dims_expr(P, D, C, B, R)
quote
$(Expr(:meta,:inline))
Expand All @@ -43,7 +43,7 @@ end
@inline Base.transpose(A::AbstractStrideMatrix) = permutedims(A, Val{(2,1)}())


@generated function Base.adjoint(a::PtrArray{S,D,T,1,C,B,R,X,O}) where {S,D,T,C,B,R,X,O}
@generated function Base.adjoint(a::AbstractPtrStrideArray{S,D,T,1,C,B,R,X,O}) where {S,D,T,C,B,R,X,O}
s = Expr(:tuple, :(One()), Expr(:ref, :s, 1))
x₁ = Expr(:ref, :x, 1)
x = Expr(:tuple, x₁, x₁)
Expand Down
1 change: 1 addition & 0 deletions src/ptr_array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ end
end
# Base.@propagate_inbounds function Base.getindex(A::AbstractStrideArray, i::Vararg{Any,K}) where {K}
# end
Base.@propagate_inbounds Base.getindex(A::AbstractStrideVector, i::Integer, ::Integer) = getindex(A, i)
Base.@propagate_inbounds function Base.getindex(A::AbstractStrideArray, i::Vararg{Integer,K}) where {K}
b = preserve_buffer(A)
GC.@preserve b begin
Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
ThreadingUtilities = "8290d209-cae3-49c0-8002-c8c24d57dab5"
18 changes: 16 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using StrideArraysCore, ThreadingUtilities, Aqua
# using InteractiveUtils
using Test

function closeopensum(x)
Expand All @@ -22,6 +23,7 @@ function cartesianindexsum(A)
end
s
end
allocated_cartesianindexsum(x) = @allocated cartesianindexsum(x)

@testset "StrideArraysCore.jl" begin

Expand All @@ -43,7 +45,11 @@ end
@test eltype(D) === Float32
end
GC.@preserve A begin
@test closeopensum(C) == closeopensum(A)
#TODO: eliminate need to use `@inbounds` for simd
# @test closeopensum(C) == closeopensum(A)
# @code_llvm closeopensum(C)

# @code_llvm closeopensum(A)
@test closeopensumfastmath(C) == closeopensumfastmath(A)
@test sum(C) == sum(A)
@test closeopensum(C) closeopensumfastmath(C) sum(C)
Expand Down Expand Up @@ -102,7 +108,7 @@ end
@test_throws BoundsError X[-4]
@test_throws BoundsError X[2,5,3]
@test cartesianindexsum(W) cartesianindexsum(X)
@test iszero(@allocated cartesianindexsum(X))
@test iszero(allocated_cartesianindexsum(X))
end
@test X === PtrArray(pointer(X), size(X))
y = rand(77);
Expand Down Expand Up @@ -209,6 +215,14 @@ end
end
end
end
@testset "BitPtrArray" begin
b = collect(1:10) .> 5;
@test sprint((io,t) -> show(io,t), StrideArray(b)) == """
SIMDTypes.Bit[false, false, false, false, false, true, true, true, true, true]"""
@test sprint((io,t) -> show(io,t), StrideArray(b)') == """
SIMDTypes.Bit[false false false false false true true true true true]"""
end

# @testset "reinterpret" begin

# end
Expand Down

2 comments on commit 2f4556c

@chriselrod
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/55262

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.12 -m "<description of version>" 2f4556c4f45ab7f298a0f2149274da36bfc33353
git push origin v0.2.12

Please sign in to comment.