Comments (2)
First we need to get your code updated to get rid of all those macros! Can you push your latest code? then I can convert it and put in a PR. It will be so much easier to discuss after that.
For having multiple sub-populations in the grid, for intrinsicrate use a Tuple
. (but you might not even need to lock it like this)
struct DiscreteGrowthRate{R,W,GR<:Tuple,I}
intrinsicrate::GR
numberSupPop::I
end
With a Tuple
you can just map
over the populations and growth rates, and it will handle any number of sub populations making this generic to all similar problems:
@inline function applyrule(data, rule::DiscreteGrowthRate, pops, index)
map(pops, rule.intrinsicrate) do pop, ir
ir * pop * (1 - sum(pops) / rule.carrycap)
end
end
(map
with a Vector
is allocating and much slower, and can't be optimised the same way a Tuple
can be. We also need to return a Tuple
to be written back to the N separate grids, which just works using a Tuple
for intrinsicrate
)
Edit: you could get rid of the <:Tuple
limitation, then a single instrinsicrate would also work
from dispersal.jl.
Great.
I just send a PR #64
from dispersal.jl.
Related Issues (20)
- Precompile failed HOT 14
- Consider "OrganismDispersal" as a name? HOT 1
- Rename HumanDispersal to GravityDispersal HOT 4
- Provide citations and latex formulas where applicable
- A rule depending on 2 layers and chaining rules using arguments HOT 17
- DateTime of layers seems buggy HOT 1
- Drop `Exact` from growth model names HOT 1
- Check human dispersal weights array and grwothmaps aux size in `precalc`
- Move optimisation tools to another package.
- Document and clarify kernel generation models HOT 1
- Clarify genetic methods to add to Dispersal.jl HOT 4
- Move downsapling code or use GeoData / DimensionalData
- Create a new type for Population HOT 1
- precalc_auxtimeindex of GeoArray HOT 2
- TagBot trigger issue HOT 11
- Fix broken docs
- Dispersal weight
- All rules need example construcors in the docs
- Still "maintained"? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dispersal.jl.