{"id":18399595,"url":"https://github.com/mrc-ide/cinterpolate","last_synced_at":"2025-04-07T05:34:28.907Z","repository":{"id":56936977,"uuid":"105753847","full_name":"mrc-ide/cinterpolate","owner":"mrc-ide","description":":bar_chart::arrow_right::wavy_dash: Interpolating functions from C, in R","archived":false,"fork":false,"pushed_at":"2024-09-17T16:37:08.000Z","size":533,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T14:06:05.446Z","etag":null,"topics":["infrastructure"],"latest_commit_sha":null,"homepage":"https://mrc-ide.github.io/cinterpolate","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrc-ide.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-04T09:58:00.000Z","updated_at":"2025-03-22T08:14:05.000Z","dependencies_parsed_at":"2024-09-17T20:17:10.943Z","dependency_job_id":"c8263cfb-3bc4-4b1f-826e-5b2bd70fbf98","html_url":"https://github.com/mrc-ide/cinterpolate","commit_stats":{"total_commits":39,"total_committers":2,"mean_commits":19.5,"dds":"0.17948717948717952","last_synced_commit":"c48d493512eb7460f3dfec062c8b74de5917a7ff"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrc-ide%2Fcinterpolate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrc-ide%2Fcinterpolate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrc-ide%2Fcinterpolate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrc-ide%2Fcinterpolate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrc-ide","download_url":"https://codeload.github.com/mrc-ide/cinterpolate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601398,"owners_count":20964861,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["infrastructure"],"created_at":"2024-11-06T02:27:50.958Z","updated_at":"2025-04-07T05:34:23.885Z","avatar_url":"https://github.com/mrc-ide.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cinterpolate\n\n\u003c!-- badges: start --\u003e\n[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/)\n[![R-CMD-check](https://github.com/mrc-ide/cinterpolate/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/mrc-ide/cinterpolate/actions/workflows/R-CMD-check.yaml)\n[![codecov.io](https://codecov.io/github/mrc-ide/cinterpolate/coverage.svg?branch=master)](https://app.codecov.io/github/mrc-ide/cinterpolate?branch=master)\n[![](http://www.r-pkg.org/badges/version/cinterpolate)](https://cran.r-project.org/package=cinterpolate)\n\u003c!-- badges: end --\u003e\n\nSimple interpolation functions designed to be used from C.  There is essentially no R support in this package, save code designed to be used by the package's own testing.  `cinterpolate` is designed to be used in package code only and modification for use outside of a package is not explicitly supported.\n\n## Installation\n\n`cinterpolate` is now on CRAN and can be installed with\n\n```r\ninstall.packages(\"cinterpolate\")\n```\n\n### Development version\n\n\nAfter that, install with\n\n```r\ninstall.packages(\n  \"orderly2\",\n  repos = c(\"https://mrc-ide.r-universe.dev\", \"https://cloud.r-project.org\"))\n```\n\nIf you install from source, this package requires a fortran compiler because it uses LAPACK and BLAS, despite being only C code.\n\n* **macOS** Install Xcode, confirm the command line tools are installed and then install gfortran following [these instructions](https://cran.r-project.org/bin/macosx/tools/)\n* **windows** [Rtools](https://cran.r-project.org/bin/windows/Rtools/) includes gfortran\n* **linux** Something like `apt-get install gfortran` depending on your platform\n\n## Usage\n\n``` c\n#include \u003ccinterpolate/cinterpolate.h\u003e\n```\n\nAllocate an object to perform interpolation with.  `nx` and `x` are the size and values of the function to be interpolated, while `ny` is the number of functions to be simultaneously (but independently) interpolateed and `y` is the values for these.  If `ny \u003e 1`, then the values of `y` are as an R matrix with `nx` rows and `ny` columns (the first `nx` values are the first function, the second `nx` are the second, and so on).  The final two are booleans: `fail_on_extrapolate` throws an error if extrapolation is requested, and `auto_free` uses `R_alloc()` rather than `Calloc` allowing automatic cleanup.\n\n``` c\nvoid *obj = cinterpolate_alloc(type, nx, ny, x, y,\n                               fail_on_extrapolate, auto_free);\n```\n\nWith the interpolation function, an input value of `xout` and given some storage `yout` of length `ny`, determine `f(xout)` with\n\n``` c\ncinterpolate_eval(xout, obj, yout);\n```\n\nOnce done the object must be freed with\n\n\n```\ncinterpolate_free(obj);\n```\n\n### Further package setup\n\nSomewhere in the package you must include `cinterpolate.c` as\n\n``` c\n#include \u003ccinterpolate/cinterpolate.h\u003e\n```\n\nbut this must be included **only once** or linking will fail.  If you only use the interpolation in one place, you can use `cinterpolate.c` rather than `cinterpolate.h`.  If you use interpolation in more than once place, I recommend a file `src/cinterpolate.c` containing\n\n``` c\n#include \u003ccinterpolate/cinterpolate.c\u003e\n```\n\nBe sure to include in your `DESCRIPTION` a line\n\n```\nLinkingTo: cinterpolate\n```\n\n`cinterpolate` takes advantage of BLAS for matrix multiplication, so you may need a Makevars that includes\n\n```make\nPKG_LIBS = ${LAPACK_LIBS} ${BLAS_LIBS} ${FLIBS}\n```\n\n### Example\n\nSee [`inst/example`](inst/example) for a full example of using `cinterpolate` within a package\n\n## License\n\nMIT + file LICENSE © Imperial College of Science, Technology and Medicine\n\nPlease note that this project is released with a [Contributor Code of Conduct](https://mrc-ide.github.io/cinterpolate/CONDUCT).\nBy participating in this project you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrc-ide%2Fcinterpolate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrc-ide%2Fcinterpolate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrc-ide%2Fcinterpolate/lists"}