Comments (1)
One alternative could be generating, for example, a class Parameters
that wraps the plain parameter array and has as members the names of all parameters that map to the respective array location. So what is currently written as p1 + p2
would become p.p1 + p.p2
. The main advantage would be, that we have everything inside the class namespace, so it's safe if somebody wants to use a parameter named p
. Slightly more verbose, but on the positive side, it would be obvious that those are parameters. It still wouldn't work for c++ reserved names, so no parameter named int
etc. would be supported. If we want that, then I guess there is no way around using a string-indexed map.
Seems to be possible to resolve some string-based mapping at compile time (e.g. https://github.com/serge-sans-paille/frozen/). However, that would make the code less readable, e.g. p["p1"] + p["p2"]
(or probably worse, p[_p["p1"]] + p[_p["p2"]]
, because we need to look up indices, not values, as the parameter values aren't known at compile time).
EDIT: Okay, a simple consteval function for resolving string to index mapping would work without additional run-time cost, but it would require writing something like p[_p("p1")] + p[_p("p2")]
, or with a bit of macros (and code printing adaptations) PAR("p1") + PAR("p2")
, which is actually not that bad. At least we wouldn't have to bother with any reserved names in amici/c++/... . Happy about better solutions.
from amici.
Related Issues (20)
- cmake: set sundials path hint for python package
- Remove autodoc hooks for signature/docstring processing
- sphinx fails with AttributeError: module 'sphinx.domains.cpp' has no attribute 'ASTParametersQualifiers'
- SetuptoolsDeprecationWarning: Customization incompatible with editable install HOT 1
- Remove wurlitzer dependency
- zip(... , strict=True)
- macos-latest tests failing since last night HOT 1
- InitialAssignment issue HOT 6
- Support event-assignments to compartments
- Incorrect handling of event assignments to compartments
- SBML import ignores `useValuesFromTriggerTime` attribute on events
- Execution of multiple event assignments from the same event HOT 3
- Not installing on Mac M1 HOT 4
- Compilation fails with Intel OneApi MKL 2024.1 HOT 2
- IMPORTED_LOCATION not set for imported target "Upstream::amici" HOT 1
- `Benchmark Collection` workflow fails for Lang_PLOSComputBiol2024 HOT 2
- cmake: replace explicit checks for CMAKE_BUILD_TYPE
- TimeCourse Implementation
- Piecewise function HOT 1
- PEtab import: Estimated initial conditions specified via the conditions table aren't handled correctly
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 amici.