Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Used in R? #1

Open
cwliu007 opened this issue Feb 9, 2019 · 3 comments
Open

Used in R? #1

cwliu007 opened this issue Feb 9, 2019 · 3 comments

Comments

@cwliu007
Copy link

cwliu007 commented Feb 9, 2019

Hi ofrei,

Do you know how to use it in R? R has a Rcpp package that may be helpful at this point.

@ofrei
Copy link
Owner

ofrei commented Feb 9, 2019

@genwei007 Sorry, I do not understand. Could you please clarify your question?

@cwliu007
Copy link
Author

cwliu007 commented Feb 9, 2019

@ofrei I just wonder if the C code can be compiled by Rcpp package so that we can use your functions in R language?

@ofrei
Copy link
Owner

ofrei commented Feb 9, 2019

@genwei007 Got it. I think it should be doable to integrate this package wtih Rcpp - though I haven't used Rcpp myself.
All functionality is exposed in two files:
https://github.com/ofrei/cppDERIVEST/blob/master/derivest.h
https://github.com/ofrei/cppDERIVEST/blob/master/derivest.cc
These files have no dependencies except C++11 standard.
To try it with Rcpp I would suggest try to remove "hessian" function from derivest.h and derivest.cc, and change signature of the derivest by replacing std::function<double(double)> fun with double(*fun)(double), and getting rid of <functional> and <vector> includes. Then you end up with pure C code which - I'm 100% sure - can be integrated with Rcpp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants