{"id":31021370,"url":"https://github.com/sisl/gridinterpolations.jl","last_synced_at":"2025-09-13T11:20:57.114Z","repository":{"id":27213049,"uuid":"30684000","full_name":"sisl/GridInterpolations.jl","owner":"sisl","description":"Multidimensional grid interpolation in arbitrary dimensions","archived":false,"fork":false,"pushed_at":"2025-03-25T22:31:16.000Z","size":417,"stargazers_count":53,"open_issues_count":8,"forks_count":13,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-09-01T05:08:37.172Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Julia","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/sisl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2015-02-12T03:40:53.000Z","updated_at":"2025-03-25T22:05:42.000Z","dependencies_parsed_at":"2023-12-16T19:26:50.281Z","dependency_job_id":"2f4f5591-4c50-455e-ab56-d480698dd3e0","html_url":"https://github.com/sisl/GridInterpolations.jl","commit_stats":{"total_commits":87,"total_committers":18,"mean_commits":4.833333333333333,"dds":0.8275862068965517,"last_synced_commit":"fa8cd12253713b3a236d04128c69936533d5c0c9"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/sisl/GridInterpolations.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisl%2FGridInterpolations.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisl%2FGridInterpolations.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisl%2FGridInterpolations.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisl%2FGridInterpolations.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sisl","download_url":"https://codeload.github.com/sisl/GridInterpolations.jl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisl%2FGridInterpolations.jl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274955746,"owners_count":25380669,"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","status":"online","status_checked_at":"2025-09-13T02:00:10.085Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-09-13T11:20:54.334Z","updated_at":"2025-09-13T11:20:57.101Z","avatar_url":"https://github.com/sisl.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GridInterpolations\n\n[![Build Status](https://github.com/sisl/GridInterpolations.jl/actions/workflows/CI.yml/badge.svg)](https://github.com/sisl/GridInterpolations.jl/actions/workflows/CI.yml)\n[![Coverage Status](https://coveralls.io/repos/sisl/GridInterpolations.jl/badge.svg)](https://coveralls.io/r/sisl/GridInterpolations.jl)\n\nThis package performs multivariate interpolation on a rectilinear grid. At the moment, it provides implementations of multilinear and simplex interpolation. As of benchmarks in December 2016, multilinear interpolation performs fastest and with the most accuracy.\n\nThe following image visualizes grid-based interpolation in two dimensions, with shape of interpolater for (−0.3,0.8) inscribed. The small dots reﬂect the interpolation's estimate for sin(x)+2cos(y)+sin(5xy), which is the underlying reward function approximated by the large dot lattice.\n\n![Illustration of performance of multilinear and simplex interpolation methods](sampleInterpolation.png)\n\nFor a description of multilinear and simplex interpolation see: Scott Davies, _Multidimensional Triangulation and Interpolation for Reinforcement Learning_, Advances in Neural Information Processing Systems, Cambridge, MA: MIT Press, 1997. [pdf](http://papers.nips.cc/paper/1229-multidimensional-triangulation-and-interpolation-for-reinforcement-learning.pdf)\n\nThere are some related packages, such as [Interpolations.jl](https://github.com/tlycken/Interpolations.jl).  \n\n## Installation\n\nStart Julia and run the following command:\n\n```julia\nPkg.add(\"GridInterpolations\")\n```\n\n## Usage\n\nTo use the GridInterpolations module, begin your code with\n\n```julia\nusing GridInterpolations\n```\n\n## Interpolation\n\nCreate two-dimensional interpolation grids, a data array, and a point of interest:\n```julia\ngrid = RectangleGrid([0., 0.5, 1.],[0., 0.5, 1.])  \t# rectangular grid\nsGrid = SimplexGrid([0., 0.5, 1.],[0., 0.5, 1.])\t# simplex grid\nnGrid = NearestGrid([0., 0.5, 1.], [0., 0.5, 1.])     # nearest-neighbor grid \ngridData = [8., 1., 6., 3., 5., 7., 4., 9., 2.]   \t# vector of value data at each cut\nx = [0.25, 0.75]  \t\t\t\t\t\t\t\t\t# point at which to perform interpolation\n```\n\nPerform interpolation on the rectangular grid:\n```julia\njulia\u003e interpolate(grid,gridData,x)\n5.25\n```\n\nOr interpolate on the simplex grid:\n```julia\njulia\u003e interpolate(sGrid,gridData,x)\n6.0\n```\n\nOr interpolate on the nearest-neighbor grid:\n```julia\njulia\u003e interpolate(nGrid, gridData, x)\n9.0\n```\n\nCompute interpolants for the grids:\n```julia\njulia\u003e sGrid = SimplexGrid([0., 0.5, 1.],[0., 0.5, 1.])\n[[0.0,0.5,1.0],[0.0,0.5,1.0]]\n\njulia\u003e interpolants(sGrid, x)\n([4,5,8],[0.5,0.0,0.5])\n```\n\nConvert an index to a Grid coordinate:\n```julia\njulia\u003e ind2x(grid, 3)\n2-element Array{Float64,1}:\n 1.0\n 0.0\n```\n\nNumber of vertices in the grid:\n```julia\njulia\u003e length(grid)\n9\n```\n\nNumber of dimensions:\n```julia\njulia\u003e dimensions(grid)\n2\n```\n\nMulti-dimensional indexing using Cartesian coordinates:\n```julia\njulia\u003e [grid[c] for c in CartesianIndices((3,3))]\n3×3 Array{Array{Float64,1},2}:\n [0.0, 0.0]  [0.0, 0.5]  [0.0, 1.0]\n [0.5, 0.0]  [0.5, 0.5]  [0.5, 1.0]\n [1.0, 0.0]  [1.0, 0.5]  [1.0, 1.0]\n```\nor multi-dimensional indices\n```julia\njulia\u003e grid[2,2]\n2-element Array{Float64,1}:\n 0.5\n 0.5\n```\n\nSequential iteration over grid points:\n```julia\njulia\u003e for x in grid\n           # do stuff\n       end\n```\n\n### Auto differentiation\n\nAutodiff packages are also supported:\n```julia\ngrid_data = [8.0, 1.0, 6.0, 3.0, 5.0, 7.0, 4.0, 9.0, 2.0]\nx = [0.25, 0.75]\ngrid = RectangleGrid([0.0, 0.5, 1.0], [0.0, 0.5, 1.0])\n\nusing ForwardDiff\nf(x::Vector) = interpolate(grid, grid_data, x)\nForwardDiff.gradient(f, x)\n```\n\n## Limitations\n\n`RectangleGrid` will error in high-dimensional domains (above about 15). In these cases `SimplexGrid` should be used.\n\n## Credits\n\nContributors to this package include Maxim Egorov, Eric Mueller, and Mykel Kochenderfer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsisl%2Fgridinterpolations.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsisl%2Fgridinterpolations.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsisl%2Fgridinterpolations.jl/lists"}