Skip to content

Dealing with terms and formulaes #10

@gvegayon

Description

@gvegayon

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions