Giter Club home page Giter Club logo

circulararrays.jl's People

Contributors

eliascarv avatar juliatagbot avatar masonprotter avatar putianyi889 avatar terasakisatoshi avatar timholy avatar vexatos avatar yha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

circulararrays.jl's Issues

Missing push! implementation

julia> using CircularArrays

julia> c = CircularVector([1,2,3])
3-element CircularVector(::Vector{Int64}):
 1
 2
 3

julia> push!(c, 4)
ERROR: MethodError: no method matching resize!(::CircularVector{Int64, Vector{Int64}}, ::Int64)

Closest candidates are:
  resize!(::Vector, ::Integer)
   @ Base array.jl:1246
  resize!(::BitVector, ::Integer)
   @ Base bitarray.jl:814
  resize!(::SparseArrays.ReadOnly, ::Any)
   @ SparseArrays ~/.julia/juliaup/julia-1.9.3+0.x64.linux.gnu/share/julia/stdlib/v1.9/SparseArrays/src/readonly.jl:33
  ...

Stacktrace:
 [1] _append!(a::CircularVector{Int64, Vector{Int64}}, #unused#::Base.HasLength, iter::Tuple{Int64})
   @ Base ./array.jl:1134
 [2] append!(a::CircularVector{Int64, Vector{Int64}}, iter::Tuple{Int64})
   @ Base ./array.jl:1126
 [3] push!(a::CircularVector{Int64, Vector{Int64}}, iter::Int64)
   @ Base ./array.jl:1127
 [4] top-level scope
   @ REPL[6]:1

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

map problem

I get an error when I try to use map on a circular array. It seems like this should work but perhaps I am missing something.

e.g. map(x -> x+1, CircularArray([1,2,3,4])) throws an error...

ERROR: MethodError: similar(::CircularVector{Int64, Vector{Int64}}, ::Type{Int64}, ::Tuple{Base.OneTo{Int64}}) is ambiguous. Candidates: ..............

reduce seems to work which slightly surprised me given the above
reduce(+, CircularArray([1,2,3,4]))
10

Arrays that are circular in certain dimensions

What I would appreciate is a way to construct a matrix that is circular in the first dimension while restricted in the other dimension (i.e. should be able to throw BoundsError)

There are two ways to achieve this:

  • To add a size property that hard caps the bounds. This would introduce a dependency related to infinite indexing (e.g. InfiniteArrays). This is more straightforward on the surface but are prone to infinite loops at broadcast-like operations.
  • To add a dim property that specifies the circular dimensions. checkbounds needs to be overloaded.

Semantic versioning

This package is a dependency in Meshes.jl and we recently started having issues with a non-working resize! function. I think this is probably related to semantic versioning misunderstanding...

When you updated from 1.1 to 1.2 to 1.3 you adopted the following rule? https://semver.org/spec/v2.0.0.html#spec-item-7

Our tests are failing now downstream. Could you please double check and help fix the issues?

Also, I reiterate the importance of placing this package in an organization where multiple members can help maintain and double check these things before submitting disruptive new releases.

Fix Vararg warning

┌ CircularArrays [7a955b69-7140-5f4e-a0ed-f168c5e2e749]
│  WARNING: Wrapping `Vararg` directly in UnionAll is deprecated (wrap the tuple instead).

Consider moving the package to JuliaArrays for greater visibility

I am using this package in Meshes.jl to handle polygonal geometries that create loops. I wonder if you would be willing to migrate the package to the JuliaArrays organization for greater visibility and maintenance reasons? It is nice to have multiple people working on a fundamental package like this to make sure it is up-to-date and following all the latest tricks.

No constructor for fully specified type

These all produce the same type: CircularArray{Float64, 2, Matrix{Float64}}

  • CircularArray( zeros(2, 2) )
  • CircularArray{Float64}( zeros(2, 2) )
  • CircularArray{Float64, 2}( zeros(2, 2) )

However, CircularArray{Float64, 2, Matrix{Float64}}( zeros(2, 2) ) fails with MethodError: no method matching CircularArray{Float64, 2, Matrix{Float64}}(::Matrix{Float64})

This is a problem when creating a function that takes an AbstractArray, produces a new Vector that gets reshaped to the same size as the AbstractArray, then tries to return the same type as the original AbstractArray using convert, or by trying to call the constructor using typeofor by the function being parametric.

I think the missing constructor can be addressed by adding a constructor that is parametric on all three types? I don't know if it makes sense to have convert work in this context.

Type consistency

Operations on CircularArrays give usual Arrays instead:

julia> CircularArray(rand(3,3)) .+ 1
3×3 Matrix{Float64}:
 1.59308  1.58855  1.67183
 1.86402  1.33325  1.31673
 1.15693  1.32027  1.24405

Wrong fallback for Base.empty

julia> using CircularArrays

julia> v = CircularVector([1,2,3])
3-element CircularVector(::Vector{Int64}):
 1
 2
 3

julia> empty(v)
Int64[]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.