rlst/
lib.rs

1//! The Rust linear solver toolbox (RLST).
2//!
3//! The purpose of this library is to provide a comprehensive set of tools
4//! for dense and sparse linear algebra operations required in the solution
5//! of partial differential equations and other problems.
6//! RLST has the following feature set.
7//! - n-dimensional array structures that can be allocated on the stack or heap.
8//! - Support for BLAS matrix-matrix multiplication and a subset of Lapack operations (incl. LU, SVD, QR).
9//! - CSR sparse matrices on a single node or via MPI on multiple nodes.
10//! - Import and export into Matrix-Market format.
11//! - A general `operator` interface that can abstract linear operators, and iterative solvers
12//!   acting on linear operators.
13//!
14//! To learn about the features of RLST please have a look at the following documents.
15//! - [Getting started with RLST](crate::doc::getting_started)
16//! - [An introduction to dense linear algebra with RLST](crate::doc::dense_linear_algebra)
17//! - [Matrix decompositions](crate::doc::matrix_decompositions)
18//! - [Sparse matrix operations](crate::doc::sparse_matrices)
19//! - [Abstract linear algebra and iterative solvers](crate::doc::abstract_linear_algebra)
20//! - [MPI distributed computations](crate::doc::distributed_computations)
21
22#![cfg_attr(feature = "strict", deny(warnings), deny(unused_crate_dependencies))]
23#![warn(missing_docs)]
24
25pub mod base_types;
26#[cfg(feature = "fftw")]
27pub mod chebychev;
28pub mod dense;
29#[cfg(feature = "mpi")]
30pub mod distributed_tools;
31pub mod doc;
32#[cfg(feature = "fftw")]
33pub mod fftw;
34pub mod interface;
35pub mod interpolation;
36pub mod io;
37pub mod simd;
38pub mod sparse;
39pub mod tracing;
40pub mod traits;
41
42pub mod threading;
43
44pub mod operator;
45
46// Re-exports
47pub use rlst_proc_macro::measure_duration;
48pub use rlst_proc_macro::rlst_dynamic_array;
49pub use rlst_proc_macro::rlst_static_array;
50pub use rlst_proc_macro::rlst_static_type;
51
52pub use crate::dense::array::Array;
53pub use crate::dense::array::empty_array;
54
55// Re-export the traits
56pub use traits::*;
57
58// Re-export the base types
59pub use base_types::*;
60
61pub use dense::array::DynArray;
62pub use dense::array::SliceArray;
63pub use dense::array::SliceArrayMut;
64pub use dense::array::StridedDynArray;
65
66// Important constants
67
68/// Align memory along cache lines
69pub const CACHE_ALIGNED: usize = aligned_vec::CACHELINE_ALIGN;
70
71/// Align memory for FFTW. FFTW requires 16 bytes alignment
72pub const FFTW_ALIGNED: usize = 16;
73
74/// Align memory along page lines
75///
76// On x86_64 architectures a page size of 4kb is assumed.
77// On other architectures we default to 64kb to take into account
78// large page sizes on some ARM platforms.
79pub const PAGE_ALIGNED: usize = {
80    if cfg!(target_arch = "x86_64") {
81        4096
82    } else {
83        65536
84    }
85};
86
87#[cfg(test)]
88mod tests {
89
90    extern crate blas_src;
91    extern crate lapack_src;
92
93    // On Linux for unit testing enable the openblas dependency
94    // even though it is only used by `blas_src`,
95    // so that the dependency is not marked as unused by clippy
96    // and leads to an error message.
97    #[cfg(target_os = "linux")]
98    extern crate openblas_src;
99}