Skip to content

Commit

Permalink
B-spline derivatives into the C API
Browse files Browse the repository at this point in the history
  • Loading branch information
kingaa committed Dec 1, 2023
1 parent 658bb34 commit e236b7d
Show file tree
Hide file tree
Showing 10 changed files with 492 additions and 180 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: pomp
Type: Package
Title: Statistical Inference for Partially Observed Markov Processes
Version: 5.4.3.1
Version: 5.4.3.2
Date: 2023-11-30
Authors@R: c(person(given=c("Aaron","A."),family="King",role=c("aut","cre"),email="[email protected]",comment=c(ORCID="0000-0001-6159-3207")),
person(given=c("Edward","L."),family="Ionides",role="aut",comment=c(ORCID="0000-0002-4190-0174")) ,
Expand Down
30 changes: 23 additions & 7 deletions R/templates.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,37 @@ pomp_templates <- list(
#include <R_ext/Rdynload.h>}"
),
utilities=list(
bspline_basis=list(
trigger=r"{(?<!periodic_)bspline_basis_eval(?!_deriv)}",
header=r"{
static bspline_basis_eval_t *__pomp_bspline_basis_eval;
#define bspline_basis_eval(X,K,P,N,Y) (__pomp_bspline_basis_eval((X),(K),(P),(N),(Y)))}",
reg=r"{
__pomp_bspline_basis_eval = (bspline_basis_eval_t *) R_GetCCallable("pomp","bspline_basis_eval");}"
),
bspline_basis_deriv=list(
trigger=r"{(?<!periodic_)bspline_basis_eval_deriv}",
header=r"{
static bspline_basis_eval_deriv_t *__pomp_bspline_basis_eval_deriv;
#define bspline_basis_eval_deriv(X,K,P,N,D,Y) (__pomp_bspline_basis_eval_deriv((X),(K),(P),(N),(D),(Y)))}",
reg=r"{
__pomp_bspline_basis_eval_deriv = (bspline_basis_eval_deriv_t *) R_GetCCallable("pomp","bspline_basis_eval_deriv");}"
),
periodic_bspline_basis=list(
trigger="periodic_bspline_basis_eval",
trigger="periodic_bspline_basis_eval(?!_deriv)",
header=r"{
static periodic_bspline_basis_eval_t *__pomp_periodic_bspline_basis_eval;
#define periodic_bspline_basis_eval(X,Y,M,N,Z) (__pomp_periodic_bspline_basis_eval((X),(Y),(M),(N),(Z)))}",
#define periodic_bspline_basis_eval(X,T,P,N,Y) (__pomp_periodic_bspline_basis_eval((X),(T),(P),(N),(Y)))}",
reg=r"{
__pomp_periodic_bspline_basis_eval = (periodic_bspline_basis_eval_t *) R_GetCCallable("pomp","periodic_bspline_basis_eval");}"
),
bspline_basis=list(
trigger=r"{(?<!periodic_)bspline_basis_eval}",
periodic_bspline_basis_deriv=list(
trigger="periodic_bspline_basis_eval_deriv",
header=r"{
static bspline_basis_eval_t *__pomp_bspline_basis_eval;
#define bspline_basis_eval(X,K,D,N,Y) (__pomp_bspline_basis_eval((X),(K),(D),(N),(Y)))}",
static periodic_bspline_basis_eval_deriv_t *__pomp_periodic_bspline_basis_eval_deriv;
#define periodic_bspline_basis_eval_deriv(X,T,P,N,D,Y) (__pomp_periodic_bspline_basis_eval_deriv((X),(T),(P),(N),(D),(Y)))}",
reg=r"{
__pomp_bspline_basis_eval = (bspline_basis_eval_t *) R_GetCCallable("pomp","bspline_basis_eval");}"
__pomp_periodic_bspline_basis_eval_deriv = (periodic_bspline_basis_eval_deriv_t *) R_GetCCallable("pomp","periodic_bspline_basis_eval_deriv");}"
),
get_userdata_int=list(
trigger="get_userdata_int",
Expand Down
15 changes: 8 additions & 7 deletions inst/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ _N_e_w_s _f_o_r _p_a_c_k_a_g_e '_p_o_m_p'

_C_h_a_n_g_e_s _i_n '_p_o_m_p' _v_e_r_s_i_o_n _5._4._3:

• There is now access to ordinary B-spline basis functions at
the C snippet level. It will still almost always be
preferable to construct a spline basis once and pass it to
‘pomp’ functions as part of a ‘covariate_table’, but this
functionality may occasionally be useful.
• There is now access to ordinary B-spline basis functions (and
their derivatives) at the C snippet level. It will still
almost always be preferable to construct a spline basis once
and pass it to ‘pomp’ functions as part of a
‘covariate_table’, but this functionality may occasionally be
useful.

• ‘bspline_eval’ is now deprecated as part of the ‘pomp’ C API.

Expand All @@ -15,8 +16,8 @@ _C_h_a_n_g_e_s _i_n '_p_o_m_p' _v_e_r_s_i_o_n _5._4._3:

_C_h_a_n_g_e_s _i_n '_p_o_m_p' _v_e_r_s_i_o_n _5._4._2:

State objective functions (class ‘objfun’) now behave as if
they are ‘pomp’ objects.
Stateful objective functions (class ‘objfun’) now behave as
if they are ‘pomp’ objects.

_C_h_a_n_g_e_s _i_n '_p_o_m_p' _v_e_r_s_i_o_n _5._4._1:

Expand Down
4 changes: 2 additions & 2 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
\title{News for package `pomp'}
\section{Changes in \pkg{pomp} version 5.4.3}{
\itemize{
\item There is now access to ordinary B-spline basis functions at the C snippet level.
\item There is now access to ordinary B-spline basis functions (and their derivatives) at the C snippet level.
It will still almost always be preferable to construct a spline basis once and pass it to \pkg{pomp} functions as part of a \code{covariate_table}, but this functionality may occasionally be useful.
\item \code{bspline_eval} is now deprecated as part of the \pkg{pomp} C API.
\item The formatting of some printed messages has been modified to forestall warnings in the latest R-devel.
}
}
\section{Changes in \pkg{pomp} version 5.4.2}{
\itemize{
\item State objective functions (class \sQuote{objfun}) now behave as if they are \sQuote{pomp} objects.
\item Stateful objective functions (class \sQuote{objfun}) now behave as if they are \sQuote{pomp} objects.
}
}
\section{Changes in \pkg{pomp} version 5.4.1}{
Expand Down
Loading

0 comments on commit e236b7d

Please sign in to comment.