https://github.com/1git2clone/matrix-math-rs
It's quite funny how poorly implemented this is. Libraries that do these operations usually work in highly parallelized environments (sometimes entirely on the GPU). But the beauty of doing it manually is the learning curve. (Vec Vec double heap indirections are a crime against humanity)
https://github.com/1git2clone/matrix-math-rs
crate matrix-calculations matrix-library matrix-multiplication rust rust-library
Last synced: over 1 year ago
JSON representation
It's quite funny how poorly implemented this is. Libraries that do these operations usually work in highly parallelized environments (sometimes entirely on the GPU). But the beauty of doing it manually is the learning curve. (Vec Vec double heap indirections are a crime against humanity)
- Host: GitHub
- URL: https://github.com/1git2clone/matrix-math-rs
- Owner: 1Git2Clone
- License: mit
- Created: 2024-05-30T12:09:08.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-30T12:14:40.000Z (about 2 years ago)
- Last Synced: 2025-01-24T02:33:06.488Z (over 1 year ago)
- Topics: crate, matrix-calculations, matrix-library, matrix-multiplication, rust, rust-library
- Language: Rust
- Homepage:
- Size: 42 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Matrix-math
[![GH_Build Icon]][GH_Build Status] [![Build Icon]][Build Status] [![Docs Icon]][Docs] [![Version Icon]][Crate] [![License Icon]][LICENSE]
[GH_Build Icon]: https://img.shields.io/github/actions/workflow/status/1git2clone/matrix-math-rs/ci.yml?branch=main
[GH_Build Status]: https://github.com/1git2clone/matrix-math-rs/actions?query=branch%3Amaster
[Build Icon]: https://gitlab.com/1k2s/matrix-math/badges/main/pipeline.svg
[Build Status]: https://gitlab.com/1k2s/matrix-math/-/pipelines
[Docs Icon]: https://docs.rs/matrix-math/badge.svg
[Docs]: https://docs.rs/matrix-math/latest/leetcode_trees_rs/
[Version Icon]: https://img.shields.io/crates/v/matrix-math.svg
[Crate]: https://crates.io/crates/matrix-math
[License Icon]: https://img.shields.io/badge/license-MIT-blue.svg
[LICENSE]: LICENSE
A simple Rust library/CLI app that allows for basic work with mathematical Matrices.
## Getting started
```rs
use matrix::prelude::*;
fn interactive_matrices_example() -> Result<(), Error> {
let matrix1 = matrix::(1, None, None);
// By calling matrix2 with the length parameters of matrix1 like so. Doing the operations
// unchecked is **SAFE**.
let matrix2 = matrix::(2, Some(matrix1.len()), Some(matrix1[0].len()));
let sum = matrix_operation_unchecked(MatrixOperation::Addition, &matrix1, &matrix2);
println!("Sum:\n{:#?}", sum);
let diff = matrix_operation_unchecked(MatrixOperation::Subtraction, &matrix1, &matrix2);
println!("Difference:\n{:#?}", diff);
let product = matrix_operation_unchecked(MatrixOperation::Multiplication, &matrix1, &matrix2);
println!("Product:\n{:#?}", product);
let division = matrix_operation_unchecked(MatrixOperation::Division, &matrix1, &matrix2);
println!("Results from division:\n{:#?}", division);
Ok(())
}
fn main() -> Result<(), Error> {
let args = Args::parse();
if args.interactive {
interactive_matrices_example()?;
}
Ok(())
}
```