Skip to content

Commit

Permalink
fix: add DOUBLE type
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonov548 authored and aviator-bot committed Jan 20, 2024
1 parent 3c1d544 commit 29629f5
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
57 changes: 57 additions & 0 deletions src/rinterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -10724,6 +10724,63 @@ SEXP R_igraph_dim_select(SEXP sv) {
return(r_result);
}

/*-------------------------------------------/
/ igraph_almost_equals /
/-------------------------------------------*/
SEXP R_igraph_almost_equals(SEXP a, SEXP b, SEXP eps) {
/* Declarations */
double c_a;
double c_b;
double c_eps;
igraph_bool_t c_result;
SEXP r_result;
/* Convert input */
IGRAPH_R_CHECK_REAL(a);
c_a = REAL(a)[0];
IGRAPH_R_CHECK_REAL(b);
c_b = REAL(b)[0];
IGRAPH_R_CHECK_REAL(eps);
c_eps = REAL(eps)[0];
/* Call igraph */
c_result=igraph_almost_equals(c_a, c_b, c_eps);

/* Convert output */

PROTECT(r_result=NEW_LOGICAL(1));
LOGICAL(r_result)[0]=c_result;

UNPROTECT(1);
return(r_result);
}

/*-------------------------------------------/
/ igraph_cmp_epsilon /
/-------------------------------------------*/
SEXP R_igraph_cmp_epsilon(SEXP a, SEXP b, SEXP eps) {
/* Declarations */
double c_a;
double c_b;
double c_eps;
int c_result;
SEXP r_result;
/* Convert input */
IGRAPH_R_CHECK_REAL(a);
c_a = REAL(a)[0];
IGRAPH_R_CHECK_REAL(b);
c_b = REAL(b)[0];
IGRAPH_R_CHECK_REAL(eps);
c_eps = REAL(eps)[0];
/* Call igraph */
c_result=igraph_cmp_epsilon(c_a, c_b, c_eps);

/* Convert output */

PROTECT(r_result=NEW_INTEGER(1));
INTEGER(r_result)[0]=(int) c_result;

UNPROTECT(1);
return(r_result);
}

/*-------------------------------------------/
/ igraph_solve_lsap /
Expand Down
15 changes: 15 additions & 0 deletions tools/stimulus/types-RC.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,21 @@ CSTRING:
OUT: |-
PROTECT(%I% = Rf_mkCharLenCE(%C%, strlen(%C%), CE_UTF8));
DOUBLE:
CTYPE: double
CALL:
IN: '%C%'
OUT: '&%C%'
INOUT: '&%C%'
INCONV:
IN: |-
IGRAPH_R_CHECK_REAL(%I%);
%C% = REAL(%I%)[0];
OUTCONV:
OUT: |-
PROTECT(%I%=NEW_NUMERIC(1));
REAL(%I%)[0]=%C%;
REAL:
CTYPE: igraph_real_t
CALL:
Expand Down

0 comments on commit 29629f5

Please sign in to comment.