guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ANN] guile-ffi-cblas


From: Daniel Llorens
Subject: [ANN] guile-ffi-cblas
Date: Mon, 20 Oct 2014 07:46:17 +0200

Hello,

this is to announce that I've started a BLAS (Basic Linear Algebra Subprograms) 
wrapper for Guile using the FFI. The wrapper is actually for CBLAS, not that 
there's much difference.

https://gitorious.org/guile-ffi-cblas

Currently the wrapper covers: dot, axpy, nrm2, scal, asum, iamax, ger, gemv and 
gemm in all variants. There's a test suite that covers dot, axpy and partially 
gemv. I'll be adding the rest of the functions as I find the time.

The wrappers use the Guile array facility. This means that you don't need to 
give the size, inc and order arguments, because those are taken from the array 
object. E.g. rather than doing

(cblas_dgemv CblasRowMajor CblasNoTrans M N alpha A lda X incX beta Y incY)

you just do

(dgemv! alpha A CblasNoTrans X beta Y)

and instead of doing

(cblas_dgemv CblasRowMajor CblasTrans M N alpha A lda X incX beta Y incY)

you can do either of

(dgemv! alpha (transpose-array A 1 0) CblasNoTrans X beta Y)
(dgemv! alpha A CblasTrans X beta Y)

Here I've retained the TransA parameter because otherwise CblasConjTrans can't 
be done for free.

None of the wrappers do any copying or type conversion. This means that you 
can't pass an untyped array to dgemv! (it must be of type 'f64, likewise 'f32 
for sgemv!, etc.) and also that some cases that BLAS doesn't support will fail, 
e.g. if both strides of A in dgemv! differ from 1. All arguments are checked, 
or should be.

I've looked at the Chicken wrappers: http://wiki.call-cc.org/eggref/4/blas. 
These take srfi4 vectors with explicit size & inc arguments, so the calls look 
closer to the original library. I haven't decided yet whether to add compatible 
exports. (ffi cblas) does export the raw library calls, but those are of course 
very dangerous to use.

There's no doc yet. Comments & contributions are welcome.

Regards

        Daniel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]