{"id":14990733,"url":"https://github.com/tatjam/zgsl","last_synced_at":"2026-02-09T08:35:32.439Z","repository":{"id":251031520,"uuid":"835752450","full_name":"tatjam/zgsl","owner":"tatjam","description":"GNU Scientific Library (GSL) multi-platform build and wrapper for Zig","archived":false,"fork":false,"pushed_at":"2024-09-03T12:36:49.000Z","size":235,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T17:26:36.752Z","etag":null,"topics":["gsl","mathematics","zig"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/tatjam.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":"2024-07-30T13:13:13.000Z","updated_at":"2024-09-03T12:36:53.000Z","dependencies_parsed_at":"2024-09-24T16:04:12.330Z","dependency_job_id":"4f817e28-38b4-436e-947c-10990cbf9970","html_url":"https://github.com/tatjam/zgsl","commit_stats":{"total_commits":51,"total_committers":1,"mean_commits":51.0,"dds":0.0,"last_synced_commit":"db279da43f510cb7a7c3d9e94e596fa3d014899c"},"previous_names":["tatjam/zgsl"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tatjam/zgsl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tatjam%2Fzgsl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tatjam%2Fzgsl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tatjam%2Fzgsl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tatjam%2Fzgsl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tatjam","download_url":"https://codeload.github.com/tatjam/zgsl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tatjam%2Fzgsl/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270183606,"owners_count":24541341,"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-08-13T02:00:09.904Z","response_time":66,"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":["gsl","mathematics","zig"],"created_at":"2024-09-24T14:20:40.571Z","updated_at":"2026-02-09T08:35:27.391Z","avatar_url":"https://github.com/tatjam.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# State of the wrapper\n\nI will slowly build the wrapper as I need different functions in my use cases. If you want to contribute\na wrapper, feel free to do so by creating a Pull Request! On the same way, if you want to request a \nwrapper feel free to create an Issue. \n\nCheck below for the list of stuff that has been wrapped!\n\n# Usage\n\n## With Zig\n\nUsage with Zig is as simple as adding a dependency to your `build.zig.zon`:\n\n```Zig\n.dependencies = .{\n\t.zgsl = .{\n\t\t.url = \"TO BE SPECIFIED\",\n\t\t.hash = \"TO BE SPECIFIED\",\n\t}\n},\n```\n\nand including the dependency as needed in your `build.zig`:\n\n```Zig \nconst zgsl = b.dependency(\"zgsl\", .{\n\t.target = target,\n\t.optimize = optimize\n});\n\n// ... for example, if you generate an executable ... \n\nconst gsl_lib = zgsl.artifact(\"gsl\");\nexe.linkLibrary(gsl_lib);\nexe.linkLibC();\nexe.step.dependOn(\u0026zgsl.namedWriteFiles(\"gsl_include\").step);\n```\n\n\nAfterwards, depending on whether you want to use the wrapper or the raw functions (or both):\n\n### Using the wrapper\n\nTo use the Zig wrapper, you will use the module:\n\n```Zig    \nexe.root_module.addImport(\"zgsl\", zgsl.module(\"wrapper\"));\nexe.step.dependOn(\u0026zgsl.builder.top_level_steps.get(\"wrap\").?.step);\n```\n\nThe second line guarantees wrappers are generated, as otherwise you would have to manually run \n`zig build wrap` on the downloaded dependency.\n\nNow you have access to the wrapper under the name `zgsl`. For example, to compute a Bessel function:\n\n```Zig     \nconst sf = @import(\"zgsl\").sf;\n\n...\n\nconst result = try sf.bessel.J0_e(5.0);\nstd.debug.print(\"Bessel J0(5.0) = {}, error = {}\\n\", .{result.val, result.err});\n```\n\nTo learn more about the wrapper, check the tests contained in `src/test`, usage should be intuitive\ncoming from using the GSL library in C or other languages.\n\n**It's heavily recommended** that you disable the default GSL error handler, as otherwise Zig errors \nwill almost never be useful (GSL will panic before you can handle the errors). To do so use the \nfunction:\n\n```Zig\nconst gsl = @import(\"zgsl\")\n//...\ngsl.set_error_handler_off();\n```\n\n### Using the \"raw\" C library\n\nIn this case you also have to include the GSL header files and link with the \nlibrary, which can be done as follows:\n\n```Zig    \nexe.addIncludePath(zgsl.namedWriteFiles(\"gsl_include\").getDirectory().path(b, \"include\"));\n```\n\nNow you can directly call the GSL. The same example as before would be implemented as follows:\n\n```Zig \nconst gsl = @cImport({\n    @cInclude(\"gsl/gsl_sf_bessel.h\");\n    @cInclude(\"gsl/gsl_errno.h\");\n});\n\n...\n\nvar result_raw: gsl.gsl_sf_result = undefined;\nconst err = gsl.gsl_sf_bessel_J0_e(5.0, @ptrCast(\u0026result_raw));\nif(err != gsl.GSL_SUCCESS) {\n\treturn error.GSL;\n}\nstd.debug.print(\"Raw Bessel J0(5.0) = {}, error bound = {}\\n\", .{result_raw.val, result_raw.err});\n```\n\nThe convenience of the wrapper, which exploits Zig's errors, should have become evident.\n\n## With C / other languages\n\nThe wrapper cannot be used on C, but the building of the GSL is straightforward (and \nmultiplatform). Simply run `zig build` and use the files generated in `zig-out` (static library\nand header files) as you typically would.\n\n# Wrapper status\n\n(Unwrapped functions may be used directly from the C library, without the comfort of Zig of course!)\n\n- [ ]\tMathematical functions\n- [ ]\tPolynomials\n- [x]\tSpecial functions\n- [ ]\tVectors and Matrices\n- [ ]\tPermutations\n- [ ]\tCombinations\n- [ ]\tMultisets\n- [ ]\tSorting\n- [ ]\tBLAS Support\n- [ ]\tLinear Algebra\n- [ ]\tEigensystems\n- [ ]\tFFTs\n- [ ]\tNumerical Integration\n- [ ]\tRNG\n- [ ]\tStatistics\n- [ ]\tRunning Statistics\n- [ ]\tMoving Window Statistics\n- [ ]\tDigital Filtering\n- [ ]\tHistograms\n- [ ]\tN-tuples\n- [ ]\tMonte Carlo Integration\n- [ ]\tSimulated Annealing\n- [ ]\tODEs\n- [ ]\tInterpolation\n- [ ]\tNumerical differentiation\n- [ ]\tChebyshev approximations\n- [ ]\tSeries acceleration\n- [ ]\tWavelet transforms\n- [ ]\tDiscrete hankel transforms\n- [ ]\t1D root finding\n- [ ]\t1D minimization\n- [ ]\tnD root finding\n- [ ]\tnD minimization\n- [ ]\tLinear least squares\n- [ ]\tNonlinear least squares\n- [ ]\tBasis splines\n- [ ]\tSparse matrices\n- [ ]\tSparse BLAS\n- [ ]\tSparse Linear Algebra\n- [ ]\tPhysical constants\n- [ ]\tIEEE floating point arithmetic","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftatjam%2Fzgsl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftatjam%2Fzgsl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftatjam%2Fzgsl/lists"}