Netlib LAPACK FFI bindings
This crate contains netlib (reference) LAPACK FFI bindings.
Current FFI version is LAPACK v3.12.1. If you are using an older version of LAPACK, this crate should still work if you do not explicitly call the function that only occurs in higher version of LAPACK.
Netlib LAPACK (C/Fortran) source code is available on github.
This crate is not official bindgen project. It is originally intended to serve rust tensor toolkit RSTSR and rust electronic structure toolkit REST.
- Audience: Anyone uses BLAS and LAPACK function may also find it useful, not only RSTSR or REST program developers.
- Pure Extern or Dynamic Loading: This crate supports either pure extern (usual FFI, requires dynamic or static linking) and dynamic-loading, by cargo feature
dynamic_loading.
Dynamic loading
This crate supports dynamic loading by default.
If you do not want to use dynamic loading, please disable default cargo features (--no-default-features when cargo build).
The dynamic loading will try to find proper library when your program initializes. If you want to override the library to be loaded, please set these shell environmental variables to the dynamic library path:
RSTSR_DYLOAD_BLASforrstsr_lapack_ffi::blas;RSTSR_DYLOAD_CBLASforrstsr_lapack_ffi::cblas;RSTSR_DYLOAD_LAPACKforrstsr_lapack_ffi::lapack;RSTSR_DYLOAD_LAPACKEforrstsr_lapack_ffi::lapackeandrstsr_lapack_ffi::lapacke_utils.
Cargo features
Default features:
dynamic_loading: Supports dynamic loading.blas: Inclulde BLAS bindgens.cblas: Include CBLAS bindgens.lapack: Include LAPACK bindgens.
Optional features:
ilp64: Useint64_tfor dimension specification, or lapack error code types if this feature specified. Otherwise, useint32_t.- Please note that in LAPACKE, matrix layout (mostly the first argument in LAPACKE functions) is always
core::ffi::c_int, dependent to c compiler.
- Please note that in LAPACKE, matrix layout (mostly the first argument in LAPACKE functions) is always
lapacke: Include LAPACKE bindgens.lapacke_utils: Include additional utility functions of LAPACKE bindgens.
Crate structure
header: Header files copied (or renamed) from original source.scripts: Script to generate FFI bindgens.src: FFI bindings:blascblaslapacklapackelapacke_util
- In each bindgens, the following files are usually automatically generated by scripts:
ffi_base.rs: Basic type, enum, struct definitions.ffi_extern.rs: Unsafe extern "C" bindgen functions. Only activated when not dynamic loading.dyload_struct.rs: StructLibfor dynamic loading.dyload_initializer.rs: The initialization function ofLibfor dynamic loading.dyload_compatible.rs: Unsafe bindgen function that is compatible to that offfi_extern.rs. Only activated when dynamic loading.
Changelog
-
v0.4
- API breaking change: Supports and defaults to dynamic loading.
-
v0.2
- API breaking change: In v0.1, Fortran strlen option is included in f77blas and lapack binding. In v0.2, these arguments are muted. So for example, In v0.1
dgemm_will have 15 arguments: 13 arguments of usual usage + 2 arguments denotes string length oftransaandtransbarguments. In v0.2,dgemm_will have 13 arguments, the same to usual usage of Fortran equilvant.
- API breaking change: In v0.1, Fortran strlen option is included in f77blas and lapack binding. In v0.2, these arguments are muted. So for example, In v0.1