1 /* Copyright 2010-2021 by Roger S. Bivand. */
2 
3 #define USE_FC_LEN_T
4 #include <R.h>
5 #include <Rmath.h>
6 #include <Rdefines.h>
7 #include <Rinternals.h>
8 #include <R_ext/BLAS.h>
9 #ifndef FCONE
10 # define FCONE
11 #endif
12 #include <R_ext/Applic.h>
13 /* #include <R_ext/Linpack.h> */
14 #include <R_ext/Utils.h>
15 #define ROFFSET 1
16 
17 SEXP opt_error_free(SEXP ptr); // deprecated
18 SEXP hess_error_free(SEXP ptr); // deprecated
19 SEXP hess_lag_free(SEXP ptr); // deprecated
20 SEXP opt_error_init(); // deprecated
21 SEXP hess_error_init(); // deprecated
22 SEXP hess_lag_init(); // deprecated
23 SEXP R_ml_sse_env(SEXP env, SEXP coef); // deprecated
24 SEXP R_ml1_sse_env(SEXP env, SEXP lambda, SEXP beta); // deprecated
25 SEXP R_ml2_sse_env(SEXP env, SEXP rho, SEXP beta); // deprecated
26 SEXP mom_calc_int2(SEXP is, SEXP m, SEXP nb, SEXP weights, SEXP card); // deprecated
27 
28 void opt_error_set(SEXP env); // deprecated
29 void hess_error_set(SEXP env); // deprecated
30 void hess_lag_set(SEXP env); // deprecated
31 
32 SEXP card(SEXP nb);
33 SEXP listw2dsT(SEXP nbs, SEXP wts, SEXP card, SEXP ncard2); // deprecated
34 SEXP listw2dgR(SEXP nbs, SEXP wts, SEXP card, SEXP ncard); // deprecated
35 SEXP listw2sn(SEXP nbs, SEXP wts, SEXP card, SEXP ncard);
36 SEXP dnearneigh(SEXP din1, SEXP din2, SEXP pnte, SEXP p, SEXP test, SEXP lonlat);
37 SEXP dnearneigh1(SEXP din1, SEXP din2, SEXP pnte, SEXP test, SEXP cands);
38 
39 SEXP gearyw(SEXP nb, SEXP weights, SEXP x, SEXP card, SEXP zeropolicy, SEXP ftype);
40 SEXP gsymtest(SEXP nb, SEXP glist, SEXP card);
41 SEXP spInsiders(SEXP bbbi, SEXP bbbj);
42 SEXP jcintern(SEXP nb, SEXP weights, SEXP dum, SEXP card);
43 SEXP lagw(SEXP nb, SEXP weights, SEXP x, SEXP card, SEXP zeropolicy, SEXP naok);
44 SEXP nbdists(SEXP nb, SEXP x, SEXP np, SEXP dim, SEXP lonlat);
45 SEXP polypoly(SEXP p1, SEXP n01, SEXP p2, SEXP n02, SEXP snap);
46 SEXP spOverlap(SEXP bbbi, SEXP bbbj);
47 /*SEXP poly_loop(SEXP n, SEXP i_findInBox, SEXP bb, SEXP pl, SEXP nrs, SEXP dsnap, SEXP criterion, SEXP scale);*/
48 SEXP poly_loop2(SEXP n, SEXP i_findInBox, SEXP bb, SEXP pl, SEXP nrs, SEXP dsnap, SEXP criterion, SEXP scale);
49 SEXP symtest(SEXP nb, SEXP card, SEXP verbose);
50 SEXP g_components(SEXP nblst, SEXP cmpnm);
51 SEXP lmin21(SEXP nb, SEXP y, SEXP cy, SEXP card);
52 SEXP lmin22(SEXP nb, SEXP y, SEXP cy, SEXP card, SEXP beta); // deprecated
53 SEXP lmin23(SEXP nb, SEXP y, SEXP cy, SEXP card, SEXP beta, SEXP tol); // deprecated
54 SEXP lmin3(SEXP nb, SEXP ev1, SEXP ev1_lag, SEXP n_nei, SEXP beta, SEXP tol); // deprecated
55 SEXP lmin3S(SEXP nb, SEXP ev1, SEXP ev1_lag, SEXP n_nei, SEXP card, SEXP beta, SEXP tol); // deprecated
56 
57 void dfs(SEXP nblst, SEXP cmpnm, SEXP visited, int curcmp, int nodeid);
58 void compute_gabriel(int *no_nodes, int *g1, int *g2, int *nogab, int *ngaballoc,  double *nodes_xd, double *nodes_yd);
59 void compute_relative(int *no_nodes, int *g1, int *g2, int *nogab, int *ngaballoc, double *nodes_xd, double *nodes_yd);
60 void prunemst(int *e1, int *e2, int *ne, int *gr);
61 
62 void gcdist(double *lon1, double *lon2, double *lat1, double *lat2, double *dist);
63 void knearneigh(int *kin, int *pnte, int *p, double *test, int *res, double *dists, int *lonlat);
64 
65 
66 
67 
68 
69 
70 
71