1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
//! Russell - Rust Scientific Library
//!
//! **lab**: Matrix-vector laboratory including linear algebra tools
//!
//! # Example - Cholesky factorization
//!
//! ```
//! use russell_lab::{cholesky_factor, Matrix, StrError};
//!
//! fn main() -> Result<(), StrError> {
//! // set matrix
//! let a = Matrix::from(&[
//! [ 4.0, 12.0, -16.0],
//! [ 12.0, 37.0, -43.0],
//! [-16.0, -43.0, 98.0],
//! ]);
//!
//! // perform factorization
//! let m = a.nrow();
//! let mut l = Matrix::new(m, m);
//! cholesky_factor(&mut l, &a)?;
//!
//! // compare with solution
//! let l_correct = "┌ ┐\n\
//! │ 2 0 0 │\n\
//! │ 6 1 0 │\n\
//! │ -8 5 3 │\n\
//! └ ┘";
//! assert_eq!(format!("{}", l), l_correct);
//! Ok(())
//! }
//! ```
/// Defines a type alias for the error type as a static string
pub type StrError = &'static str;
mod as_array;
mod constants;
mod enums;
mod formatters;
mod generators;
mod math;
mod matrix;
mod matvec;
mod sort;
mod stopwatch;
mod vector;
pub use crate::as_array::*;
use crate::constants::*;
pub use crate::enums::*;
pub use crate::formatters::*;
pub use crate::generators::*;
pub use crate::math::*;
pub use crate::matrix::*;
pub use crate::matvec::*;
pub use crate::sort::*;
pub use crate::stopwatch::*;
pub use crate::vector::*;
// run code from README file
#[cfg(doctest)]
mod test_readme {
macro_rules! external_doc_test {
($x:expr) => {
#[doc = $x]
extern "C" {}
};
}
external_doc_test!(include_str!("../README.md"));
}