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.sh
Tested on Ubuntu 16
OSX:
$ cd preinstall
$ sh osx.sh
Tested on OSX ElCapitan
WIN:
Not tested.
https://icl.cs.utk.edu/lapack-for-windows/
Install
$ npm install nblas-plus
$ npm test
API
-
?gbmv (a, x, y, [kl = 0], [ku = 0], [alpha = 1.0], [beta = 0], [trans = nblas.NoTrans])
?gemv (a, x, y, [alpha = 1.0], [beta = 0], [trans = nblas.NoTrans])
?ger (a, x, y, [alpha = 1.0])
?sbmv (a, x, y, [uplo = nblas.Upper], [alpha = 1.0], [beta = 0])
?spmv (ap, x, y, [uplo = nblas.Upper], [alpha = 1.0], [beta = 0])
?spr (ap, x, [uplo = nblas.Upper], [alpha = 1.0])
?spr2 (ap, x, y, [uplo = nblas.Upper], [alpha = 1.0])
?symv (a, x, y, [uplo = nblas.Upper], [alpha = 1.0], [beta = 0])
?syr (a, x, [uplo = nblas.Upper], [alpha = 1.0])
?syr2 (a, x, y, [uplo = nblas.Upper], [alpha = 1.0], [beta = 0])
?tbmv (a, x, y, [uplo = nblas.Upper], [trans = nblas.NoTrans], [diag = nblas.NonUnit])
?tbsv (a, x, [uplo = nblas.Upper], [diag = nblas.NonUnit])
?tpmv (ap, x, [uplo = nblas.Upper], [trans = nblas.NoTrans], [diag = nblas.NonUnit])
?tpsv (ap, x, [uplo = nblas.Upper], [trans = nblas.NoTrans], [diag = nblas.NonUnit])
?trmv (a, x, [uplo = nblas.Upper], [trans = nblas.NoTrans], [diag = nblas.NonUnit])
?trsv (a, x, [uplo = nblas.Upper], [trans = nblas.NoTrans], [diag = nblas.NonUnit])
-
?gemm (a, b, c, m, n, k, [transa = 111], [transb = 111], [alpha = 1.0], [beta = 0])
?symm (a, b, c, m, n, [side = nblas.Left], [uplo = nblas.Upper], [alpha = 1.0], [beta = 0])
?syrk (a, c, n, k, [uplo = nblas.Upper], [trans = nblas.NoTrans], [alpha = 1.0], [beta = 0])
?syr2k (a, b, c, n, k, [uplo = nblas.Upper], [trans = nblas.NoTrans], [alpha = 1.0], [beta = 0])
?trmm (a, b, m, n, [side = nblas.Left], [uplo = nblas.Upper], [transa = 111], [diag = nblas.NonUnit], [alpha = 1.0])
?trsm (a, b, m, n, [diag = nblas.NonUnit], [uplo = nblas.Upper], [transa = 111], [diag = nblas.NonUnit], [alpha = 1.0])
LAPACK Routines (list of routines)
- [
?gesv (A, B, m, n, [ipiv])
] (https://software.intel.com/ru-ru/node/468876) - [
?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) - [
?getrf (A, IPIV, m, n)
] (https://software.intel.com/ru-ru/node/468682) - others ... todo?
- [
-
- SPBLAS Creation Routines
- Construction
?uscr_begin (double, m, n)
Construction?uscr_block_begin (double, Mb, Nb, k, l)
] Block construction (Mb, Nb - blocks count, k, l = blocks size, M = Mb * k, N = Nb * l)?uscr_variable_block_begin (double, Mb, Nb, K, L)
Variable block construction (K - array of size Mb, L - array of size Nb)
- Insertion
?uscr_insert_entry (A, val, i, j)
?uscr_insert_entries (A, nz, vals, indx, jndx)
?uscr_insert_col (A, j, nz, vals, indx)
?uscr_insert_row (A, i, nz, vals, jndx)
?uscr_insert_clique (A, k, l, vals, row_stride, col_stride, indx, jndx)
?uscr_insert_block (A, vals, row_stride, col_stride, i, j)
- Completion of Construction Routines
?uscr_end (A)
- Matrix Property Routines
usgp (A)
get, see list of options below (Sparse matrix properties)ussp (A)
set
- Destruction Routine
usds (A)
- Construction
- SPBLAS Level 1 Routines
?usdot (x, indx, y)
sparse dot product?usaxpy (x, indx, y, alpha)
sparse vector update?usga (x, indx, y)
sparse gather?usgz (x, indx, y)
sparse gather and zero?ussc (x, indx, y)
sparse scatter
- SPBLAS Level 2 Routines
?usmv (A, x, y, trans = nblas.Trans, alpha = 1.0)
sparse matrix-vector multiply, A [m * n] * x [ n * 1 ] = y [ m * 1 ]?ussv (A, x, trans = nblas.Trans, alpha = 1.0)
sparse triangular solve
- SPBLAS Level 3 Routines
?usmm (A, B, C, nrhs, trans = nblas.Trans, alpha = 1.0)
sparse matrix-matrix multiply?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.Trans
nblas.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.
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