3 releases

0.1.2 Nov 14, 2024
0.1.1 Apr 1, 2024
0.1.0 Mar 2, 2024

#108 in Machine learning

Download history 1/week @ 2024-08-17 4/week @ 2024-08-24 11/week @ 2024-08-31 5/week @ 2024-09-14 21/week @ 2024-09-21 13/week @ 2024-09-28 2/week @ 2024-10-05 113/week @ 2024-11-09 35/week @ 2024-11-16 12/week @ 2024-11-23 14/week @ 2024-11-30

174 downloads per month
Used in 4 crates

MIT license

600KB
16K SLoC

ZeNu Matrix

ZeNu Matrix is a high-performance linear algebra library for Rust, designed to provide efficient matrix operations and various utilities for working with matrices. Whether you are building complex machine learning models or performing scientific computations, ZeNu Matrix offers the tools you need.

Features

  • Comprehensive Matrix Operations: Create, index, and slice matrices with ease.
  • Element-wise Operations: Perform operations on individual elements or entire matrices.
  • Efficient Matrix Multiplication (GEMM): Utilize optimized routines for matrix multiplication.
  • Matrix Transposition: Quickly transpose matrices as needed.
  • Broadcasting: Seamlessly broadcast operations over matrices of different shapes.
  • Random Matrix Generation: Generate matrices with random values for testing and initialization.
  • BLAS Integration: Leverage BLAS for optimized performance on supported hardware.
  • CUDA Support: Accelerate computations using NVIDIA GPUs with CUDA integration.

Getting Started

To start using ZeNu Matrix, add it to your Cargo.toml:

[dependencies]
zenu-matrix = "0.1.1"

Example

Here's a simple example of using ZeNu Matrix:

use zenu_matrix::{
    matrix::{IndexItem, OwnedMatrix},
    matrix_impl::OwnedMatrixDyn,
    operation::asum::Asum,
};

fn main() {
    let a = OwnedMatrixDyn::from_vec(vec![1., 2., 3., 4., 5., 6.], [2, 3]);
    let b = OwnedMatrixDyn::from_vec(vec![7., 8., 9., 10., 11., 12.], [3, 2]);
    let c = a.clone() * b.clone();

    assert_eq!(c.index_item([0, 0]), 58.);
    assert_eq!(c.index_item([0, 1]), 64.);
    assert_eq!(c.index_item([1, 0]), 139.);
    assert_eq!(c.index_item([1, 1]), 154.);
}

For more details and examples, please refer to the documentation.

License

ZeNu Matrix is licensed under the MIT License.

Dependencies

~1.5–4MB
~72K SLoC