2.1.13 • Published 12 months ago

nblas v2.1.13

Weekly downloads
1,276
License
MIT
Repository
-
Last release
12 months ago

nBLAS version travis maintainability Test Coverage

Greenkeeper badge

Node >=6.9 C++ bindings for all single- and double-precision CBLAS (Basic Linear Algebra Subprograms) routines.

$ npm install nblas
$ npm test

Works out of the box with OSX since CBLAS is included in the standard Accelerate framework. You might have to download and build LAPACK from source on other operating systems (LINUX: sudo apt-get libblas-dev).

import { dot, ddot, sdot, dznrm2 } from './src';

const f64a = new Float64Array([1, 2, 3]);
const f64b = new Float64Array([4, 5, 6]);

console.log(dot(f64a, f64b));
// 32
console.log(ddot(3, f64a, 1, f64b, 1));
// 32

const f32a = new Float32Array([1, 2, 3]);
const f32b = new Float32Array([4, 5, 6]);

console.log(dot(f32a, f32b));
// 32
console.log(sdot(3, f32a, 1, f32b, 1));
// 32

// complex arrays are packed like this: [Re, Im, Re, Im, ...]
// this is equivalent to [1 + 2i, 3 + 4i]
const c16 = new Float64Array([1, 2, 3, 4]);

// complex l2 norm
console.log(dznrm2(2, c16, 1));
// sqrt(1^2 + 2^2 + 3^2 + 4^2) ~ 5.477

Double precision functions expect Float64Array vectors, single precision functions expect Float32Array vectors.

2.1.13

12 months ago

2.1.12

1 year ago

2.1.10

1 year ago

2.1.11

1 year ago

2.1.8

4 years ago

2.1.9

4 years ago

2.1.7

5 years ago

2.1.6

5 years ago

2.1.5

5 years ago

2.1.4

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.2.2

7 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago