Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dealing with terms and formulaes #10

Open
gvegayon opened this issue Jul 22, 2019 · 0 comments
Open

Dealing with terms and formulaes #10

gvegayon opened this issue Jul 22, 2019 · 0 comments

Comments

@gvegayon
Copy link
Member

Dealing with terms should be more general. In the current design, terms in C++ receive a vector. This should change to a list, and more over, using C++ classes:

typedef std::vector< int > v_int;

class term_args;

class ergmito_term {
public:
  ...
  // Calculation
  std::function<void(v_int&, term_args*) fun;
  // Checker
  std::function<void(v_int&, term_args*) check_args;
}

This way terms can be generated with a set of arbitrary arguments. Moreover, this could be ported to a C++ header-only library for computing sufficient statistics on networks (represented as list of source/target).

On the R side, functions with the same name of the term should be defined such that those can be called within R and set up all the requirements.

Formulas need to be more regeneral. Here is a proposed set of steps:

  1. Extract the RHS of the formula
  2. Match terms by using something like "(edge|ctriad|triad|...)(\(.*\))?"
  3. If only the first part matched, then add () and make a call, otherwise make the call.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant