Replies: 2 comments
-
|
In principle, if hypothetical class constructors extern "C" C_CHANGESTAT(c_mychangestat) {
CppNetwork nw(nwp);
CppModelTerm mt(mtp);
for(auto j: nw.neighbors(head)) mt.stat[0] += nw[tail, j];
if(edgestate) mt.stat[0] *= -1;
}could implement, in this case, the change stat for the number of triangles in the network. Here, A simple macro could fold the boilerplate ( C_CPPSTAT(mychangestat, {
for(auto j: nw.neighbors(head)) mt.stat[0] += nw[tail, j];
if(edgestate) mt.stat[0] *= -1;
})These constructors would be called every time a change stat is evaluated, so they should do the absolute minimum, and, in fact, ideally, they would get optimised away by the compiler. |
Beta Was this translation helpful? Give feedback.
-
|
statnet/ergm@cpp-shim has the beginnings of an implementation. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
This has been discussed for a while and with various parties, and there is clearly some demand for it. Although a C++ ERGM engine already exists (https://github.com/fellstat/ernm/), there are reasons to try to offer the capability for writing extensions for
ergmin C++:ergmon both C and R side, and terms written within its API, which would have to be rewritten.ergm,ernmwould need to be augmented for valued networks, and it is not clear whether its API could easily support operator terms (i.e., terms with other models as arguments).This is to discuss desiderata and approaches to the problem.
Beta Was this translation helpful? Give feedback.
All reactions