Coder Social home page Coder Social logo

ccope / nblas Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nperf/nblas

0.0 1.0 0.0 388 KB

C++ bindings for CBLAS (Basic Linear Algebra Subprograms).

Home Page: http://nperf.github.io/nblas/

License: MIT License

Python 0.87% C 19.66% C++ 51.94% TypeScript 27.53%

nblas's Introduction

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.

nblas's People

Contributors

mateogianolio avatar greenkeeper[bot] avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.