lindahua / Devectorize.jl

A Julia framework for delayed expression evaluation
MIT License
115 stars 17 forks source link

support fallbacks for non-array types #30

Open stevengj opened 10 years ago

stevengj commented 10 years ago

It would be nice to be able to use the Devectorize package in cases where you want it to be fast for AbstractArray types, but in which you still want the code to work on more abstract types. i.e. you would like to be able to write, e.g.

@devec! a = b + γ*c

and have it be fast and in-place on a for arrays, but still work for arbitrary types supporting the requisite + and * operations. Note also that it would be nice to have @devec! a = ... rather than @devec a[:] = ..., to make it clearer that it works even when a is some more abstract type that doesn't necessarily support [:].

See e.g. JuliaLang/ODE.jl/#33 and JuliaLang/julia#7052

Could this be implementd by sprinkling a few method_exists checks here and there?

stevengj commented 10 years ago

This may in some sense be a generalization of #28.