GithubHelp home page GithubHelp logo

Comments (7)

ChrisRackauckas avatar ChrisRackauckas commented on June 14, 2024

Yeah getting this stable is in scope. Thanks for bringing this up. I think this may have regressed with the v3.

@AayushSabharwal

from recursivearraytools.jl.

AayushSabharwal avatar AayushSabharwal commented on June 14, 2024

VectorOfArray([zeros(4), VectorOfArray([zeros(4,4)])])

this is a bit of a tough one. Technically it isn't a valid VoA since VectorOfArray isn't an array. The eltype of this is Any, so it infers `Any.

from recursivearraytools.jl.

AayushSabharwal avatar AayushSabharwal commented on June 14, 2024

I've fixed the eltype, but sum/mapreduce isn't going to be type-stable. sum(VectorOfArray([zeros(4), VectorOfArray([zeros(4,4)])])) didn't even work in v2. I've made it work (in some cases) here, but don't think it'll ever be inferrable. As long as VectorOfArrays don't contain both arrays and VectorOfArrays, it will infer fine

from recursivearraytools.jl.

lukas-weber avatar lukas-weber commented on June 14, 2024

I see, makes sense. Thanks a lot!

from recursivearraytools.jl.

AayushSabharwal avatar AayushSabharwal commented on June 14, 2024

So there's a tradeoff. If mapreduce is defined as reduce(op, (mapreduce(f, op, x) for x in A.x)) then sum(ArrayPartition(ArrayPartition(zeros(4,4)))) is not type-stable (infers Any) but sum(ArrayPartition([1, 2], [3.0, 4.0])) is (infers Float64, and internally unrolls the loop). However, if it is defined as mapreduce(f, op, (x for x in A)) then the former is correctly inferred as Float64 but the latter infers Union{Int, Float64} and doesn't unroll loops.

from recursivearraytools.jl.

ChrisRackauckas avatar ChrisRackauckas commented on June 14, 2024

Just check if the eltype of the tuple is ArrayPartition? That won't hit every case but it should hit "most"

from recursivearraytools.jl.

ChrisRackauckas avatar ChrisRackauckas commented on June 14, 2024

This was closed but was it solved? Is https://github.com/SciML/SciMLSensitivity.jl/actions/runs/7433580549/job/20226765424?pr=965 not related?

from recursivearraytools.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.