2017-08-14 01:52:58 +08:00
|
|
|
//! # nalgebra-lapack
|
2018-02-02 19:26:35 +08:00
|
|
|
//!
|
2017-08-14 01:52:58 +08:00
|
|
|
//! Rust library for linear algebra using nalgebra and LAPACK.
|
2018-02-02 19:26:35 +08:00
|
|
|
//!
|
2017-08-14 01:52:58 +08:00
|
|
|
//! ## Documentation
|
2018-02-02 19:26:35 +08:00
|
|
|
//!
|
2017-08-14 01:52:58 +08:00
|
|
|
//! Documentation is available [here](https://docs.rs/nalgebra-lapack/).
|
2018-02-02 19:26:35 +08:00
|
|
|
//!
|
2017-08-14 01:52:58 +08:00
|
|
|
//! ## License
|
2018-02-02 19:26:35 +08:00
|
|
|
//!
|
2017-08-14 01:52:58 +08:00
|
|
|
//! MIT
|
2018-02-02 19:26:35 +08:00
|
|
|
//!
|
2017-08-14 01:52:58 +08:00
|
|
|
//! ## Cargo features to select lapack provider
|
2018-02-02 19:26:35 +08:00
|
|
|
//!
|
2017-08-14 01:52:58 +08:00
|
|
|
//! Like the [lapack crate](https://crates.io/crates/lapack) from which this
|
|
|
|
//! behavior is inherited, nalgebra-lapack uses [cargo
|
2019-06-12 02:56:50 +08:00
|
|
|
//! features](https://doc.crates.io/manifest.html#the-[features]-section) to select
|
2017-08-14 01:52:58 +08:00
|
|
|
//! which lapack provider (or implementation) is used. Command line arguments to
|
|
|
|
//! cargo are the easiest way to do this, and the best provider depends on your
|
|
|
|
//! particular system. In some cases, the providers can be further tuned with
|
|
|
|
//! environment variables.
|
2018-02-02 19:26:35 +08:00
|
|
|
//!
|
2017-08-14 01:52:58 +08:00
|
|
|
//! Below are given examples of how to invoke `cargo build` on two different systems
|
|
|
|
//! using two different providers. The `--no-default-features --features "provider"`
|
|
|
|
//! arguments will be consistent for other `cargo` commands.
|
2018-02-02 19:26:35 +08:00
|
|
|
//!
|
2017-08-14 01:52:58 +08:00
|
|
|
//! ### Ubuntu
|
2018-02-02 19:26:35 +08:00
|
|
|
//!
|
2017-08-14 01:52:58 +08:00
|
|
|
//! As tested on Ubuntu 12.04, do this to build the lapack package against
|
|
|
|
//! the system installation of netlib without LAPACKE (note the E) or
|
|
|
|
//! CBLAS:
|
2018-02-02 19:26:35 +08:00
|
|
|
//!
|
2021-07-07 10:05:25 +08:00
|
|
|
//! ```ignore
|
2017-08-14 01:53:04 +08:00
|
|
|
//! sudo apt-get install gfortran libblas3gf liblapack3gf
|
|
|
|
//! export CARGO_FEATURE_SYSTEM_NETLIB=1
|
|
|
|
//! export CARGO_FEATURE_EXCLUDE_LAPACKE=1
|
|
|
|
//! export CARGO_FEATURE_EXCLUDE_CBLAS=1
|
2018-02-02 19:26:35 +08:00
|
|
|
//!
|
2018-09-25 11:01:18 +08:00
|
|
|
//! export CARGO_FEATURES="--no-default-features --features netlib"
|
2017-08-14 01:53:04 +08:00
|
|
|
//! cargo build ${CARGO_FEATURES}
|
|
|
|
//! ```
|
2018-02-02 19:26:35 +08:00
|
|
|
//!
|
2018-09-25 14:28:48 +08:00
|
|
|
//! ### macOS
|
2018-02-02 19:26:35 +08:00
|
|
|
//!
|
2018-09-25 14:28:48 +08:00
|
|
|
//! On macOS, do this to use Apple's Accelerate framework:
|
2018-02-02 19:26:35 +08:00
|
|
|
//!
|
2021-07-07 10:05:25 +08:00
|
|
|
//! ```ignore
|
2018-09-25 11:01:18 +08:00
|
|
|
//! export CARGO_FEATURES="--no-default-features --features accelerate"
|
2017-08-14 01:53:04 +08:00
|
|
|
//! cargo build ${CARGO_FEATURES}
|
|
|
|
//! ```
|
2018-02-02 19:26:35 +08:00
|
|
|
//!
|
2017-08-14 01:52:58 +08:00
|
|
|
//! [version-img]: https://img.shields.io/crates/v/nalgebra-lapack.svg
|
|
|
|
//! [version-url]: https://crates.io/crates/nalgebra-lapack
|
|
|
|
//! [status-img]: https://travis-ci.org/strawlab/nalgebra-lapack.svg?branch=master
|
|
|
|
//! [status-url]: https://travis-ci.org/strawlab/nalgebra-lapack
|
|
|
|
//! [doc-img]: https://docs.rs/nalgebra-lapack/badge.svg
|
|
|
|
//! [doc-url]: https://docs.rs/nalgebra-lapack/
|
2018-02-02 19:26:35 +08:00
|
|
|
//!
|
2017-08-14 01:52:58 +08:00
|
|
|
//! ## Contributors
|
|
|
|
//! This integration of LAPACK on nalgebra was
|
|
|
|
//! [initiated](https://github.com/strawlab/nalgebra-lapack) by Andrew Straw. It
|
|
|
|
//! then became officially supported and integrated to the main nalgebra
|
|
|
|
//! repository.
|
2017-08-03 01:38:28 +08:00
|
|
|
|
|
|
|
#![deny(non_camel_case_types)]
|
|
|
|
#![deny(unused_parens)]
|
|
|
|
#![deny(non_upper_case_globals)]
|
|
|
|
#![deny(unused_qualifications)]
|
|
|
|
#![deny(unused_results)]
|
2017-08-14 01:52:58 +08:00
|
|
|
#![deny(missing_docs)]
|
2018-11-07 01:32:20 +08:00
|
|
|
#![doc(
|
2019-06-12 02:56:50 +08:00
|
|
|
html_favicon_url = "https://nalgebra.org/img/favicon.ico",
|
|
|
|
html_root_url = "https://nalgebra.org/rustdoc"
|
2018-11-07 01:32:20 +08:00
|
|
|
)]
|
2017-08-03 01:38:28 +08:00
|
|
|
|
2021-11-17 01:49:19 +08:00
|
|
|
extern crate lapack;
|
|
|
|
extern crate lapack_src;
|
|
|
|
|
2017-08-03 01:38:28 +08:00
|
|
|
extern crate nalgebra as na;
|
2018-02-02 19:26:35 +08:00
|
|
|
extern crate num_traits as num;
|
2017-08-03 01:38:28 +08:00
|
|
|
|
|
|
|
mod lapack_check;
|
2018-05-25 05:51:57 +08:00
|
|
|
|
2017-08-03 01:38:28 +08:00
|
|
|
mod cholesky;
|
2018-05-25 05:51:57 +08:00
|
|
|
mod eigen;
|
|
|
|
mod hessenberg;
|
2017-08-03 01:38:28 +08:00
|
|
|
mod lu;
|
|
|
|
mod qr;
|
2022-01-19 11:35:11 +08:00
|
|
|
mod qz;
|
2022-01-25 12:56:44 +08:00
|
|
|
mod generalized_eigenvalues;
|
2017-08-07 01:41:12 +08:00
|
|
|
mod schur;
|
2018-05-25 05:51:57 +08:00
|
|
|
mod svd;
|
|
|
|
mod symmetric_eigen;
|
2017-08-03 01:38:28 +08:00
|
|
|
|
|
|
|
use num_complex::Complex;
|
|
|
|
|
|
|
|
pub use self::cholesky::{Cholesky, CholeskyScalar};
|
2017-08-07 01:41:12 +08:00
|
|
|
pub use self::eigen::Eigen;
|
2017-08-03 01:38:28 +08:00
|
|
|
pub use self::hessenberg::Hessenberg;
|
2018-05-25 05:51:57 +08:00
|
|
|
pub use self::lu::{LUScalar, LU};
|
|
|
|
pub use self::qr::QR;
|
2022-01-19 11:35:11 +08:00
|
|
|
pub use self::qz::QZ;
|
2022-01-25 12:56:44 +08:00
|
|
|
pub use self::generalized_eigenvalues::GE;
|
2019-03-23 18:46:56 +08:00
|
|
|
pub use self::schur::Schur;
|
2018-05-25 05:51:57 +08:00
|
|
|
pub use self::svd::SVD;
|
|
|
|
pub use self::symmetric_eigen::SymmetricEigen;
|
2017-08-03 01:38:28 +08:00
|
|
|
|
|
|
|
trait ComplexHelper {
|
|
|
|
type RealPart;
|
|
|
|
|
|
|
|
fn real_part(self) -> Self::RealPart;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ComplexHelper for f32 {
|
|
|
|
type RealPart = f32;
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn real_part(self) -> Self::RealPart {
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ComplexHelper for f64 {
|
|
|
|
type RealPart = f64;
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn real_part(self) -> Self::RealPart {
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ComplexHelper for Complex<f32> {
|
|
|
|
type RealPart = f32;
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn real_part(self) -> Self::RealPart {
|
|
|
|
self.re
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ComplexHelper for Complex<f64> {
|
|
|
|
type RealPart = f64;
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn real_part(self) -> Self::RealPart {
|
|
|
|
self.re
|
|
|
|
}
|
|
|
|
}
|