Blas - low level matrix operations

Hi,

I am happy to release the blas 1.0.0 wrapper, as well as its hex package.

This project, funded by the EEF, has been made possible thanks to @peerst

The Basic Linear Algebra Subprogram is a low-level standard of matrix-vector operations, which have been optimized to most machines. Having access to it in Erlang is a stepping stone, which will unlock new ways to write blasing fast algorithms operating in place.

Example

% Encode numbers, vectors in binaries as complex numbers
% Encoding c: complex numbers of total size 64 (32 bits for the real, imaginary parts)
Alpha = blas:ltb(c, [1,0]),
X     = blas:ltb(c, [1,2,  2,3,  3,1]),
% Create a mutable vector
Y     = blas:new(c, [1,1,  0,0,  1,2]),

% Y <- Alpha*X + Y
ok    = blas:run({caxpy, 3, Alpha, X, 1, Y, 1}, clean),

io:format("Result: ~p~n", [blas:to_list(c, Y)]).

Features

  • support for all BLAS types: s,d,c,z (single, double, complex single, complex double numbers)
  • support for all BLAS functions
  • support for dirty/clean NIF scheduling
  • array overflow / argument type checking

This wrapper has been currently tested on WSL-Ubuntu, with work underway to incorporate it on embedded device (GRISP), and extend it with LAPACKE.

Being written by a rather small team, it could really profit from any new/exterior POV. If anyone is interested, please take a look and share your comments!

Thank you,
Tanguy

15 Likes