Note: This is a personal project collaboration between @showmyth and @IrregularPersona
A foundational library for performing basic algebraic operations on N-dimensional numerical data structures (Arrays, Matrices, and Tensors) in Rust.
Tensor Algebra provides efficient implementations for working with:
- Vectors (1D arrays)
- Matrices (2D arrays)
- Tensors (N-dimensional arrays)
All operations are aimed to be fast and safe whilst using Rust's powerful type system.
- Generic Numeric Types: Full support for
i32/64,u32/64,f32/64 - Type Safety
- Zero-Copy Operations: Efficient memory usage through references and views
- Seamless integration with Rust's Iterator ecosystem
- Basic Arithmetic: Element-wise addition, subtraction, multiplication, and division
- Scalar Operations: Broadcasting scalar values across tensors
- Linear Algebra: Matrix multiplication, transpose, determinant, and inverse operations
- Advanced Operations: Dot products, cross products, and norm calculations
Add this to your Cargo.toml:
[dependencies]
tensor-algebra = "0.1.0"This library is designed with performance in mind:
- Zero-cost abstractions
- Minimal allocations
- Cache-friendly memory layouts
This project is in active development. Current focus areas:
- Core tensor data structures
- Basic arithmetic operations
- Linear algebra foundations
- Comprehensive test suite
- Documentation and examples
Status: Pull requests are currently closed while we establish the core architecture.
We welcome contributions! Once we open contributions, please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes with tests
- Ensure all tests pass (
cargo test) - Update documentation as needed
- Submit a pull request
# Clone the repository
git clone https://github.com/showmyth/Tensor-Algebra-in-Rust.git
cd Tensor-Algebra-in-Rust
# Run tests
cargo test
# Run benchmarks
cargo bench
# Generate documentation
cargo doc --openThe library is structured around three core abstractions:
Tensor<T, const N: usize>: N-dimensional arrays with compile-time dimension checkingMatrix<T>: Specialized 2D operations with linear algebra supportVector<T>: 1D operations with vector space operations
Check out the examples/ directory for comprehensive usage examples:
arrays_basics.rsmatmul_basics.rsmatrices_basics.rs
Coming soon!
- Basic data structures
- Memory layout optimization
- Type system foundation
- Arithmetic operations
- Basic linear algebra
- Comprehensive benchmarks
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by NumPy and similar tensor libraries
- Built using Rust's powerful type system
- Thanks to the Rust community for excellent documentation and tools
Stay tuned for upcoming announcements! 👀
For questions or suggestions, feel free to open an issue or reach out to the maintainers.