nblas-plus
v1.2.19
Published
C++ bindings for all single- and double-precision CBLAS (Basic Linear Algebra Subprograms), SPBLAS (Sparse BLAS), LAPACK.
Downloads
22
Readme
nBLAS+
Node >=4.0 C++ bindings for all single- and double-precision CBLAS (Basic Linear Algebra Subprograms) and SPBLAS (Sparse BLAS) routines. Also LAPACK routines (for now only solve general system of linear equations AX=B).
Preinstall
LINUX:
$ cd preinstall
$ sh debian.shTested on Ubuntu 16
OSX:
$ cd preinstall
$ sh osx.shTested on OSX ElCapitan
WIN:
Not tested.
https://icl.cs.utk.edu/lapack-for-windows/
Install
$ npm install nblas-plus
$ npm testAPI
BLAS Level 1 Routines and Functions
- [x]
?asum (x) - [x]
?axpy (x, y, [alpha = 1.0]) - [x]
?copy (x, y) - [x]
?dot (x, y) - [x]
?nrm2 (x) - [x]
?rot (x, y, c, s) - [x]
?rotg (x, y, c, s) - [x]
?rotm (x, y, param) - [x]
?rotmg (d1, d2, x1, y1, param) - [x]
?scal (x, alpha) - [x]
?swap (x, y) - [x]
i?amax (x)
- [x]
- [x]
?gbmv (a, x, y, [kl = 0], [ku = 0], [alpha = 1.0], [beta = 0], [trans = nblas.NoTrans]) - [x]
?gemv (a, x, y, [alpha = 1.0], [beta = 0], [trans = nblas.NoTrans]) - [x]
?ger (a, x, y, [alpha = 1.0]) - [x]
?sbmv (a, x, y, [uplo = nblas.Upper], [alpha = 1.0], [beta = 0]) - [x]
?spmv (ap, x, y, [uplo = nblas.Upper], [alpha = 1.0], [beta = 0]) - [x]
?spr (ap, x, [uplo = nblas.Upper], [alpha = 1.0]) - [x]
?spr2 (ap, x, y, [uplo = nblas.Upper], [alpha = 1.0]) - [x]
?symv (a, x, y, [uplo = nblas.Upper], [alpha = 1.0], [beta = 0]) - [x]
?syr (a, x, [uplo = nblas.Upper], [alpha = 1.0]) - [x]
?syr2 (a, x, y, [uplo = nblas.Upper], [alpha = 1.0], [beta = 0]) - [x]
?tbmv (a, x, y, [uplo = nblas.Upper], [trans = nblas.NoTrans], [diag = nblas.NonUnit]) - [x]
?tbsv (a, x, [uplo = nblas.Upper], [diag = nblas.NonUnit]) - [x]
?tpmv (ap, x, [uplo = nblas.Upper], [trans = nblas.NoTrans], [diag = nblas.NonUnit]) - [x]
?tpsv (ap, x, [uplo = nblas.Upper], [trans = nblas.NoTrans], [diag = nblas.NonUnit]) - [x]
?trmv (a, x, [uplo = nblas.Upper], [trans = nblas.NoTrans], [diag = nblas.NonUnit]) - [x]
?trsv (a, x, [uplo = nblas.Upper], [trans = nblas.NoTrans], [diag = nblas.NonUnit])
- [x]
- [x]
?gemm (a, b, c, m, n, k, [transa = 111], [transb = 111], [alpha = 1.0], [beta = 0]) - [x]
?symm (a, b, c, m, n, [side = nblas.Left], [uplo = nblas.Upper], [alpha = 1.0], [beta = 0]) - [x]
?syrk (a, c, n, k, [uplo = nblas.Upper], [trans = nblas.NoTrans], [alpha = 1.0], [beta = 0]) - [x]
?syr2k (a, b, c, n, k, [uplo = nblas.Upper], [trans = nblas.NoTrans], [alpha = 1.0], [beta = 0]) - [x]
?trmm (a, b, m, n, [side = nblas.Left], [uplo = nblas.Upper], [transa = 111], [diag = nblas.NonUnit], [alpha = 1.0]) - [x]
?trsm (a, b, m, n, [diag = nblas.NonUnit], [uplo = nblas.Upper], [transa = 111], [diag = nblas.NonUnit], [alpha = 1.0])
- [x]
LAPACK Routines (list of routines)
- [x] [
?gesv (A, B, m, n, [ipiv])] (https://software.intel.com/ru-ru/node/468876) - [x] [
?gesvx (A, B, X, m, n, [AF], [IPIV], [fact = nblas.Lapack.Fact.N], [trans = nblas.Lapack.Trans.N], [equed = nblas.Lapack.Equed.N], [R], [C])] (https://software.intel.com/ru-ru/node/468878) - [x] [
?getrf (A, IPIV, m, n)] (https://software.intel.com/ru-ru/node/468682) - [ ] others ... todo?
- [x] [
- SPBLAS Creation Routines
- Construction
- [x]
?uscr_begin (double, m, n)Construction - [x]
?uscr_block_begin (double, Mb, Nb, k, l)] Block construction (Mb, Nb - blocks count, k, l = blocks size, M = Mb * k, N = Nb * l) - [x]
?uscr_variable_block_begin (double, Mb, Nb, K, L)Variable block construction (K - array of size Mb, L - array of size Nb)
- [x]
- Insertion
- [x]
?uscr_insert_entry (A, val, i, j) - [x]
?uscr_insert_entries (A, nz, vals, indx, jndx) - [x]
?uscr_insert_col (A, j, nz, vals, indx) - [x]
?uscr_insert_row (A, i, nz, vals, jndx) - [x]
?uscr_insert_clique (A, k, l, vals, row_stride, col_stride, indx, jndx) - [x]
?uscr_insert_block (A, vals, row_stride, col_stride, i, j)
- [x]
- Completion of Construction Routines
- [x]
?uscr_end (A)
- [x]
- Matrix Property Routines
- [x]
usgp (A)get, see list of options below (Sparse matrix properties) - [x]
ussp (A)set
- [x]
- Destruction Routine
- [x]
usds (A)
- [x]
- Construction
- SPBLAS Level 1 Routines
- [x]
?usdot (x, indx, y)sparse dot product - [x]
?usaxpy (x, indx, y, alpha)sparse vector update - [x]
?usga (x, indx, y)sparse gather - [x]
?usgz (x, indx, y)sparse gather and zero - [x]
?ussc (x, indx, y)sparse scatter
- [x]
- SPBLAS Level 2 Routines
- [x]
?usmv (A, x, y, trans = nblas.Trans, alpha = 1.0)sparse matrix-vector multiply, A [m * n] * x [ n * 1 ] = y [ m * 1 ] - [x]
?ussv (A, x, trans = nblas.Trans, alpha = 1.0)sparse triangular solve
- [x]
- SPBLAS Level 3 Routines
[x]
?usmm (A, B, C, nrhs, trans = nblas.Trans, alpha = 1.0)sparse matrix-matrix multiply[x]
?ussm (A, B, nrhs, trans = nblas.Trans, alpha = 1.0)sparse triangular solve
- SPBLAS Creation Routines
Matrix layout enums
- Matrix transpose (
trans)nblas.NoTrans (default)nblas.Transnblas.ConjTrans
- Upper/lower matrix (
uplo)nblas.Upper (default)nblas.Lower
- Matrix diagonal (
diag)nblas.NonUnit (default)nblas.Unit
- Matrix side (
side)nblas.Left (default)nblas.Right
- Sparse matrix properties
- nblas.SymmetryType.
.blas_general.blas_symmetric.blas_hermitian.blas_triangular.blas_lower_triangular.blas_upper_triangular.blas_lower_symmetric.blas_upper_symmetric.blas_lower_hermitian.blas_upper_hermitian
- nblas.FieldType.
.blas_double_precision.blas_single_precision
- nblas.SizeType.
.blas_num_rows.blas_num_cols.blas_num_nonzeros
- nblas.HandleType.
.blas_invalid_handle.blas_new_handle.blas_open_handle.blas_valid_handle
- nblas.SymmetryType.
- For LAPACK
- nblas.Lapack.Fact.
.N (default).F.E
- nblas.Lapack.Trans.
.N (default).T.C
- nblas.Lapack.Equed.
.N (default).R.C.B
- nblas.Lapack.Fact.
- Matrix transpose (
Double precision functions expect Float64Array vectors, single precision functions expect Float32Array vectors.
Examples
See test/test.js
var nblas = require('nblas');
var f64a = new Float64Array([1, 2, 3]),
f64b = new Float64Array([4, 5, 6]);
nblas.dot(f64a, f64b); // or
nblas.ddot(3, f64a, 1, f64b, 1); // 32
var f32a = new Float32Array([1, 2, 3]),
f32b = new Float32Array([4, 5, 6]);
nblas.dot(f32a, f32b); // or
nblas.sdot(3, f32a, 1, f32b, 1); // 32