Comments (5)
I'm happy to leave this issue open for a while. I'll attend to some others first, and then slowly come around to this. Thanks for the impetus!
from geodist.
All grand by me, but with one caveat: The number of exposed functions is actually pretty huge: geodist_init.c
lists them all:
extern SEXP R_cheap(SEXP);
extern SEXP R_cheap_paired(SEXP, SEXP);
extern SEXP R_cheap_paired_vec(SEXP, SEXP, SEXP, SEXP);
extern SEXP R_cheap_range(SEXP);
extern SEXP R_cheap_seq(SEXP);
extern SEXP R_cheap_seq_range(SEXP);
extern SEXP R_cheap_seq_vec(SEXP, SEXP);
extern SEXP R_cheap_vec(SEXP, SEXP);
extern SEXP R_cheap_xy(SEXP, SEXP);
extern SEXP R_cheap_xy_range(SEXP, SEXP);
extern SEXP R_cheap_xy_vec(SEXP, SEXP, SEXP, SEXP);
extern SEXP R_geodesic(SEXP);
extern SEXP R_geodesic_paired(SEXP, SEXP);
extern SEXP R_geodesic_paired_vec(SEXP, SEXP, SEXP, SEXP);
extern SEXP R_geodesic_range(SEXP);
extern SEXP R_geodesic_seq(SEXP);
extern SEXP R_geodesic_seq_range(SEXP);
extern SEXP R_geodesic_seq_vec(SEXP, SEXP);
extern SEXP R_geodesic_vec(SEXP, SEXP);
extern SEXP R_geodesic_xy(SEXP, SEXP);
extern SEXP R_geodesic_xy_range(SEXP, SEXP);
extern SEXP R_geodesic_xy_vec(SEXP, SEXP, SEXP, SEXP);
extern SEXP R_haversine(SEXP);
extern SEXP R_haversine_paired(SEXP, SEXP);
extern SEXP R_haversine_paired_vec(SEXP, SEXP, SEXP, SEXP);
extern SEXP R_haversine_range(SEXP);
extern SEXP R_haversine_seq(SEXP);
extern SEXP R_haversine_seq_range(SEXP);
extern SEXP R_haversine_seq_vec(SEXP, SEXP);
extern SEXP R_haversine_vec(SEXP, SEXP);
extern SEXP R_haversine_xy(SEXP, SEXP);
extern SEXP R_haversine_xy_range(SEXP, SEXP);
extern SEXP R_haversine_xy_vec(SEXP, SEXP, SEXP, SEXP);
extern SEXP R_vincenty(SEXP);
extern SEXP R_vincenty_paired(SEXP, SEXP);
extern SEXP R_vincenty_paired_vec(SEXP, SEXP, SEXP, SEXP);
extern SEXP R_vincenty_range(SEXP);
extern SEXP R_vincenty_seq(SEXP);
extern SEXP R_vincenty_seq_range(SEXP);
extern SEXP R_vincenty_seq_vec(SEXP, SEXP);
extern SEXP R_vincenty_vec(SEXP, SEXP);
extern SEXP R_vincenty_xy(SEXP, SEXP);
extern SEXP R_vincenty_xy_range(SEXP, SEXP);
extern SEXP R_vincenty_xy_vec(SEXP, SEXP, SEXP, SEXP);
Each one is a particular combination of input params. Exposing those would induce some safety compromises, as the code currently relies very strongly on the R-side per-processing to ensure the appropriate C routine is called. That means the code does no checking of arguments at all in any C routine. Direct passing of arbitrary inputs would almost certainly raise problems, and at the least, I'd first have to implement a bunch of C-level code to ensure sane inputs, and doing that would likely slow calculations down somewhat, so there would also be potential disadvantages there. Note also that some SEXP
s are assumed to be vectors, while others are assumed to be stored as matrices. R knows no difference between these, but the geodist
code sometimes assumes indexing into vectors-as-2-column-matrices, and other times not. All of that would have to be controlled, and there may well be cases where such checking at the C-level might just not be possible.
I don't mean to be obstructive here, and i definitely do think this is a good idea, but would be interested to first have your insights into some of these concerns?
from geodist.
(All interesting stuff for me, just went through my first example and learnt heaps thanks both)
from geodist.
An alternative would be for me to write a C-level meta-wrapper around all of those internal functions. The latter could then be left so, and the exposed bit used to funnel the right combinations of SEXP
elements to the right internal calls, just as the current R code does. That should be fairly straightforward.
from geodist.
You bring up some valid concerns for sure. And I think your suggested C-level API would be an easier solution. But, having brought up this issue, I have no real need for it yet, so don't feel like you're required to do this :)
from geodist.
Related Issues (20)
- Min/Max Feature HOT 6
- Test georange sequential
- Sequential geodist produces different results to paired HOT 4
- DOC: "geodesic" is listed as "geodetic" in places HOT 1
- deploy pkgdown from travis
- Speed up R API by allowing direct submission of numeric vector objects HOT 13
- geodist gives different results for single row matrix with cheap ruler HOT 3
- Thanks HOT 3
- Issue warning when cheapdist becomes inaccurate
- Update CRAN version with geodist_paired_vec HOT 6
- mention metres units in doc pages HOT 1
- meters instead of metres HOT 2
- Cheap is being expensive HOT 2
- geodist_max/min functions HOT 3
- error processing tibbles
- Updated version of package fails when y coordinate is called ymax HOT 4
- Request option not to warn when using cheap (or even test distances) HOT 2
- pkgcheck results - main HOT 9
- Fix package man entry
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geodist.