Skip to main content

scivex_core/
lib.rs

1#![allow(
2    clippy::missing_errors_doc,
3    clippy::missing_panics_doc,
4    clippy::must_use_candidate,
5    clippy::return_self_not_must_use,
6    clippy::cast_precision_loss,
7    clippy::cast_possible_truncation,
8    clippy::cast_sign_loss,
9    clippy::cast_lossless,
10    clippy::many_single_char_names,
11    clippy::similar_names,
12    clippy::doc_markdown,
13    clippy::module_name_repetitions
14)]
15//! `scivex-core` — Foundation crate for the Scivex ecosystem.
16//!
17//! Provides tensors, numeric type traits, linear algebra, FFT, and math
18//! primitives. All other `scivex-*` crates build on top of this one.
19//!
20//! # Design
21//!
22//! - **Zero external dependencies** for math — everything is from scratch.
23//! - Generic over numeric types via the [`Scalar`] / [`Float`] / [`Real`] trait
24//!   hierarchy.
25//! - `unsafe` is confined to this crate; all higher-level crates use only safe
26//!   abstractions.
27
28/// Arena and slab allocators for temporary tensor buffers.
29pub mod arena;
30/// Native complex number type.
31pub mod complex;
32/// Numeric type traits: [`Scalar`], [`Float`], [`Real`], [`Integer`].
33pub mod dtype;
34/// Core error types.
35pub mod error;
36/// Fast Fourier Transform (FFT / IFFT / RFFT).
37pub mod fft;
38/// Expression JIT for fusing element-wise tensor operations.
39pub mod jit;
40/// Linear algebra: decompositions, solvers, and matrix operations.
41pub mod linalg;
42/// Elementary mathematical functions.
43pub mod math;
44/// Rayon-based parallel execution for tensors and matrix operations.
45#[cfg(feature = "parallel")]
46pub mod parallel;
47/// Type promotion rules, casting utilities, and runtime dtype tags.
48pub mod promote;
49/// Pseudo-random number generation.
50pub mod random;
51/// SIMD-accelerated kernels for core numerical operations.
52#[cfg(feature = "simd")]
53#[allow(dead_code, unsafe_op_in_unsafe_fn)]
54pub(crate) mod simd;
55/// Spatial data structures: KD-tree, ball tree.
56pub mod spatial;
57/// N-dimensional tensor type and operations.
58pub mod tensor;
59
60// Re-export key types at crate root for convenience.
61pub use complex::Complex;
62pub use dtype::{Float, Integer, Real, Scalar};
63pub use error::{CoreError, Result};
64pub use promote::{CastFrom, DType, DTypeOf, promote};
65pub use tensor::Tensor;
66pub use tensor::named::NamedTensor;
67pub use tensor::sparse::SparseTensor;
68
69// Re-export half-precision types when enabled.
70#[cfg(feature = "mixed-precision")]
71pub use dtype::{bf16, f16};
72
73/// Items intended for glob-import: `use scivex_core::prelude::*;`
74pub mod prelude {
75    pub use crate::complex::Complex;
76    pub use crate::dtype::{Float, Integer, Real, Scalar};
77    pub use crate::error::{CoreError, Result};
78    pub use crate::tensor::Tensor;
79    pub use crate::tensor::named::NamedTensor;
80    pub use crate::tensor::sparse::SparseTensor;
81}