C++ bindings for all single- and double-precision CBLAS (Basic Linear Algebra Subprograms), SPBLAS (Sparse BLAS), LAPACK.
npm install nblas-plusNode >=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:
``bash`
$ cd preinstall
$ sh debian.sh
Tested on Ubuntu 16
OSX:
`bash`
$ cd preinstall
$ sh osx.sh
Tested on OSX ElCapitan
WIN:
Not tested.
https://icl.cs.utk.edu/lapack-for-windows/
Install
---
`bash`
$ npm install nblas-plus
$ npm test
API
---
- BLAS Level 1 Routines and Functions
- [x] ?asum (x)
- [x] [?axpy (x, y, [alpha = 1.0])](https://software.intel.com/node/e25d8e10-0440-4827-bc58-bc71128ea6ee#E25D8E10-0440-4827-BC58-BC71128EA6EE)?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]
- BLAS Level 2 Routines
- [x] [?gbmv (a, x, y, [kl = 0], [ku = 0], [alpha = 1.0], [beta = 0], [trans = nblas.NoTrans])](https://software.intel.com/node/bc780af8-f243-4a20-b264-06424a8b5621#BC780AF8-F243-4A20-B264-06424A8B5621)?gemv (a, x, y, [alpha = 1.0], [beta = 0], [trans = nblas.NoTrans])
- [x] [](https://software.intel.com/node/443228c4-626e-48a7-b230-26fb061eacf2#443228C4-626E-48A7-B230-26FB061EACF2)?ger (a, x, y, [alpha = 1.0])
- [x] [](https://software.intel.com/node/26a7befc-1a1d-4c19-b482-5e72e6b02417#26A7BEFC-1A1D-4C19-B482-5E72E6B02417)?sbmv (a, x, y, [uplo = nblas.Upper], [alpha = 1.0], [beta = 0])
- [x] [](https://software.intel.com/node/c80f5eb2-d6c3-44e5-b0c8-9813a0c2340a#C80F5EB2-D6C3-44E5-B0C8-9813A0C2340A)?spmv (ap, x, y, [uplo = nblas.Upper], [alpha = 1.0], [beta = 0])
- [x] [](https://software.intel.com/node/16cb58c4-105b-486c-b6aa-42bb0c721a76#16CB58C4-105B-486C-B6AA-42BB0C721A76)?spr (ap, x, [uplo = nblas.Upper], [alpha = 1.0])
- [x] [](https://software.intel.com/node/f460bc61-5a47-4c0d-a2e0-a29adaa1b613#F460BC61-5A47-4C0D-A2E0-A29ADAA1B613)?spr2 (ap, x, y, [uplo = nblas.Upper], [alpha = 1.0])
- [x] [](https://software.intel.com/node/c8dd665d-5e52-4214-aeab-ba4de61418e1#C8DD665D-5E52-4214-AEAB-BA4DE61418E1)?symv (a, x, y, [uplo = nblas.Upper], [alpha = 1.0], [beta = 0])
- [x] [](https://software.intel.com/node/6265ba37-6e58-4c27-8035-92d836f58ec4#6265BA37-6E58-4C27-8035-92D836F58EC4)?syr (a, x, [uplo = nblas.Upper], [alpha = 1.0])
- [x] [](https://software.intel.com/node/fcfba6db-8859-42e9-a626-3c74fc34b6c1#FCFBA6DB-8859-42E9-A626-3C74FC34B6C1)?syr2 (a, x, y, [uplo = nblas.Upper], [alpha = 1.0], [beta = 0])
- [x] [](https://software.intel.com/node/34efa07b-4a2a-42c3-90e2-d27b8a8f744e#34EFA07B-4A2A-42C3-90E2-D27B8A8F744E)?tbmv (a, x, y, [uplo = nblas.Upper], [trans = nblas.NoTrans], [diag = nblas.NonUnit])
- [x] [](https://software.intel.com/node/14dfa68e-00c5-44c5-9e61-7279602af0c7#14DFA68E-00C5-44C5-9E61-7279602AF0C7)?tbsv (a, x, [uplo = nblas.Upper], [diag = nblas.NonUnit])
- [x] [](https://software.intel.com/node/0e673aed-9c3a-44af-92a5-4a5326d6a007#0E673AED-9C3A-44AF-92A5-4A5326D6A007)?tpmv (ap, x, [uplo = nblas.Upper], [trans = nblas.NoTrans], [diag = nblas.NonUnit])
- [x] [](https://software.intel.com/node/f6666c0e-b843-4e12-9ad4-8898a6ef4018#F6666C0E-B843-4E12-9AD4-8898A6EF4018)?tpsv (ap, x, [uplo = nblas.Upper], [trans = nblas.NoTrans], [diag = nblas.NonUnit])
- [x] [](https://software.intel.com/node/0eecd264-9871-4097-8af5-68eedae0d00a#0EECD264-9871-4097-8AF5-68EEDAE0D00A)?trmv (a, x, [uplo = nblas.Upper], [trans = nblas.NoTrans], [diag = nblas.NonUnit])
- [x] [](https://software.intel.com/node/feb986db-24ff-4e64-9c44-289dde419eeb#FEB986DB-24FF-4E64-9C44-289DDE419EEB)?trsv (a, x, [uplo = nblas.Upper], [trans = nblas.NoTrans], [diag = nblas.NonUnit])
- [x] [](https://software.intel.com/node/d8733073-f041-4aa1-b82c-123dfa993ad7#D8733073-F041-4AA1-B82C-123DFA993AD7)
- BLAS Level 3 Routines
- [x] [?gemm (a, b, c, m, n, k, [transa = 111], [transb = 111], [alpha = 1.0], [beta = 0])](https://software.intel.com/node/90eaa001-d4c8-4211-9ea0-b62f5ade9cf0#90EAA001-D4C8-4211-9EA0-B62F5ADE9CF0)?symm (a, b, c, m, n, [side = nblas.Left], [uplo = nblas.Upper], [alpha = 1.0], [beta = 0])
- [x] [](https://software.intel.com/node/cae55cbe-8e83-4c7f-9c54-0a8598f8a8ef#CAE55CBE-8E83-4C7F-9C54-0A8598F8A8EF)?syrk (a, c, n, k, [uplo = nblas.Upper], [trans = nblas.NoTrans], [alpha = 1.0], [beta = 0])
- [x] [](https://software.intel.com/node/e8986ce9-3048-4295-86ff-c2512669b498#E8986CE9-3048-4295-86FF-C2512669B498)?syr2k (a, b, c, n, k, [uplo = nblas.Upper], [trans = nblas.NoTrans], [alpha = 1.0], [beta = 0])
- [x] [](https://software.intel.com/node/1233ba19-4666-4233-ba59-106b9e644893#1233BA19-4666-4233-BA59-106B9E644893)?trmm (a, b, m, n, [side = nblas.Left], [uplo = nblas.Upper], [transa = 111], [diag = nblas.NonUnit], [alpha = 1.0])
- [x] [](https://software.intel.com/node/fe86b64a-4620-4e8f-8263-8442ace782df#FE86B64A-4620-4E8F-8263-8442ACE782DF)?trsm (a, b, m, n, [diag = nblas.NonUnit], [uplo = nblas.Upper], [transa = 111], [diag = nblas.NonUnit], [alpha = 1.0])
- [x] [](https://software.intel.com/node/ce40548f-549d-4af8-9668-b63b28c8c63f#CE40548F-549D-4AF8-9668-B63B28C8C63F)
- LAPACK Routines (list of routines)
- [x] [?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])
- [x] [] (https://software.intel.com/ru-ru/node/468878) ?getrf (A, IPIV, m, n)
- [x] [] (https://software.intel.com/ru-ru/node/468682)
- [ ] others ... todo?
- SPBLAS (doc1, doc2)
- SPBLAS Creation Routines
- Construction
- [x] ?uscr_begin (double, m, n) Construction?uscr_block_begin (double, Mb, Nb, k, l)
- [x] ] 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)
- [x] Variable block construction (K - array of size Mb, L - array of size Nb)?uscr_insert_entry (A, val, i, j)
- Insertion
- [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] ?uscr_end (A)
- Completion of Construction Routines
- [x] usgp (A)
- Matrix Property Routines
- [x] get, see list of options below (Sparse matrix properties)ussp (A)
- [x] setusds (A)
- Destruction Routine
- [x] ?usdot (x, indx, y)
- SPBLAS Level 1 Routines
- [x] sparse dot product ?usaxpy (x, indx, y, alpha)
- [x] sparse vector update ?usga (x, indx, y)
- [x] sparse gather ?usgz (x, indx, y)
- [x] sparse gather and zero ?ussc (x, indx, y)
- [x] sparse scatter?usmv (A, x, y, trans = nblas.Trans, alpha = 1.0)
- SPBLAS Level 2 Routines
- [x] sparse matrix-vector multiply, A [m n] x [ n 1 ] = y [ m 1 ]?ussv (A, x, trans = nblas.Trans, alpha = 1.0)
- [x] sparse triangular solve ?usmm (A, B, C, nrhs, trans = nblas.Trans, alpha = 1.0)
- SPBLAS Level 3 Routines
- [x] sparse matrix-matrix multiply ?ussm (A, B, nrhs, trans = nblas.Trans, alpha = 1.0)
- [x] sparse triangular solvetrans
- Matrix layout enums
- Matrix transpose ()nblas.NoTrans (default)
- nblas.Trans
- nblas.ConjTrans
- uplo
- Upper/lower matrix ()nblas.Upper (default)
- nblas.Lower
- diag
- Matrix diagonal ()nblas.NonUnit (default)
- nblas.Unit
- side
- Matrix side ()nblas.Left (default)
- nblas.Right
- .blas_general
- Sparse matrix properties
- nblas.SymmetryType.
- .blas_symmetric
- .blas_hermitian
- .blas_triangular
- .blas_lower_triangular
- .blas_upper_triangular
- .blas_lower_symmetric
- .blas_upper_symmetric
- .blas_lower_hermitian
- .blas_upper_hermitian
- .blas_double_precision
- nblas.FieldType.
- .blas_single_precision
- .blas_num_rows
- nblas.SizeType.
- .blas_num_cols
- .blas_num_nonzeros
- .blas_invalid_handle
- nblas.HandleType.
- .blas_new_handle
- .blas_open_handle
- .blas_valid_handle
- .N (default)
- For LAPACK
- nblas.Lapack.Fact.
- .F
- .E
- .N (default)
- nblas.Lapack.Trans.
- .T
- .C
- .N (default)
- nblas.Lapack.Equed.
- .R
- .C
- .B
-
Double precision functions expect Float64Array vectors, single precision functions expect Float32Array vectors.
Examples
---
See test/test.js
`javascript
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
``