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

Constructor fails to create zero-dimensional StrideArray #28

Open
cafaxo opened this issue Dec 12, 2022 · 3 comments
Open

Constructor fails to create zero-dimensional StrideArray #28

cafaxo opened this issue Dec 12, 2022 · 3 comments

Comments

@cafaxo
Copy link

cafaxo commented Dec 12, 2022

Zero dimensional stride arrays are somewhat supported:

julia> x = StrideArray(zeros(1))
1-element StrideArray{Float64, 1, (1,), Tuple{Int64}, Tuple{Nothing}, Tuple{StaticInt{1}}, Vector{Float64}}:
 0.0

julia> view(x, 1)
0-dimensional StrideArray{Float64, 0, (), Tuple{}, Tuple{}, Tuple{}, Vector{Float64}}:
0.0

But when I try to use the constructor, it does not work:

julia> StrideArray(zeros())
ERROR: ArgumentError: Cannot call tail on an empty tuple.
@cafaxo
Copy link
Author

cafaxo commented Dec 12, 2022

I am somewhat new to open source development. I don't know if it is appropriate to open so many issues. Should I instead try to open pull requests?

@Jutho
Copy link

Jutho commented Jul 12, 2024

Tagging onto this one: also the support of strides on zero-dimensional arrays is broken.

julia> x = StrideArray(zeros(1))
1-element StrideArray{Float64, 1, (1,), Tuple{Int64}, Tuple{Nothing}, Tuple{StaticInt{1}}, Vector{Float64}}:
 0.0

julia> y = view(x, 1)
0-dimensional StrideArray{Float64, 0, (), Tuple{}, Tuple{}, Tuple{}, Vector{Float64}}:
0.0

julia> strides(y)
ERROR: MethodError: no method matching _strides_nobit(::Tuple{}, ::Tuple{})
Stacktrace:
 [1] _strides_entry(sizes::Tuple{}, strides::Tuple{}, ::Val{()}, ::Val{false})
   @ StrideArraysCore ~/.julia/packages/StrideArraysCore/Yyyvt/src/ptr_array.jl:145
 [2] static_strides
   @ ~/.julia/packages/StrideArraysCore/Yyyvt/src/ptr_array.jl:519 [inlined]
 [3] static_strides
   @ ~/.julia/packages/StrideArraysCore/Yyyvt/src/stridearray.jl:222 [inlined]
 [4] strides(A::StrideArray{Float64, 0, (), Tuple{}, Tuple{}, Tuple{}, Vector{Float64}})
   @ StrideArraysCore ~/.julia/packages/StrideArraysCore/Yyyvt/src/ptr_array.jl:610
 [5] top-level scope
   @ REPL[24]:1

@chriselrod
Copy link
Member

I am somewhat new to open source development. I don't know if it is appropriate to open so many issues. Should I instead try to open pull requests?

Pull requests are more likely to be acted on.

julia> strides(y)
ERROR: MethodError: no method matching _strides_nobit(::Tuple{}, ::Tuple{})
Stacktrace:
 [1] _strides_entry(sizes::Tuple{}, strides::Tuple{}, ::Val{()}, ::Val{false})
   @ StrideArraysCore ~/.julia/packages/StrideArraysCore/Yyyvt/src/ptr_array.jl:145
 [2] static_strides
   @ ~/.julia/packages/StrideArraysCore/Yyyvt/src/ptr_array.jl:519 [inlined]

Should probably define a method for static_strides on 0-dim PtrArrays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants