longemen3000 / cachedfunctions.jl Goto Github PK
View Code? Open in Web Editor NEWcache all the things!
License: MIT License
cache all the things!
License: MIT License
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.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
using CachedFunctions
function f!(y,x)
y[1] = exp(sum(x))
y[2] = x[1]+x[2] - x[3]
y
end
x1 = rand(3)
x2 = rand(3)
x3 = rand(Float32,3)
x4 = rand(Float32,3)
f = CachedFunction(f!,3,2)
Returns
ERROR: MethodError: no method matching prototype(::Int64)
I'm using Version 1.5.4 (2021-03-11)
Thanks a lot for the package, I think this will really help me reduce allocation-based slowdown in my application.
One incompatibility I have is that my functions are for dynamical systems and are of the form f!(y,x,t)
, i.e. I pass in the time t::Number
in addition to the state vector x::Vector
, and y=similar(x)
.
This seems like the sort of thing Julia should be able to generalize to cover really easily, but I can't see how to force this into the mold of a single input state vector without allocating push!(x,t)
which defeats the purpose of caching.
as mencioned by tkf in discourse, there is a need to make this structure Thread-safe. there are some approaches to this:
key(eltype(x),Val(threadId))
. What i don't know is if the get call to the thread function is safe itself.To test this, a good example is also necessary
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.