{"id":21159142,"url":"https://github.com/rufflewind/blas-hs","last_synced_at":"2026-02-16T11:09:32.220Z","repository":{"id":59151188,"uuid":"21264346","full_name":"Rufflewind/blas-hs","owner":"Rufflewind","description":"Low-level Haskell bindings to Blas.","archived":false,"fork":false,"pushed_at":"2021-06-07T06:09:30.000Z","size":187,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-26T01:21:48.507Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://hackage.haskell.org/package/blas-hs","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rufflewind.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}},"created_at":"2014-06-27T04:50:13.000Z","updated_at":"2021-06-07T06:09:32.000Z","dependencies_parsed_at":"2022-09-13T10:50:19.759Z","dependency_job_id":null,"html_url":"https://github.com/Rufflewind/blas-hs","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rufflewind%2Fblas-hs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rufflewind%2Fblas-hs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rufflewind%2Fblas-hs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rufflewind%2Fblas-hs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rufflewind","download_url":"https://codeload.github.com/Rufflewind/blas-hs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225562183,"owners_count":17488565,"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":[],"created_at":"2024-11-20T12:59:41.586Z","updated_at":"2026-02-16T11:09:32.175Z","avatar_url":"https://github.com/Rufflewind.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"blas-hs [![Build status][ci]][ca]\n=================================\n\n**blas-hs** provides a complete low-level interface to Blas via the foreign\nfunction interface, allowing Haskell programs to take advantage of optimized\nroutines for vector and matrix operations in Haskell.  For more information\nabout Blas, see http://netlib.org/blas\n\nblas-hs is compatible with any library that implements the standard C\ninterface for Blas.  If your implementation does not provide a C interface or\nuses a nonstandard interface, consider installing the CBlas binding from\nNetlib: http://netlib.org/blas/blast-forum/cblas.tgz\n\nDocumentation is [available on Hackage][hac].\n\nTake note of the [versioning policy of this package][pvp].\n\nQuick start\n-----------\n\nBefore you install, be sure to read up on\n[how linking is handled](#linking-to-blas).  The linking process is *not fully\nautomated* and may require some manual intervention depending on your system\nconfiguration.\n\nSince package is [available on Hackage][hac], it can be installed via\ncabal-install in the usual way:\n\n```sh\ncabal install blas-hs\n```\n\nInterface\n---------\n\nThe package provides two complete interfaces:\n\n- The `Blas.Primitive.*` modules expose the raw C interface.  All functions\n  are named in the same fashion as the original Blas interface with the\n  `cblas_` prefix removed.  This interface is stable.\n\n- The `Blas.Generic.*` modules expose a slightly more sophisticated interface\n  via type classes, allowing the functions to work on any of the 4 types\n  supported by Blas.  This interface is experimental.\n\n- The `Blas.Specialized.*` modules expose a more uniform interface similar to\n  `Blas.Generic.*` but without any type classes.  This interface is\n  experimental.\n\nBoth of these two interfaces have `Safe` and `Unsafe` versions, of which the\nonly difference is the type of foreign call used.  Refer to the GHC\ndocumentation for more information regarding appropriate use of safe and\nunsafe foreign calls.\n\nRequirements\n------------\n\nblas-hs requires either the\n[reference implementation of Blas from Netlib][ref] or any alternative\nimplementation of Blas that is compliant with the *de facto* Blas interface\n(e.g. ACML, ATLAS, OpenBLAS, MKL, and many others).  In addition, the\nimplementation must supply a C interface (*not* the Fortran one).\nFortunately, as long as the Fortran interface is available, one can use the\nCBlas bindings from Netlib to remedy this:\nhttp://netlib.org/blas/blast-forum/cblas.tgz\n\nLinking to Blas\n---------------\n\nBy default, blas-hs will link using `-lblas`.  On Darwin or Mac OS X, blas-hs\nwill instead use the Accelerate framework.\n\nFor any other configuration, you will need to\n[tweak this process](#predefined-flags).\n\nNote that linking blas-hs to the Blas library directly is optional: if you\navoid linking while building blas-hs, then the linking is deferred to the user\nof the blas-hs library instead.\n\n### Predefined flags\n\nThe `blas-hs.cabal` file provides a set of predefined flags to cover a few of\nthe common use cases.  If you want to do something more exotic, you may need\nto [edit the `blas-hs.cabal` file directly](#custom-configuration).\n\nTo override the default settings, you will need to give additional arguments\nto cabal-install:\n\n\u003cpre\u003e\u003ccode\u003ecabal install blas-hs \u003cvar\u003eFLAGS\u003c/var\u003e...\n# note: also works for `cabal configure`\u003c/code\u003e\u003c/pre\u003e\n\nEach flag is preceded by `-f`, so to turn on a flag named `openblas`, you\nwould specify `-fopenblas`.  To turn *off* the flag, specify `-f-openblas`\ninstead.\n\nThe flags here are listed in order of precedence: each flag will *override*\nall preceding flags, so if you (for example) turn both `openblas` and `mkl`\non, then `mkl` takes precedence.  All flags are *off* by default.\n\n  - `no-netlib`: Do *not* link with the reference Blas from Netlib.\n  - `no-accelerate`: Do *not* link with the Accelerate Framework.  Has no\n    effect except on Darwin / Mac OS X.\n  - `openblas`: Link with the OpenBLAS library.\n  - `mkl`: Link with the Intel Math Kernel Library.\n\nAdditionally, there is also the `cblas` flag that can be used to link to the\nCBlas bindings, in case your Blas implementation doesn't provide a C\ninterface.  This flag may be used in conjunction with any of the other flags.\n\n### Custom configuration\n\nIn a more complicated situation, you will have to modify the `blas-hs.cabal`\nfile.  First, you need to figure out which libraries to link to, as well as\nany additional options that need to be passed to the linker.  This usually\ncomes as a set of command-line arguments.  For example,\n\n    -fopenmp -L/usr/local/foobar/lib -lfoo -lbar\n\nThe exact meaning of the flags can be found in the\n[manual of ld](https://sourceware.org/binutils/docs/ld/Options.html).  For our\npurposes we only care about two kinds: those preceded by `-l` and those that\naren't.  The ones preceded by `-l` will go into the `extra-libraries` entry\n(without the `-l` prefix), while those that aren't will go into the\n`ld-options` entry.\n\nNow it's just a matter of modifying the package.\n\n 1. Download the package:\n\n    ```sh\n    cabal get blas-hs\n    ```\n\n 2. Edit the `blas-hs.cabal` to add the custom configuration:\n\n          -- custom configuration\n          extra-libraries: foo bar\n          ld-options:      -fopenmp -L/usr/local/foobar/lib\n\n 3. Change the current directory to that of the package, then run\n\n    ```sh\n    cabal install -fno-netlib -fno-accelerate\n    ```\n\n[ca]:  https://github.com/Rufflewind/blas-hs/actions/workflows/build.yml\n[ci]:  https://github.com/Rufflewind/blas-hs/actions/workflows/build.yml/badge.svg\n[ref]: http://netlib.org/blas\n[pvp]: https://gist.github.com/Rufflewind/03f4e03f7cfa52b8f07d\n[hac]: https://hackage.haskell.org/package/blas-hs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frufflewind%2Fblas-hs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frufflewind%2Fblas-hs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frufflewind%2Fblas-hs/lists"}