Skip to content

Commit

Permalink
chore: Move towards autogenerating all bindings (#1043)
Browse files Browse the repository at this point in the history
  • Loading branch information
aviator-app[bot] authored Dec 29, 2023
2 parents 53155a4 + 6c1ace7 commit 0b0a0a9
Show file tree
Hide file tree
Showing 5 changed files with 524 additions and 237 deletions.
26 changes: 0 additions & 26 deletions R/aaa-auto.R
Original file line number Diff line number Diff line change
Expand Up @@ -4066,29 +4066,3 @@ version_impl <- function() {
res
}

get_stochastic_sparsemat_impl <- function(graph, column.wise=FALSE) {
# Argument checks
ensure_igraph(graph)
column.wise <- as.logical(column.wise)

on.exit( .Call(R_igraph_finalizer) )
# Function call
res <- .Call(R_igraph_get_stochastic_sparsemat, graph, column.wise)

res
}

hrg_dendrogram_impl <- function(hrg) {
# Argument checks
if (is.null(hrg)) {
hrg <- list(left=c(), right=c(), prob=c(), edges=c(), vertices=c())
}
hrg <- lapply(hrg[c("left","right","prob","edges","vertices")], as.numeric)

on.exit( .Call(R_igraph_finalizer) )
# Function call
res <- .Call(R_igraph_hrg_dendrogram, hrg)

res
}

4 changes: 0 additions & 4 deletions src/cpp11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ extern SEXP R_igraph_get_shortest_path_dijkstra(void *, void *, void *, void *,
extern SEXP R_igraph_get_shortest_paths(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *);
extern SEXP R_igraph_get_stochastic(void *, void *);
extern SEXP R_igraph_get_stochastic_sparse(void *, void *, void *);
extern SEXP R_igraph_get_stochastic_sparsemat(void *, void *);
extern SEXP R_igraph_get_subisomorphisms_vf2(void *, void *, void *, void *, void *, void *);
extern SEXP R_igraph_get_subisomorphisms_vf2_callback(void *, void *, void *, void *, void *, void *, void *);
extern SEXP R_igraph_get_widest_path(void *, void *, void *, void *, void *);
Expand All @@ -228,7 +227,6 @@ extern SEXP R_igraph_has_multiple(void *);
extern SEXP R_igraph_has_mutual(void *, void *);
extern SEXP R_igraph_hrg_consensus(void *, void *, void *, void *);
extern SEXP R_igraph_hrg_create(void *, void *);
extern SEXP R_igraph_hrg_dendrogram(void *);
extern SEXP R_igraph_hrg_fit(void *, void *, void *, void *);
extern SEXP R_igraph_hrg_game(void *);
extern SEXP R_igraph_hrg_predict(void *, void *, void *, void *, void *);
Expand Down Expand Up @@ -679,7 +677,6 @@ static const R_CallMethodDef CallEntries[] = {
{"R_igraph_get_shortest_paths", (DL_FUNC) &R_igraph_get_shortest_paths, 10},
{"R_igraph_get_stochastic", (DL_FUNC) &R_igraph_get_stochastic, 2},
{"R_igraph_get_stochastic_sparse", (DL_FUNC) &R_igraph_get_stochastic_sparse, 3},
{"R_igraph_get_stochastic_sparsemat", (DL_FUNC) &R_igraph_get_stochastic_sparsemat, 2},
{"R_igraph_get_subisomorphisms_vf2", (DL_FUNC) &R_igraph_get_subisomorphisms_vf2, 6},
{"R_igraph_get_subisomorphisms_vf2_callback", (DL_FUNC) &R_igraph_get_subisomorphisms_vf2_callback, 7},
{"R_igraph_get_widest_path", (DL_FUNC) &R_igraph_get_widest_path, 5},
Expand All @@ -705,7 +702,6 @@ static const R_CallMethodDef CallEntries[] = {
{"R_igraph_has_mutual", (DL_FUNC) &R_igraph_has_mutual, 2},
{"R_igraph_hrg_consensus", (DL_FUNC) &R_igraph_hrg_consensus, 4},
{"R_igraph_hrg_create", (DL_FUNC) &R_igraph_hrg_create, 2},
{"R_igraph_hrg_dendrogram", (DL_FUNC) &R_igraph_hrg_dendrogram, 1},
{"R_igraph_hrg_fit", (DL_FUNC) &R_igraph_hrg_fit, 4},
{"R_igraph_hrg_game", (DL_FUNC) &R_igraph_hrg_game, 1},
{"R_igraph_hrg_predict", (DL_FUNC) &R_igraph_hrg_predict, 5},
Expand Down
53 changes: 0 additions & 53 deletions src/rinterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -11811,56 +11811,3 @@ SEXP R_igraph_version() {
UNPROTECT(1);
return(r_result);
}

/*-------------------------------------------/
/ igraph_get_stochastic_sparsemat /
/-------------------------------------------*/
SEXP R_igraph_get_stochastic_sparsemat(SEXP graph, SEXP column_wise) {
/* Declarations */
igraph_t c_graph;
igraph_sparsemat_t c_sparsemat;
igraph_bool_t c_column_wise;
SEXP sparsemat;

SEXP r_result;
/* Convert input */
R_SEXP_to_igraph(graph, &c_graph);
/* Don't need to init. */
c_column_wise=LOGICAL(column_wise)[0];
/* Call igraph */
IGRAPH_R_CHECK(igraph_get_stochastic_sparsemat(&c_graph, &c_sparsemat, c_column_wise));

/* Convert output */
PROTECT(sparsemat=R_igraph_sparsemat_to_SEXP(&c_sparsemat));
igraph_sparsemat_destroy(&c_sparsemat);
r_result = sparsemat;

UNPROTECT(1);
return(r_result);
}

/*-------------------------------------------/
/ igraph_hrg_dendrogram /
/-------------------------------------------*/
SEXP R_igraph_hrg_dendrogram(SEXP hrg) {
/* Declarations */
igraph_t c_graph;
igraph_hrg_t c_hrg;
SEXP graph;

SEXP r_result;
/* Convert input */
R_SEXP_to_hrg(hrg, &c_hrg);
/* Call igraph */
IGRAPH_R_CHECK(igraph_hrg_dendrogram(&c_graph, &c_hrg));

/* Convert output */
IGRAPH_FINALLY(igraph_destroy, &c_graph);
PROTECT(graph=R_igraph_to_SEXP(&c_graph));
IGRAPH_I_DESTROY(&c_graph);
IGRAPH_FINALLY_CLEAN(1);
r_result = graph;

UNPROTECT(1);
return(r_result);
}
Loading

0 comments on commit 0b0a0a9

Please sign in to comment.