Skip to main content

tensor_operations/
lib.rs

1//! # Tensor Operations: Matrix and Linear Algebra in Rust
2//!
3//! This library provides two implementations of matrix operations:
4//!
5//! 1. **Manual Implementation** (`manual` module): Pure Rust implementation from scratch
6//!    - Educational purpose to understand algorithms
7//!    - No external dependencies for core operations
8//!    - Good for learning linear algebra concepts
9//!
10//! 2. **Optimized Implementation** (`optimized` module): High-performance using nalgebra
11//!    - Production-ready code
12//!    - Uses BLAS-optimized linear algebra
13//!    - 10-1000x faster than manual implementation
14//!
15//! ## Quick Start
16//!
17//! ```no_run
18//! use tensor_operations::manual::Matrix;
19//!
20//! // Create a matrix
21//! let a = Matrix::new(vec![
22//!     vec![1.0, 2.0],
23//!     vec![3.0, 4.0],
24//! ]).unwrap();
25//!
26//! // Matrix operations
27//! let b = Matrix::new(vec![
28//!     vec![5.0, 6.0],
29//!     vec![7.0, 8.0],
30//! ]).unwrap();
31//!
32//! let sum = a.add(&b).unwrap();
33//! let product = a.mul(&b).unwrap();
34//! let det = a.determinant().unwrap();
35//! let inv = a.inverse().unwrap();
36//! ```
37
38pub mod manual;
39pub mod optimized;
40
41// Re-export commonly used types
42pub use manual::Matrix;
43pub use optimized::OptimizedMatrix;