hblas: Human friendly BLAS and Lapack bindings for Haskell.

[ bsd3, library, math ] [ Propose Tags ] [ Report a vulnerability ]

User friendly, simple bindings to BLAS and Lapack. Easy to extend and use.

HBLAS assumes you have BLAS and LAPACK installed. Users on OSX already have a BLAS and LAPACK installed for them. Users on LINUX and similar platforms will need to do the system equivalent of sudo apt-get install libblas liblapack.

HBLAS is not intended to be a library for end user array operations, but rather an easy adaptor for calling BLAS and LAPACK routines in their full generality from your end-user haskell linear algebra / array library of choice.

HBLAS roughly mirrors the naming conventions and datatype names of the standard BLAS and LAPACK libraries. Those of you who are familiar with these conventions and moderately comfortable with haskell will feel right at home.

If you are not familiar with the the operations and conventions of BLAS and Lapack, please read the Intel MKL BLAS and LAPACK documention, you'll learn a lot about what BLAS and LAPACK can do.

HBLAS doesn't provide every BLAS and LAPACK operation currently, but is designed so that adding support for new operations is quite easy!


[Skip to Readme]

Flags

Manual Flags

NameDescriptionDefault
openblasDisabled
cblas

Use on platforms when libcblas isn't part of libblas

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.2.0.0, 0.3.0.0, 0.3.0.1, 0.3.1.0, 0.3.1.1, 0.3.2.1, 0.3.2.2, 0.4.0.0, 0.4.0.1 (info)
Change log changelog.md
Dependencies base (>=4.6 && <4.14), primitive (>=0.5 && <0.7), storable-complex (>=0.2.0 && <0.3.0), vector (>=0.10 && <0.13) [details]
Tested with ghc ==7.10.3, ghc ==8.0.1, ghc ==8.0.2, ghc ==8.2.1, ghc >=8.3 && <8.4
License BSD-3-Clause
Author Carter Tazio Schonwald
Maintainer carter at wellposed dot com
Revised Revision 1 made by CarterSchonwald at 2020-02-07T00:27:47Z
Category Math
Home page http://github.com/wellposed/hblas/
Bug tracker http://github.com/wellposed/hblas/issues
Source repo head: git clone http://github.com/wellposed/hblas.git
Uploaded by CarterSchonwald at 2018-01-31T21:00:00Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 7671 total (2 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-01-31 [all 1 reports]

Readme for hblas-0.4.0.1

[back to package description]

Wellposed

About hblas

hblas is an open source component of the Wellposed® mathematical software suite.

Members of the numerical haskell open source community can be found on irc at #numerical-haskell on freenode, and via the numericalhaskell mailing list.

Build Status

hblas is a self contained full (well, not quite yet) BLAS and LAPACK binding that provides the full BLAS and LAPACKE APIs in a simple, unopinionated, Haskell wrapper.

This library is NOT meant to be used by end users, it is designed to be an unopinionated, simple, portable, easy to install BLAS/LAPACK substrate for higher level numerical computing libraries to build upon. Morever, this library is strictly a wrapper, and simply makes using the functionality of BLAS and LAPACK more accessible.

This library is NOT meant to be used a standalone array library (except in desperation), but rather should be used by a higher level numerical array library to provide high performance linear algebra routines.

Install

By default, hblas will assume you have BLAS and LAPACK built and installed.

OSX

On OS X systems, things will just work.

$ cabal install

Linux

On linux and bsd systems, you will need to manually install the BLAS and LAPACK libraries beforehand.

$ sudo apt-get install libblas liblapack
$ cabal install

Testing

To run the test suite execute:

$ cabal test

Linking

If you get an error like undefined reference to 'cblas_sdsdot' when building or running an HBLAS program, you might be on a system that builds BLAS and CBLAS separately, such as Arch Linux.

In which case, be sure to install CBLAS and invoke cabal install hblas -fCBLAS to make sure hblas links to CBLAS properly.

Usage

API is subject to change.

import Foreign.Storable
import Numerical.HBLAS.BLAS
import Numerical.HBLAS.MatrixTypes

-- Generate the constant mutable square matrix of the given type and dimensions.
constMatrix :: Storable a => Int -> a -> IO (IODenseMatrix Row a)
constMatrix n k = generateMutableDenseMatrix SRow (n,n) (const k)

example_dgemm :: IO ()
example_dgemm = do
    left  <- constMatrix 2 (2 :: Double)
    right <- constMatrix 2 (3 :: Double)
    out   <- constMatrix 2 (0 :: Double)

    dgemm NoTranspose NoTranspose 1.0 1.0 left right out

    resulting <- mutableVectorToList $ _bufferDenMutMat out
    print resulting

Getting Involved

Patches, bug reports, tests, and other contributions welcome.

If you want to add a new routine, check out the ones listed in the lapack section of the Intel MKL manual to get some human readable documentation.

Commercial Support

I have > 32bit size arrays, help!

Congrats, you have ``big compute on big data'', contact Carter and we'll try to help you out.