GithubHelp home page GithubHelp logo

Comments (9)

dronir avatar dronir commented on September 26, 2024

The code to generate the types and operations is mostly past the horizon of my own metaprogramming skills, so I can't jibble with it much.

from oldimmutablearrays.jl.

twadleigh avatar twadleigh commented on September 26, 2024

There will still probably need to be tweaking of exactly which binary operators are defined, and how, but that task should be a bit more accessible to all now.

from oldimmutablearrays.jl.

dronir avatar dronir commented on September 26, 2024

This gives me a kilometer of ambiguity warnings when using the package, and division still doesn't work.

julia> using ImmutableArrays
Warning: New definition 
    +(Vector2{T},T) at /Users/owilkman/.julia/ImmutableArrays/src/ImmutableArrays.jl:75
is ambiguous with 
    +(T,Vector2{T}) at /Users/owilkman/.julia/ImmutableArrays/src/ImmutableArrays.jl:71.
Make sure 
    +(Vector2{T},Vector2{T})
is defined first.

[something like 50 of these warnings]

julia> a = Vector3{Float64}(0.1, 0.2, 0.3)
3-element Float64 Vector3:
 0.1
 0.2
 0.3

julia> a / 3
ERROR: no method ./(Vector3{Float64},Int64)
 in / at abstractarray.jl:260

julia> a / 3.0
ERROR: no method ./(Vector3{Float64},Float64)
 in / at abstractarray.jl:260

from oldimmutablearrays.jl.

twadleigh avatar twadleigh commented on September 26, 2024

The warnings can be eliminated by commenting out one of the left or right applications of the scalar. This is also an issue, for instance, for the DataFrames package. There is currently no way to supress warnings.

from oldimmutablearrays.jl.

twadleigh avatar twadleigh commented on September 26, 2024

Methods that apply automatic coersions for scalars of mixed type can be added but will require a further generalization of the method definition functions to allow for specifying a second scalar type.

from oldimmutablearrays.jl.

twadleigh avatar twadleigh commented on September 26, 2024

I generalized the type of the scalar argument to Number. This had the benefit of both suppressing the warnings and causing the new test script to pass without complaint. Hopefully the JIT compilation will ensure that we don't loose any performance.

from oldimmutablearrays.jl.

dronir avatar dronir commented on September 26, 2024

Last night I was very bored, but not in a very creative mood, so I took the trouble of writing an immutable array package up to size 4 completely explicitly: https://github.com/dronir/MyLittleArray

I probably won't develop it any further, and it may have bugs, but I'll use it to compare to the generated code we have here. I'm slightly surprised that with that latest change, ImmutableArrays.jl actually even has slightly better performance than MyLittleArray.

from oldimmutablearrays.jl.

twadleigh avatar twadleigh commented on September 26, 2024

@dronir : It may be useful to have your hand-coded library (or some version of it) in the test suite to test for semantic or performance regressions. Thanks again for your contributions.

from oldimmutablearrays.jl.

dronir avatar dronir commented on September 26, 2024

This project is dear to me, because most of what I do are things where these immutable arrays are usually very good.

from oldimmutablearrays.jl.

Related Issues (20)

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.