Skip to content

Schultzer/libblas

Repository files navigation

libblas

documentation CircleCI Build status

BLAS for Rust.

Why

  • No special trait representing matrices or vectors
  • Powerful generics
  • Fully tested against REFERENCE BLAS Version 3.8.0
  • Performance are equal or faster than Accelerate framework
  • No hand tuned assembly

Examples

extern crate libblas;
use libblas::level3;

fn main {
  // 3X2 matrix
  let a = vec![1.,2.,3.,4.,5.,6.];
  let b = vec![1.,1.,1.,1.,1.,1.];
  let mut c = vec![2.,1.,3.,1.,4.,1.];
  level3::gemm('n', 'n', 2, 2, 1, 0.3, &a, 3, &b, 3, 1.3, &mut c, 3);
  assert!(c, vec![2.9, 1.9, 3.0, 1.6, 5.8, 1.0])
}

Usage

Add this to your Cargo.toml:

[dependencies]
libblas = "0.1"

and this to your crate root:

extern crate libblas;

Releases

Release notes are available in RELEASES.md.

Conformance

Conformance testing is done by generating fixtures from REFERENCE BLAS Version 3.8.0 and run against libblas. To generate the fixture you need to have json-fortran installed.

Run sh ./script/conformance.sh && cargo test --test conformance.

NOTE: only double precision and complex*16 fixtures are generated.

Benchmark

The benchmark suite does not benchmark against other BLAS implemations. See libblas-bench.

Run cargo +nightly bench

NOTE: remember to have nightly installed rustup install nightly.

Acknowledgement

libblas is implemented following the REFERENCE BLAS Version 3.8.0 and blas-js.

License

libblas is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.