Description Usage Arguments Details Value Author(s) See Also Examples
Given as input the reaction rates, stochastic constants and model constants, the function outputs the C code of the underlying ODEs. The system of odes express the macroscopic approximation (ODE) as well as the estimates for the instantaneous mean and covariance of the linear SDE from the LNA approximation.
1 |
y |
The stoichiometry matrix, note that the dimensions are assumed to be: (# Species)*(# Reactions). |
rfun |
A character vector with each elements expressing the reaction rates. |
thetas |
A character vector which denotes the stochastic constant names associated with each reaction. |
species |
A character vector which denotes the species names. |
constants |
Not supported yet. |
The derivation of the ODEs is accomplished with the help of Deriv package and some symbolic algebra routines written in R. The derived ODEs are joined together, i.e. treated as a single system, and are expressed as C code. In particular, they are expressed as a C function of the following form:
1 |
Returns a list with the following elements:
ccode |
The actual C code as text. |
cspecies |
A character vector of the species names in the C code and
their corresponding model names are given in the |
cthetas |
A character vector of the names of the stochastic constants
in the C code and their corresponding model names are given
in the |
Cov |
A character vector of the functions names that corresponds the upper triangular matrix (given as the names attribute) of the instantaneous variance-covariance matrix. |
Means |
A character vector of the functions names that corresponds to the instantaneous means (given as the names attribute). |
Orders |
A numerical vector indicating the order of each reaction. |
Vasileios Giagos
After parsing you need to compile the model with
compmod
.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ##Parses the Lotka-Volterra Model.
#Stoichiometry matrix
tt <- matrix(c(1,-1,0,0,1,-1),nrow=2,ncol=3,byrow=TRUE)
#The reaction rates
rfun <- c("con1 * Prey","con2 * Prey * Predator","con3 * Predator")
#Parameters
thetas <- paste("con",1:3,sep="")
#Species
species <- c("Prey","Predator")
## Not run:
cout <- parsemod(tt,rfun,thetas,species)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.